From 69b0daeb4ab8041f4cc155cbe226a50326f54465 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Thu, 28 Jan 2016 13:09:23 +0000 Subject: [PATCH] re PR libstdc++/69450 (libstdc++-v3/include/math.h:66:1 2: error: 'constexpr bool std::isnan(double)' conflicts with a previous declaration) 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. From-SVN: r232925 --- libstdc++-v3/ChangeLog | 11 +++++++ libstdc++-v3/acinclude.m4 | 43 ++++++++++++++++++--------- libstdc++-v3/config.h.in | 7 +++-- libstdc++-v3/configure | 59 +++++++++++++++++++++++++++---------- libstdc++-v3/include/c_global/cmath | 4 +-- 5 files changed, 91 insertions(+), 33 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index feb986d..532ece6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2016-01-28 John David Anglin + + 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. + 2016-01-27 Jakub Jelinek * testsuite/libstdc++-prettyprinters/whatis.cc: Include . diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index f8dbb95..2d06670 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -2186,39 +2186,54 @@ AC_DEFUN([GLIBCXX_CHECK_MATH11_PROTO], [ fi AC_MSG_RESULT([$glibcxx_cv_math11_overload]) ;; - *-*-*gnu* | *-*-aix*) + *-*-*gnu* | *-*-aix* | *-*-hpux*) # If 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 # and must use the ones from instead. - AC_MSG_CHECKING([for obsolete isinf and isnan functions in ]) - AC_CACHE_VAL(glibcxx_cv_obsolete_isinf_isnan, [ + AC_MSG_CHECKING([for obsolete isinf function in ]) + AC_CACHE_VAL(glibcxx_cv_obsolete_isinf, [ AC_COMPILE_IFELSE([AC_LANG_SOURCE( [#include #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 defines obsolete isinf function.]) + fi + + AC_MSG_CHECKING([for obsolete isnan function in ]) + AC_CACHE_VAL(glibcxx_cv_obsolete_isnan, [ + AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [#include + #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 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 defines obsolete isnan function.]) fi - AC_MSG_RESULT([$glibcxx_cv_obsolete_isinf_isnan]) ;; esac diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 4600b23..5834154 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -300,8 +300,11 @@ /* Define to 1 if you have the header file. */ #undef HAVE_NAN_H -/* Define if defines obsolete isinf and isnan functions. */ -#undef HAVE_OBSOLETE_ISINF_ISNAN +/* Define if defines obsolete isinf function. */ +#undef HAVE_OBSOLETE_ISINF + +/* Define if defines obsolete isnan function. */ +#undef HAVE_OBSOLETE_ISNAN /* Define if poll is available in . */ #undef HAVE_POLL diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 5e91deb..efba47a 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -18177,14 +18177,14 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_math11_overload" >&5 $as_echo "$glibcxx_cv_math11_overload" >&6; } ;; - *-*-*gnu* | *-*-aix*) + *-*-*gnu* | *-*-aix* | *-*-hpux*) # If 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 # and must use the ones from instead. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for obsolete isinf and isnan functions in " >&5 -$as_echo_n "checking for obsolete isinf and isnan functions in ... " >&6; } - if test "${glibcxx_cv_obsolete_isinf_isnan+set}" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for obsolete isinf function in " >&5 +$as_echo_n "checking for obsolete isinf function in ... " >&6; } + if test "${glibcxx_cv_obsolete_isinf+set}" = set; then : $as_echo_n "(cached) " >&6 else @@ -18192,38 +18192,67 @@ else /* end confdefs.h. */ #include #undef isinf - #undef isnan namespace std { using ::isinf; bool isinf(float); bool isinf(long double); + } + using std::isinf; + bool b = isinf(0.0); + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_obsolete_isinf=yes +else + glibcxx_cv_obsolete_isinf=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_obsolete_isinf" >&5 +$as_echo "$glibcxx_cv_obsolete_isinf" >&6; } + if test $glibcxx_cv_obsolete_isinf = yes; then + +$as_echo "#define HAVE_OBSOLETE_ISINF 1" >>confdefs.h + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for obsolete isnan function in " >&5 +$as_echo_n "checking for obsolete isnan function in ... " >&6; } + if test "${glibcxx_cv_obsolete_isnan+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #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); _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : - glibcxx_cv_obsolete_isinf_isnan=yes + glibcxx_cv_obsolete_isnan=yes else - glibcxx_cv_obsolete_isinf_isnan=no + glibcxx_cv_obsolete_isnan=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_obsolete_isnan" >&5 +$as_echo "$glibcxx_cv_obsolete_isnan" >&6; } + if test $glibcxx_cv_obsolete_isnan = yes; then - - if test $glibcxx_cv_obsolete_isinf_isnan = yes; then - -$as_echo "#define HAVE_OBSOLETE_ISINF_ISNAN 1" >>confdefs.h +$as_echo "#define HAVE_OBSOLETE_ISNAN 1" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_obsolete_isinf_isnan" >&5 -$as_echo "$glibcxx_cv_obsolete_isinf_isnan" >&6; } ;; esac diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath index eca712e..6a24ebf 100644 --- a/libstdc++-v3/include/c_global/cmath +++ b/libstdc++-v3/include/c_global/cmath @@ -610,7 +610,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 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 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 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 -- 2.7.4