On 24/11/15 13:32 +0100, Rainer Orth wrote:
Jonathan Wakely <jwak...@redhat.com> writes:
On 17/11/15 13:33 +0100, Rainer Orth wrote:
Solaris 12 recently introduced the C++11 <math.h> overloads, which
caused bootstrap to be broken on both mainline and the gcc-5 branch:
In file included from
/vol/gcc/src/hg/trunk/local/libstdc++-v3/include/precompiled/stdc++.h:41:0:
/var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/cmath:
In function 'constexpr int std::fpclassify(float)':
/var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/cmath:561:3:
error: redefinition of 'constexpr int std::fpclassify(float)'
fpclassify(float __x)
^
In file included from /usr/include/math.h:13:0,
from
/var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/cmath:44,
from
/vol/gcc/src/hg/trunk/local/libstdc++-v3/include/precompiled/stdc++.h:41:
/usr/include/iso/math_c99.h:647:13: note: 'int std::fpclassify(float)'
previously defined here
inline int fpclassify(float __X) { return __builtin_fpclassify(
^
The following patch fixes this by testing for the problem and wrapping
the overloads in include/c_global/cmath and include/tr1/cmath
appropriately. The test needs to be dynamic since apparently a backport
to Solaris 11 (and perhaps even Solaris 10) is planned.
Why does <tr1/cmath> need to change, did Solaris also define the
functions in namespace std::tr1?
Without that part, I get errors like
In file included from
/vol/gcc/src/hg/trunk/local/libstdc++-v3/include/precompiled/stdtr1c++.h:37:0:
/var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/tr1/cmath:
In function 'float std::tr1::acosh(float)':
/var/gcc/regression/trunk/12-gcc/build/i386-pc-solaris2.12/libstdc++-v3/include/tr1/cmath:423:18:
error: 'float std::tr1::acosh(float)' conflicts with a previous declaration
acosh(float __x)
Ah yes, because there's a using std::acosh, which puts Solaris' new
overloads into namespace std::tr1.
OK, that's correct then, and the patch is OK for trunk and
gcc-5-branch as far as I'm concerned.