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  <br...@clisp.org>

        isnan: Fix compilation error in C++ mode on OpenBSD 7.5-beta.
        Reported by Christian Weisgerber <na...@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.  */




Reply via email to