bug-gnulib
[Top][All Lists]
Advanced

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

math tests: don't fail if isfinite, isinf, isnan, signbit is a macro.


From: Bruno Haible
Subject: math tests: don't fail if isfinite, isinf, isnan, signbit is a macro.
Date: Sun, 08 Dec 2019 15:05:10 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-166-generic; KDE/5.18.0; x86_64; ; )

On several platforms (macOS, FreeBSD, Solaris 11, Cygwin, mingw) I'm seeing
these errors:

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/include 
-Wall -D_THREAD_SAFE   -MT test-math-c++.o -MD -MP -MF $depbase.Tpo -c -o 
test-math-c++.o ../../gltests/test-math-c++.cc &&\
mv -f $depbase.Tpo $depbase.Po
../../gltests/test-math-c++.cc:386:4: error: "isfinite should not be a macro in 
C++"
#  error "isfinite should not be a macro in C++"
   ^
../../gltests/test-math-c++.cc:393:4: error: "isinf should not be a macro in 
C++"
#  error "isinf should not be a macro in C++"
   ^
../../gltests/test-math-c++.cc:400:4: error: "isnan should not be a macro in 
C++"
#  error "isnan should not be a macro in C++"
   ^
../../gltests/test-math-c++.cc:407:4: error: "signbit should not be a macro in 
C++"
#  error "signbit should not be a macro in C++"
   ^
4 errors generated.

While the C++ standard says that isfinite, isinf, isnan, signbit should not be
a macro, it is not a practical problem if these functions are defined as a
macro, rather than as an overloaded function.


2019-12-08  Bruno Haible  <address@hidden>

        math tests: Don't fail if isfinite, isinf, isnan, signbit is a macro.
        * tests/test-math-c++.cc (isfinite, isinf, isnan, signbit): Use #warning
        instead of #error.

diff --git a/tests/test-math-c++.cc b/tests/test-math-c++.cc
index 57bfd1b..190fd49 100644
--- a/tests/test-math-c++.cc
+++ b/tests/test-math-c++.cc
@@ -383,28 +383,28 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::truncl, long double, 
(long double));
 
 #if GNULIB_TEST_ISFINITE
 # ifdef isfinite
-#  error "isfinite should not be a macro in C++"
+#  warning "isfinite should not be a macro in C++"
 # endif
 REAL_FLOATING_CHECK (isfinite, bool, (float), bool, (double), bool, (long 
double));
 #endif
 
 #if GNULIB_TEST_ISINF
 # ifdef isinf
-#  error "isinf should not be a macro in C++"
+#  warning "isinf should not be a macro in C++"
 # endif
 REAL_FLOATING_CHECK (isinf, bool, (float), bool, (double), bool, (long 
double));
 #endif
 
 #if GNULIB_TEST_ISNAN
 # ifdef isnan
-#  error "isnan should not be a macro in C++"
+#  warning "isnan should not be a macro in C++"
 # endif
 REAL_FLOATING_CHECK (isnan, bool, (float), bool, (double), bool, (long 
double));
 #endif
 
 #if GNULIB_TEST_SIGNBIT
 # ifdef signbit
-#  error "signbit should not be a macro in C++"
+#  warning "signbit should not be a macro in C++"
 # endif
 REAL_FLOATING_CHECK (signbit, bool, (float), bool, (double), bool, (long 
double));
 #endif




reply via email to

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