bug-gnulib
[Top][All Lists]
Advanced

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

math: Fix compilation error in C++ mode on macOS 12.5


From: Bruno Haible
Subject: math: Fix compilation error in C++ mode on macOS 12.5
Date: Thu, 09 Feb 2023 19:30:47 +0100

Building a testdir on macOS 12.5, I also see this error:

In file included from ../../gltests/test-math-c++2.cc:20:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:572:12:
 error: reference to unresolved using declaration
    return isnan(__lcpp_x);
           ^
../gllib/math.h:3138:19: note: expanded from macro 'isnan'
#    define isnan rpl_isnan
                  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:325:1:
 note: using declaration annotated with 'using_if_exists' here
using ::isnan _LIBCPP_USING_IF_EXISTS;
^
1 error generated.
make[4]: *** [test-math-c++2.o] Error 1

Apparently the patch I did on 2021-03-20 for macOS 11.2 (__clang_major__ = 12)
needs to reverted for macOS 12.5 (__clang_major__ = 14). Oh well.


2023-02-09  Bruno Haible  <bruno@clisp.org>

        math: Fix compilation error in C++ mode on macOS 12.5.
        * lib/math.in.h (isnan): On macOS, treat clang version 14 again like
        clang versions < 12.

diff --git a/lib/math.in.h b/lib/math.in.h
index 70b75e2399..76d48a4443 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -2624,7 +2624,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__ && __clang_major__ < 12) || (defined __FreeBSD__ && (__clang_major__ < 
7 || __clang_major__ >= 11)) || defined __OpenBSD__ || (defined _WIN32 && 
!defined __CYGWIN__)))
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined 
__MACH__ && __clang_major__ != 12) || (defined __FreeBSD__ && (__clang_major__ 
< 7 || __clang_major__ >= 11)) || 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]