bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

math C++ tests: Fix compilation error on macOS 11.2


From: Bruno Haible
Subject: math C++ tests: Fix compilation error on macOS 11.2
Date: Sat, 20 Mar 2021 22:56:43 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-203-generic; KDE/5.18.0; x86_64; ; )

Compiling a gnulib testdir on macOS 11/arm64, I get this error:

c++ -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I../../gltests -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. 
-I../../gltests/.. -I../gllib -I../../gltests/../gllib -I/Users/haible/include 
-Wall  -g -O2 -MT test-list-c++.o -MD -MP -MF $depbase.Tpo -c -o 
test-list-c++.o ../../gltests/test-list-c++.cc &&\
        mv -f $depbase.Tpo $depbase.Po
In file included from ../../gltests/test-list-c++.cc:20:
In file included from ../../gltests/../gllib/gl_list.hh:26:
In file included from ../gllib/stdlib.h:36:
In file included from 
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/stdlib.h:100:
../gllib/math.h:3095:43: error: 'isnan' is missing exception specification 
'throw()'
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool)
                                          ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/math.h:535:1: 
note: previous declaration is here
isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
^

This patch fixes it.


2021-03-20  Bruno Haible  <bruno@clisp.org>

        math C++ tests: Fix compilation error on macOS 11.2.
        * lib/math.in.h (isnan): For clang >= 12 on macOS, declare 'rpl_isnan',
        not 'isnan'.

diff --git a/lib/math.in.h b/lib/math.in.h
index 335505d..bbe86ad 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -2579,7 +2579,7 @@ _GL_EXTERN_C int rpl_isnanl (long double x) 
_GL_ATTRIBUTE_CONST;
 #  if defined isnan || defined GNULIB_NAMESPACE
 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
 #   undef isnan
-#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined 
__MACH__) || (defined __FreeBSD__ && __clang_major__ < 7) || defined 
__OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined 
__MACH__ && __clang_major__ < 12) || (defined __FreeBSD__ && __clang_major__ < 
7) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
   /* This platform's <cmath> possibly defines isnan through a set of inline
      functions.  */
 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]