* isnan: Fix compilation error in C++ mode on macOS 14.4 / Xcode 15.2
@ 2024-02-14 19:14 Bruno Haible
0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2024-02-14 19:14 UTC (permalink / raw)
To: bug-gnulib, Paul E Reimer
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 <bruno@clisp.org>
isnan: Fix compilation error in C++ mode on macOS 14.4 / Xcode 15.2.
Reported by Paul E Reimer <reimer@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. */
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-14 19:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-14 19:14 isnan: Fix compilation error in C++ mode on macOS 14.4 / Xcode 15.2 Bruno Haible
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).