[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
math: Fix errors in C++ mode on glibc systems with clang
From: |
Bruno Haible |
Subject: |
math: Fix errors in C++ mode on glibc systems with clang |
Date: |
Wed, 13 Apr 2022 23:46:35 +0200 |
Building a complete gnulib testdir on a glibc system with clang 13, I see
these errors:
../../gltests/test-math-c++.cc:388:22: error: no member named 'isfinite' in
namespace 'gnulib'
../../gltests/test-math-c++.cc:395:22: error: no member named 'isinf' in
namespace 'gnulib'
../../gltests/test-math-c++.cc:402:22: error: no member named 'isnan' in
namespace 'gnulib'
../../gltests/test-math-c++.cc:409:22: error: no member named 'signbit' in
namespace 'gnulib'
This patch fixes them. I don't think it's possible to really define
the gnulib namespace member as desired, in this situation.
2022-04-13 Bruno Haible <bruno@clisp.org>
math: Fix errors in C++ mode on glibc systems with clang.
* lib/math.in.h (GNULIB_NAMESPACE_LACKS_ISFINITE,
GNULIB_NAMESPACE_LACKS_ISINF, GNULIB_NAMESPACE_LACKS_ISNAN,
GNULIB_NAMESPACE_LACKS_SIGNBIT): New macros.
* tests/test-math-c++.cc (isfinite): Skip test if
GNULIB_NAMESPACE_LACKS_ISFINITE is 1.
(isinf): Skip test if GNULIB_NAMESPACE_LACKS_ISINF is 1.
(isnan): Skip test if GNULIB_NAMESPACE_LACKS_ISNAN is 1.
(signbit): Skip test if GNULIB_NAMESPACE_LACKS_SIGNBIT is 1.
diff --git a/lib/math.in.h b/lib/math.in.h
index ccc3584802..a74a95da3e 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -2433,6 +2433,7 @@ _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
functions. */
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool)
# define isfinite rpl_isfinite
+# define GNULIB_NAMESPACE_LACKS_ISFINITE 1
# else
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, isfinite, bool)
# endif
@@ -2467,6 +2468,7 @@ _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
functions. */
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, rpl_isinf, bool)
# define isinf rpl_isinf
+# define GNULIB_NAMESPACE_LACKS_ISINF 1
# else
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, isinf, bool)
# endif
@@ -2594,6 +2596,7 @@ _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
functions. */
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)
# define isnan rpl_isnan
+# define GNULIB_NAMESPACE_LACKS_ISNAN 1
# else
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool)
# endif
@@ -2677,6 +2680,7 @@ _GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
functions. */
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool)
# define signbit rpl_signbit
+# define GNULIB_NAMESPACE_LACKS_SIGNBIT 1
# else
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, signbit, bool)
# endif
diff --git a/tests/test-math-c++.cc b/tests/test-math-c++.cc
index e9a7bfa6a5..6749fa58a1 100644
--- a/tests/test-math-c++.cc
+++ b/tests/test-math-c++.cc
@@ -385,28 +385,36 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::truncl, long double,
(long double));
# ifdef isfinite
# warning "isfinite should not be a macro in C++"
# endif
+# if !GNULIB_NAMESPACE_LACKS_ISFINITE
REAL_FLOATING_CHECK (isfinite, bool, (float), bool, (double), bool, (long
double));
+# endif
#endif
#if GNULIB_TEST_ISINF
# ifdef isinf
# warning "isinf should not be a macro in C++"
# endif
+# if !GNULIB_NAMESPACE_LACKS_ISINF
REAL_FLOATING_CHECK (isinf, bool, (float), bool, (double), bool, (long
double));
+# endif
#endif
#if GNULIB_TEST_ISNAN
# ifdef isnan
# warning "isnan should not be a macro in C++"
# endif
+# if !GNULIB_NAMESPACE_LACKS_ISNAN
REAL_FLOATING_CHECK (isnan, bool, (float), bool, (double), bool, (long
double));
+# endif
#endif
#if GNULIB_TEST_SIGNBIT
# ifdef signbit
# warning "signbit should not be a macro in C++"
# endif
+# if !GNULIB_NAMESPACE_LACKS_SIGNBIT
REAL_FLOATING_CHECK (signbit, bool, (float), bool, (double), bool, (long
double));
+# endif
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- math: Fix errors in C++ mode on glibc systems with clang,
Bruno Haible <=