[v3] Handle C++11 <math.h> overloads on Solaris 12
Rainer Orth
ro@CeBiTec.Uni-Bielefeld.DE
Tue Nov 17 12:33:00 GMT 2015
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.
Bootstrapped without regressions on {i386-pc,sparc-sun}-solaris2.1[012]
and x86_64-pc-linux-gnu. Ok for mainline and the gcc-5 branch (where
the patch is identical except for minimally different context and not
restricting the dg-excess-errors in c99_classification_macros_c.cc to
*-*-solaris2.1[01]* since the branch still defaults to -std=gnu++98).
Rainer
2015-11-09 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
libstdc++-v3:
* acinclude.m4 (GLIBCXX_CHECK_MATH11_PROTO): New test.
* configure.ac: Use it.
* configure: Regenerate.
* config.h.in: Regenerate.
* include/c_global/cmath [__cplusplus >= 201103L]
(std::fpclassify): Wrap in !__CORRECT_ISO_CPP11_MATH_H_PROTO.
(std::isfinite): Likewise.
(std::isinf): Likewise.
(std::isnan): Likewise.
(std::isnormal): Likewise.
(std::signbit): Likewise.
(std::isgreater): Likewise.
(std::isgreaterequal): Likewise.
(std::isless): Likewise.
(std::islessequal): Likewise.
(std::islessgreater): Likewise.
(std::isunordered): Likewise.
(std::acosh): Likewise.
(std::asinh): Likewise.
(std::atanh): Likewise.
(std::cbrt): Likewise.
(std::copysign): Likewise.
(std::erf): Likewise.
(std::erfc): Likewise.
(std::exp2): Likewise.
(std::expm1): Likewise.
(std::fdim): Likewise.
(std::fma): Likewise.
(std::fmax): Likewise.
(std::fmin): Likewise.
(std::hypot): Likewise.
(std::ilogb): Likewise.
(std::lgamma): Likewise.
(std::llrint): Likewise.
(std::llround): Likewise.
(std::log1p): Likewise.
(std::log2): Likewise.
(std::logb): Likewise.
(std::lrint): Likewise.
(std::lround): Likewise.
(std::nearbyint): Likewise.
(std::nextafter): Likewise.
(std::nexttoward): Likewise.
(std::remainder): Likewise.
(std::remquo): Likewise.
(std::rint): Likewise.
(std::round): Likewise.
(std::scalbln): Likewise.
(std::scalbn): Likewise.
(std::tgamma): Likewise.
(std::trunc): Likewise.
* include/tr1/cmath [_GLIBCXX_USE_C99_MATH_TR1] (std::tr1::acosh):
Wrap in !__CORRECT_ISO_CPP11_MATH_H_PROTO.
(std::tr1::asinh): Likewise.
(std::tr1::atanh): Likewise.
(std::tr1::cbrt): Likewise.
(std::tr1::copysign): Likewise.
(std::tr1::erf): Likewise.
(std::tr1::erfc): Likewise.
(std::tr1::exp2): Likewise.
(std::tr1::expm1): Likewise.
(std::tr1::fabs): Likewise.
(std::tr1::fdim): Likewise.
(std::tr1::fma): Likewise.
(std::tr1::fmax): Likewise.
(std::tr1::fmin): Likewise.
(std::tr1::hypot): Likewise.
(std::tr1::ilogb): Likewise.
(std::tr1::lgamma): Likewise.
(std::tr1::llrint): Likewise.
(std::tr1::llround): Likewise.
(std::tr1::log1p): Likewise.
(std::tr1::log2): Likewise.
(std::tr1::logb): Likewise.
(std::tr1::lrint): Likewise.
(std::tr1::lround): Likewise.
(std::tr1::nearbyint): Likewise.
(std::tr1::nextafter): Likewise.
(std::tr1::nexttoward): Likewise.
(std::tr1::remainder): Likewise.
(std::tr1::remquo): Likewise.
(std::tr1::rint): Likewise.
(std::tr1::scalbln): Likewise.
(std::tr1::scalbn): Likewise.
(std::tr1::tgamma): Likewise.
(std::tr1::trunc): Likewise.
(std::tr1::pow): Likewise.
* testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc:
Restrict dg-xfail-if, dg-excess-errors to *-*-solaris2.1[01]*.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol12-libstdc++-math11-overloads.patch
Type: text/x-patch
Size: 43628 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20151117/9299efcd/attachment.bin>
-------------- next part --------------
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
More information about the Libstdc++
mailing list