From: Jonathan Wakely Date: Fri, 22 Jan 2016 12:47:26 +0000 (+0000) Subject: Allow _GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN to be overridden X-Git-Tag: basepoints/gcc-7~1392 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=350fe2829e2012d0e768602102fac31b474b1d2c;p=thirdparty%2Fgcc.git Allow _GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN to be overridden PR libstdc++/69413 * config/os/gnu-linux/os_defines.h: Define _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC. * include/c_global/cmath (isinf, isnan): Check it. * doc/xml/manual/internals.xml: Document it. * doc/html/*: Regenerate. From-SVN: r232726 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3b559c516ed2..77ab6b31db10 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2016-01-22 Jonathan Wakely + + PR libstdc++/69413 + * config/os/gnu-linux/os_defines.h: Define + _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC. + * include/c_global/cmath (isinf, isnan): Check it. + * doc/xml/manual/internals.xml: Document it. + * doc/html/*: Regenerate. + 2016-01-21 Jonathan Wakely PR libstdc++/69406 diff --git a/libstdc++-v3/config/os/gnu-linux/os_defines.h b/libstdc++-v3/config/os/gnu-linux/os_defines.h index 30f32f391bd3..59b0a622da60 100644 --- a/libstdc++-v3/config/os/gnu-linux/os_defines.h +++ b/libstdc++-v3/config/os/gnu-linux/os_defines.h @@ -45,4 +45,8 @@ # undef _GLIBCXX_HAVE_GETS #endif +// Glibc 2.23 removed the obsolete isinf and isnan declarations. Check the +// version dynamically in case it has changed since libstdc++ was configured. +#define _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC __GLIBC_PREREQ(2,23) + #endif diff --git a/libstdc++-v3/doc/html/manual/internals.html b/libstdc++-v3/doc/html/manual/internals.html index 559f8bb470a1..4a521dbda488 100644 --- a/libstdc++-v3/doc/html/manual/internals.html +++ b/libstdc++-v3/doc/html/manual/internals.html @@ -88,6 +88,13 @@ the standard. to an expression that yields 0 if and only if the system headers are exposing proper support for the related set of functions. If defined, it must be 0 while bootstrapping the compiler/rebuilding the library. +

_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC may be defined +to an expression that yields 0 if and only if the system headers +are exposing non-standard isinf(double) and +isnan(double) functions in the global namespace. Those functions +should be detected automatically by the configure script when +libstdc++ is built but if their presence depends on compilation flags or +other macros the static configuration can be overridden.

Finally, you should bracket the entire file in an include-guard, like this:

diff --git a/libstdc++-v3/doc/xml/manual/internals.xml b/libstdc++-v3/doc/xml/manual/internals.xml
index 7acec6bbf59d..09407f86c24e 100644
--- a/libstdc++-v3/doc/xml/manual/internals.xml
+++ b/libstdc++-v3/doc/xml/manual/internals.xml
@@ -132,6 +132,14 @@ the standard.
 to an expression that yields 0 if and only if the system headers
 are exposing proper support for the related set of functions.  If defined,
 it must be 0 while bootstrapping the compiler/rebuilding the library.
+   
+   _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC may be defined
+to an expression that yields 0 if and only if the system headers
+are exposing non-standard isinf(double) and
+isnan(double) functions in the global namespace. Those functions
+should be detected automatically by the configure script when
+libstdc++ is built but if their presence depends on compilation flags or
+other macros the static configuration can be overridden.
    
    Finally, you should bracket the entire file in an include-guard, like
 this:
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index c4ee3f57fc37..eca712e0549a 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -610,7 +610,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   isinf(float __x)
   { return __builtin_isinf(__x); }
 
-#ifdef _GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN
+#if _GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN \
+  && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
   using ::isinf;
 #else
   constexpr bool
@@ -634,7 +635,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   isnan(float __x)
   { return __builtin_isnan(__x); }
 
-#ifdef _GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN
+#if _GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN \
+  && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
   using ::isnan;
 #else
   constexpr bool