* Fwd: gnulib: isnan: Fix compilation error in C++ mode
@ 2024-02-27 22:45 Bruno Haible
2024-02-27 23:34 ` Bruno Haible
0 siblings, 1 reply; 2+ messages in thread
From: Bruno Haible @ 2024-02-27 22:45 UTC (permalink / raw)
To: bug-gnulib; +Cc: Christian Weisgerber
[CCing bug-gnulib]
---------- Forwarded Message ----------
Subject: gnulib: isnan: Fix compilation error in C++ mode
Date: Dienstag, 27. Februar 2024, 23:08:47 CET
From: Christian Weisgerber <naddy@mips.inka.de>
To: Bruno Haible <bruno@clisp.org>
Hi,
regarding
isnan: Fix compilation error in C++ mode on macOS 14.4 / Xcode 15.2
https://lists.gnu.org/archive/html/bug-gnulib/2024-02/msg00121.html
I just came across the same problem on OpenBSD 7.5-beta (clang 16.0.6).
I guess the defined() check needs to be extended unless a more generic
solution can be found.
Index: gettext-tools/gnulib-lib/math.in.h
--- gettext-tools/gnulib-lib/math.in.h.orig
+++ gettext-tools/gnulib-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 __APPLE__ && defined __MACH__) || defined __FreeBSD__) && __clang_major__ >= 14)
+# elif (((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__) && __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. */
--
Christian "naddy" Weisgerber naddy@mips.inka.de
-----------------------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Fwd: gnulib: isnan: Fix compilation error in C++ mode
2024-02-27 22:45 Fwd: gnulib: isnan: Fix compilation error in C++ mode Bruno Haible
@ 2024-02-27 23:34 ` Bruno Haible
0 siblings, 0 replies; 2+ messages in thread
From: Bruno Haible @ 2024-02-27 23:34 UTC (permalink / raw)
To: bug-gnulib; +Cc: Christian Weisgerber
Hi,
Christian Weisgerber wrote:
> isnan: Fix compilation error in C++ mode on macOS 14.4 / Xcode 15.2
> https://lists.gnu.org/archive/html/bug-gnulib/2024-02/msg00121.html
>
> I just came across the same problem on OpenBSD 7.5-beta (clang 16.0.6).
> I guess the defined() check needs to be extended unless a more generic
> solution can be found.
>
> Index: gettext-tools/gnulib-lib/math.in.h
> --- gettext-tools/gnulib-lib/math.in.h.orig
> +++ gettext-tools/gnulib-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 __APPLE__ && defined __MACH__) || defined __FreeBSD__) && __clang_major__ >= 14)
> +# elif (((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__) && __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. */
Thanks for the report and patch. It appears that the issue comes from
the clang++ header files and that these header files are incorporated
in the OS (macOS, FreeBSD, OpenBSD so far). It is likely that this will
also hold for other OSes. I'm therefore committing a slightly more
general patch:
2024-02-27 Bruno Haible <bruno@clisp.org>
isnan: Fix compilation error in C++ mode on OpenBSD 7.5-beta.
Reported by Christian Weisgerber <naddy@mips.inka.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-02/msg00261.html>.
* lib/math.in.h (GNULIB_NAMESPACE_LACKS_ISNAN): Define on all platforms
with clang ≥ 14.
diff --git a/lib/math.in.h b/lib/math.in.h
index 85b7e6ff95..72a61d7044 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 __APPLE__ && defined __MACH__) || defined __FreeBSD__) && __clang_major__ >= 14)
+# elif __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] 2+ messages in thread
end of thread, other threads:[~2024-02-27 23:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-27 22:45 Fwd: gnulib: isnan: Fix compilation error in C++ mode Bruno Haible
2024-02-27 23:34 ` 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).