This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [v3] Handle C++11 <math.h> overloads on Solaris 12
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- Cc: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Tue, 24 Nov 2015 12:05:59 +0000
- Subject: Re: [v3] Handle C++11 <math.h> overloads on Solaris 12
- Authentication-results: sourceware.org; auth=none
- References: <ydd6110erfv dot fsf at lokon dot CeBiTec dot Uni-Bielefeld dot DE>
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?