Paul E Reimer reported in
<https://lists.gnu.org/archive/html/bug-gettext/2024-02/msg00002.html>:

> I am installing gettext-0.22.4.  ... As you can see, "make check" produces 
> two errors in msgconv-3 and lang-c++

> FAIL: lang-c++
> ==============
> 
> In file included from prog.cc:5:
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iostream:43:
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ios:221:
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:18:
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/mutex:191:
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:42:
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:2668:
> In file included from 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:317:
> /Users/reimer/local/src/gettext-0.22.4/gettext-tools/gnulib-lib/math.h:3190:43:
>  error: 'isnan' is missing exception specification 'throw()'
> _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool)
>                                           ^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:455:87:
>  note: previous declaration is here
> _LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 
> _LIBCPP_HIDE_FROM_ABI bool isnan(float __x) _NOEXCEPT {
>                                                                               
>         ^

Instead of trying to guess whether to declare isnan() with throw() or without 
throw(),
let me stop this crazy complexity here and treat macOS like FreeBSD.


2024-02-14  Bruno Haible  <br...@clisp.org>

        isnan: Fix compilation error in C++ mode on macOS 14.4 / Xcode 15.2.
        Reported by Paul E Reimer <rei...@anl.gov> in
        <https://lists.gnu.org/archive/html/bug-gettext/2024-02/msg00002.html>.
        * lib/math.in.h (GNULIB_NAMESPACE_LACKS_ISNAN): Define also on macOS
        with clang ≥ 14.

diff --git a/lib/math.in.h b/lib/math.in.h
index 718a270164..85b7e6ff95 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -2668,7 +2668,7 @@ _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)
 #    define isnan rpl_isnan
 #    define GNULIB_NAMESPACE_LACKS_ISNAN 1
-#   elif (defined __FreeBSD__ && __clang_major__ >= 14)
+#   elif (((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__) && 
__clang_major__ >= 14)
   /* Neither of the two possible _GL_MATH_CXX_REAL_FLOATING_DECL_2 invocations
      works.  Inline functions are already present in 
/usr/include/c++/v1/math.h,
      which comes from LLVM.  */




Reply via email to