public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [libstdc++-v3] Fix detection of obsolete isnan
@ 2017-03-10 12:12 Richard Sandiford
  2017-03-10 12:16 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2017-03-10 12:12 UTC (permalink / raw)
  To: gcc-patches, libstdc++

libstdc++-v3 configure checks whether old glibc inline definitions
of isnan would conflict with the libstdc++-v3 definitions and
works around them if so.  But if g++ 6.x build A is used to build
another g++ 6.x B, the configure step for B will pick up the math.h
installed alongside A instead of the glibc version.  configure will
then assume that the workaround isn't necessary, leaving B with a
broken cmath.

isinf already worked around this.  This patch extends the same fix
to isnan.  (Thanks to George for the fix.)

Tested on arch64-linux-gnu.  OK for trunk and 6.x?

Thanks,
Richard


libstdc++-v3/
2017-03-10  George Lander  <george.lander@arm.com>

	* acinclude.m4 (glibcxx_cv_obsolete_isnan): Define
	_GLIBCXX_INCLUDE_NEXT_C_HEADERS before including math.h.
	* configure: Regenerate.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index d9859aa..5998fe6 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2297,7 +2297,8 @@ AC_DEFUN([GLIBCXX_CHECK_MATH11_PROTO], [
       AC_MSG_CHECKING([for obsolete isnan function in <math.h>])
         AC_CACHE_VAL(glibcxx_cv_obsolete_isnan, [
           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
-            [#include <math.h>
+            [#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
+             #include <math.h>
              #undef isnan
              namespace std {
                using ::isnan;
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 9bb9862..29456c4 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -18390,6 +18390,7 @@ else
 
           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
 #include <math.h>
              #undef isnan
              namespace std {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [libstdc++-v3] Fix detection of obsolete isnan
  2017-03-10 12:12 [libstdc++-v3] Fix detection of obsolete isnan Richard Sandiford
@ 2017-03-10 12:16 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2017-03-10 12:16 UTC (permalink / raw)
  To: gcc-patches, libstdc++, richard.sandiford

On 10/03/17 12:12 +0000, Richard Sandiford wrote:
>libstdc++-v3 configure checks whether old glibc inline definitions
>of isnan would conflict with the libstdc++-v3 definitions and
>works around them if so.  But if g++ 6.x build A is used to build
>another g++ 6.x B, the configure step for B will pick up the math.h
>installed alongside A instead of the glibc version.  configure will
>then assume that the workaround isn't necessary, leaving B with a
>broken cmath.
>
>isinf already worked around this.  This patch extends the same fix
>to isnan.  (Thanks to George for the fix.)

Huh, I wonder why I only did it for one of them.

>Tested on arch64-linux-gnu.  OK for trunk and 6.x?

OK, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-10 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 12:12 [libstdc++-v3] Fix detection of obsolete isnan Richard Sandiford
2017-03-10 12:16 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).