public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix libstdc++-v3/include/math.h:66:1 2: error: 'constexpr bool std::isnan(double)' conflicts with a previous declaration
@ 2016-01-28  0:49 John David Anglin
  2016-01-28 10:46 ` Jonathan Wakely
  0 siblings, 1 reply; 10+ messages in thread
From: John David Anglin @ 2016-01-28  0:49 UTC (permalink / raw)
  To: GCC Patches; +Cc: libstdc++, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

The attached patch fixes a stage1 build error compiling genautomata.c on hpux.  We need to test for obsolete
XOPEN declarations of isinf and isnan on hpux.  Further, we need to check individually for isinf and isnan on hpux11
since only isnan has an obsolete XOPEN declaration.

Tested on hppa2.0w-hp-hpux11.11.

Okay for trunk?

Dave
--
John David Anglin	dave.anglin@bell.net



[-- Attachment #2: libstdc++-isnan.d.txt --]
[-- Type: text/plain, Size: 3954 bytes --]

2016-01-27  John David Anglin  <danglin@gcc.gnu.org>

	PR libstdc++/69450
	* acinclude.m4 (GLIBCXX_CHECK_MATH11_PROTO): Split check for obsolete
	isinf and isnan functions into two independent checks.  Check on hpux.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/c_global/cmath (isinf(double), isnan(double)): Use
	_GLIBCXX_HAVE_OBSOLETE_ISINF and _GLIBCXX_HAVE_OBSOLETE_ISNAN,
	respectively.

Index: acinclude.m4
===================================================================
--- acinclude.m4	(revision 232776)
+++ acinclude.m4	(working copy)
@@ -2186,39 +2186,54 @@
       fi
       AC_MSG_RESULT([$glibcxx_cv_math11_overload])
       ;;
-    *-*-*gnu* | *-*-aix*)
+    *-*-*gnu* | *-*-aix* | *-*-hpux*)
       # If <math.h> defines the obsolete isinf(double) and isnan(double)
       # functions (instead of or as well as the C99 generic macros) then we
       # can't define std::isinf(double) and std::isnan(double) in <cmath>
       # and must use the ones from <math.h> instead.
-      AC_MSG_CHECKING([for obsolete isinf and isnan functions in <math.h>])
-        AC_CACHE_VAL(glibcxx_cv_obsolete_isinf_isnan, [
+      AC_MSG_CHECKING([for obsolete isinf function in <math.h>])
+        AC_CACHE_VAL(glibcxx_cv_obsolete_isinf, [
           AC_COMPILE_IFELSE([AC_LANG_SOURCE(
             [#include <math.h>
              #undef isinf
-             #undef isnan
              namespace std {
                using ::isinf;
                bool isinf(float);
                bool isinf(long double);
+             }
+             using std::isinf;
+             bool b = isinf(0.0);
+          ])],
+          [glibcxx_cv_obsolete_isinf=yes],
+          [glibcxx_cv_obsolete_isinf=no]
+        )])
+      AC_MSG_RESULT([$glibcxx_cv_obsolete_isinf])
+      if test $glibcxx_cv_obsolete_isinf = yes; then
+        AC_DEFINE(HAVE_OBSOLETE_ISINF, 1,
+                  [Define if <math.h> defines obsolete isinf function.])
+      fi
+
+      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>
+             #undef isnan
+             namespace std {
                using ::isnan;
                bool isnan(float);
                bool isnan(long double);
              }
-             using std::isinf;
              using std::isnan;
-             bool b = isinf(0.0) || isnan(0.0);
+             bool b = isnan(0.0);
           ])],
-          [glibcxx_cv_obsolete_isinf_isnan=yes],
-          [glibcxx_cv_obsolete_isinf_isnan=no]
+          [glibcxx_cv_obsolete_isnan=yes],
+          [glibcxx_cv_obsolete_isnan=no]
         )])
-
-
-      if test $glibcxx_cv_obsolete_isinf_isnan = yes; then
-        AC_DEFINE(HAVE_OBSOLETE_ISINF_ISNAN, 1,
-                  [Define if <math.h> defines obsolete isinf and isnan functions.])
+      AC_MSG_RESULT([$glibcxx_cv_obsolete_isnan])
+      if test $glibcxx_cv_obsolete_isnan = yes; then
+        AC_DEFINE(HAVE_OBSOLETE_ISNAN, 1,
+                  [Define if <math.h> defines obsolete isnan function.])
       fi
-      AC_MSG_RESULT([$glibcxx_cv_obsolete_isinf_isnan])
       ;;
   esac
 
Index: include/c_global/cmath
===================================================================
--- include/c_global/cmath	(revision 232776)
+++ include/c_global/cmath	(working copy)
@@ -610,7 +610,7 @@
   isinf(float __x)
   { return __builtin_isinf(__x); }
 
-#if _GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN \
+#if _GLIBCXX_HAVE_OBSOLETE_ISINF \
   && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
   using ::isinf;
 #else
@@ -635,7 +635,7 @@
   isnan(float __x)
   { return __builtin_isnan(__x); }
 
-#if _GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN \
+#if _GLIBCXX_HAVE_OBSOLETE_ISNAN \
   && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
   using ::isnan;
 #else

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

end of thread, other threads:[~2016-02-08 16:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-28  0:49 [PATCH] Fix libstdc++-v3/include/math.h:66:1 2: error: 'constexpr bool std::isnan(double)' conflicts with a previous declaration John David Anglin
2016-01-28 10:46 ` Jonathan Wakely
2016-02-04 22:11   ` Gerald Pfeifer
2016-02-04 22:31     ` John David Anglin
2016-02-04 22:41       ` Jonathan Wakely
2016-02-05  1:01         ` Jonathan Wakely
2016-02-06 12:51           ` Gerald Pfeifer
2016-02-06 15:31             ` Jonathan Wakely
2016-02-08 16:01               ` Jonathan Wakely
2016-02-04 22:49     ` 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).