bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

math C++ tests: Fix compilation error in with clang >= 7 on FreeBSD


From: Bruno Haible
Subject: math C++ tests: Fix compilation error in with clang >= 7 on FreeBSD
Date: Wed, 09 Dec 2020 18:08:48 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; )

On FreeBSD 12.2, a gnulib testdir with --with-c++-tests fails to build:

In file included from ../../gltests/test-list-c++.cc:20:
In file included from ../../gltests/../gllib/gl_list.hh:22:
In file included from ../../gltests/../gllib/gl_xlist.h:22:
In file included from ../../gltests/../gllib/xalloc.h:22:
In file included from ../gllib/stdint.h:105:
In file included from ../gllib/sys/types.h:39:
In file included from /usr/include/sys/types.h:376:
In file included from ../gllib/sys/select.h:88:
In file included from ../gllib/sys/time.h:39:
In file included from /usr/include/sys/time.h:607:
In file included from ../gllib/sys/select.h:117:
In file included from ../gllib/signal.h:67:
In file included from ../gllib/pthread.h:56:
In file included from ../gllib/stdlib.h:28:
In file included from /usr/include/c++/v1/stdlib.h:100:
../gllib/math.h:3082:43: error: 'isnan' is missing exception specification 
'noexcept'
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool)
                                          ^
/usr/include/c++/v1/math.h:539:1: note: previous declaration is here
isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
^

The reason is that in this version of FreeBSD, the clang version is >= 7,
and /usr/include/c++/v1/math.h comes with non-template inline declarations
of isnan.


2020-12-09  Bruno Haible  <bruno@clisp.org>

        math C++ tests: Fix compilation error in with clang >= 7 on FreeBSD.
        * lib/math.in.h (isnan): For clang >= 7 on FreeBSD, declare 'rpl_isnan',
        not 'isnan'.

diff --git a/lib/math.in.h b/lib/math.in.h
index 4090eff..ebf2e0d 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -2566,7 +2566,7 @@ _GL_EXTERN_C int rpl_isnanl (long double x) 
_GL_ATTRIBUTE_CONST;
 #  if defined isnan || defined GNULIB_NAMESPACE
 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
 #   undef isnan
-#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined 
__MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || (defined _WIN32 && 
!defined __CYGWIN__)))
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined 
__MACH__) || (defined __FreeBSD__ && __clang_major__ < 7) || defined 
__OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
   /* This platform's <cmath> possibly defines isnan through a set of inline
      functions.  */
 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]