diff mbox

Fix libstdc++-v3/include/math.h:66:1 2: error: 'constexpr bool std::isnan(double)' conflicts with a previous declaration

Message ID 20160208160120.GD23928@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Feb. 8, 2016, 4:01 p.m. UTC
On 06/02/16 15:31 +0000, Jonathan Wakely wrote:
>On 6 February 2016 at 12:51, Gerald Pfeifer <gerald@pfeifer.com> wrote:
>> On Fri, 5 Feb 2016, Jonathan Wakely wrote:
>>>
>>> Can anyone else test this on an older FreeBSD or other target that
>>> isn't gnu/aix/hpux?
>>
>>
>> Thank you, Jonathan!
>>
>> I did not have such an older environment available, but now
>> could install the infrastructure and get all prerequisites in place for
>> FreeBSD 9.3/AMD64 testing.
>>
>> That allowed to both reproduce the original failure and confirm
>> that it does not occur any more with your proposed patch.
>
>OK, thanks. I'll commit it on Monday (with a slight tweak).

This enables the isinf/isnan checks everywhere and also adds #define
_GLIBCXX_INCLUDE_NEXT_C_HEADERS to the configure test, to ensure that
it finds the libc math.h and not an already installed libstdc++
wrapper (which would confuse the test). I also accidentally committed
a change to add 'constexpr' to the configure test, which I reverted.

Tested powerp64-linux, committed to trunk.
diff mbox

Patch

commit b0a7399294012b65df3d155da0182e017d6e4214
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Feb 8 15:22:32 2016 +0000

    Enable isinf/isnan checks for all targets
    
    	PR libstdc++/48891
    	* acinclude.m4 (GLIBCXX_CHECK_MATH11_PROTO): Enable isinf and isnan
    	checks for all targets except *-*-solaris2.* and ensure we find the
    	libc math.h header not our own.
    	* configure: Regenerate.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233214 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 057b58e..e667ccc 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2215,7 +2215,7 @@  AC_DEFUN([GLIBCXX_CHECK_MATH11_PROTO], [
       fi
       AC_MSG_RESULT([$glibcxx_cv_math11_overload])
       ;;
-    *-*-*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>
@@ -2223,12 +2223,13 @@  AC_DEFUN([GLIBCXX_CHECK_MATH11_PROTO], [
       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>
+            [#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
+             #include <math.h>
              #undef isinf
              namespace std {
                using ::isinf;
-               bool isinf(float);
-               bool isinf(long double);
+               constexpr bool isinf(float);
+               constexpr bool isinf(long double);
              }
              using std::isinf;
              bool b = isinf(0.0);

commit 6c1b4080c3cd651e3559bbbf155d1f09236c68ee
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Feb 8 15:37:59 2016 +0000

    Remove accidentally added 'constexpr' in previous commit
    
    	* acinclude.m4 (GLIBCXX_CHECK_MATH11_PROTO): Remove accidentally
    	added 'constexpr' in previous commit.
    	* configure: Regenerate.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233219 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index e667ccc..95df24a 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2228,8 +2228,8 @@  AC_DEFUN([GLIBCXX_CHECK_MATH11_PROTO], [
              #undef isinf
              namespace std {
                using ::isinf;
-               constexpr bool isinf(float);
-               constexpr bool isinf(long double);
+               bool isinf(float);
+               bool isinf(long double);
              }
              using std::isinf;
              bool b = isinf(0.0);