From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org, Paul E Reimer <reimer@anl.gov>
Subject: isnan: Fix compilation error in C++ mode on macOS 14.4 / Xcode 15.2
Date: Wed, 14 Feb 2024 20:14:27 +0100 [thread overview]
Message-ID: <24771013.hxa6pUQ8Du@nimes> (raw)
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. */
reply other threads:[~2024-02-14 19:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=24771013.hxa6pUQ8Du@nimes \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=reimer@anl.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).