bug-gnulib
[Top][All Lists]
Advanced

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

Fix compilation errors in C++ mode on OpenBSD


From: Bruno Haible
Subject: Fix compilation errors in C++ mode on OpenBSD
Date: Wed, 19 Aug 2020 10:40:37 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; )

On OpenBSD 6.7, with CC=cc CXX=c++ (i.e. clang and clang++, respectively),
I'm seeing these compilation errors:

depbase=`echo test-math-c++2.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
c++ -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I../../gltests -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. 
-I../../gltests/.. -I../gllib -I../../gltests/../gllib 
-I/home/bruno/prefix-cc/include -Wall  -g -O2 -MT test-math-c++2.o -MD -MP -MF 
$depbase.Tpo -c -o test-math-c++2.o ../../gltests/test-math-c++2.cc &&\
mv -f $depbase.Tpo $depbase.Po
In file included from ../../gltests/test-math-c++2.cc:20:
/usr/include/c++/v1/cmath:314:7: error: no member named 'rpl_signbit' in the 
global namespace; did you mean 'gnulib::rpl_signbit'?
using ::signbit;
      ^~
../gllib/math.h:3085:45: note: 'gnulib::rpl_signbit' declared here
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool)
                                            ^
In file included from ../../gltests/test-math-c++2.cc:20:
/usr/include/c++/v1/cmath:316:7: error: no member named 'rpl_isfinite' in the 
global namespace; did you mean 'gnulib::rpl_isfinite'?
using ::isfinite;
      ^~
../gllib/math.h:2841:46: note: 'gnulib::rpl_isfinite' declared here
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool)
                                             ^
In file included from ../../gltests/test-math-c++2.cc:20:
/usr/include/c++/v1/cmath:317:7: error: no member named 'rpl_isinf' in the 
global namespace; did you mean 'gnulib::rpl_isinf'?
using ::isinf;
      ^~
../gllib/math.h:2875:43: note: 'gnulib::rpl_isinf' declared here
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, rpl_isinf, bool)
                                          ^
In file included from ../../gltests/test-math-c++2.cc:20:
/usr/include/c++/v1/cmath:318:7: error: no member named 'rpl_isnan' in the 
global namespace; did you mean 'gnulib::rpl_isnan'?
using ::isnan;
      ^~
../gllib/math.h:3002:43: note: 'gnulib::rpl_isnan' declared here
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)
                                          ^
4 errors generated.

This patch fixes it.


2020-08-19  Bruno Haible  <bruno@clisp.org>

        Fix compilation errors in C++ mode on OpenBSD.
        * lib/math.in.h (isfinite, isinf, isnan, signbit): In C++ mode on
        OpenBSD with clang, use the approach without C preprocessor macro.

diff --git a/lib/math.in.h b/lib/math.in.h
index 0f67127..2fa79bb 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -2336,7 +2336,7 @@ _GL_EXTERN_C int gl_isfinitel (long double x);
 #  if defined isfinite || defined GNULIB_NAMESPACE
 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
 #   undef isfinite
-#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined 
__MACH__) || defined __FreeBSD__ || defined _AIX || (defined _WIN32 && !defined 
__CYGWIN__)))
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined 
__MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || 
(defined _WIN32 && !defined __CYGWIN__)))
   /* This platform's <cmath> possibly defines isfinite through a set of inline
      functions.  */
 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool)
@@ -2370,7 +2370,7 @@ _GL_EXTERN_C int gl_isinfl (long double x);
 #  if defined isinf || defined GNULIB_NAMESPACE
 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
 #   undef isinf
-#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined 
__MACH__) || defined __FreeBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined 
__MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || (defined _WIN32 && 
!defined __CYGWIN__)))
   /* This platform's <cmath> possibly defines isinf through a set of inline
      functions.  */
 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, rpl_isinf, bool)
@@ -2497,7 +2497,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 _WIN32 && !defined __CYGWIN__)))
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined 
__MACH__) || defined __FreeBSD__ || 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)
@@ -2580,7 +2580,7 @@ _GL_EXTERN_C int gl_signbitl (long double arg);
 #  if defined signbit || defined GNULIB_NAMESPACE
 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
 #   undef signbit
-#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined 
__MACH__) || defined __FreeBSD__ || defined _AIX || (defined _WIN32 && !defined 
__CYGWIN__)))
+#   if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined 
__MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || 
(defined _WIN32 && !defined __CYGWIN__)))
   /* This platform's <cmath> possibly defines signbit through a set of inline
      functions.  */
 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool)




reply via email to

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