Building with GCC-6 fails with `error: macro "min" passed 3 arguments, but...
Status: Inactive
Brought to you by:
dinosaur-rus
Compiling squirrelsh-1.2.7 with GCC-6 fails with:
error: macro "min" passed 3 arguments, but takes just 2
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
See: https://bugs.gentoo.org/show_bug.cgi?id=594466
In gcc-6, all <math.h> functions which were otherwise defined as macros, such as max() and min(), are now defined as real functions. In shell/base.cpp, by including "common.h", which defines such macros which conflict with <math.h> functions, before C++ standard headers, which transitively include <math.h>, the mismatch occurs. Including "common.h" after such headers resolves the issue.
Sorry for the late response.
I went a bit further than you suggested and replaced all
min()andmax()macros with more appropriatestd::min()andstd::max()functions.See https://sourceforge.net/p/squirrelsh/git/ci/13280cdf34d96216b4d10b9ea7656a42a967fc2b/ for details.
That's the better way of handling it. Thanks.