]> Savannah Git Hosting - gnulib.git/commitdiff
isfinite, isinf, isnan, signbit: Fix error in C++ mode on mingw.
authorBruno Haible <bruno@clisp.org>
Wed, 28 Aug 2019 08:34:40 +0000 (10:34 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 28 Aug 2019 08:39:35 +0000 (10:39 +0200)
Reported by Martin Storsjö <martin@martin.st> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-08/msg00075.html>.

* lib/math.in.h (_GL_MATH_CXX_REAL_FLOATING_DECL_2): Add more arguments.
(isfinite, isinf, isnan, signbit): On mingw, use an override through
'#define', because the inline definitions in the platform's <cmath>
cannot be overridden in another way.

ChangeLog
lib/math.in.h

index 2d065ac05a0ef74baa13afd08ea766fc128a7fb4..6566b374f1723ee080f05d156b4e461aef6326e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2019-08-28  Bruno Haible  <bruno@clisp.org>
+
+       isfinite, isinf, isnan, signbit: Fix error in C++ mode on mingw.
+       Reported by Martin Storsjö <martin@martin.st> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2019-08/msg00075.html>.
+       * lib/math.in.h (_GL_MATH_CXX_REAL_FLOATING_DECL_2): Add more arguments.
+       (isfinite, isinf, isnan, signbit): On mingw, use an override through
+       '#define', because the inline definitions in the platform's <cmath>
+       cannot be overridden in another way.
+
 2019-08-27  Paul Eggert  <eggert@cs.ucla.edu>
 
        Revert macOS INT_MULTIPLY_WRAPV patch
index 99a2c6a97984814a12f273c994eee48e376be26c..8292650d732b69b6411c2f07674242518859641e 100644 (file)
@@ -67,20 +67,20 @@ _gl_cxx_ ## func ## l (long double l)                               \
 {                                                                   \
   return func (l);                                                  \
 }
-# define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func) \
+# define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func,rpl_func,rettype) \
 _GL_BEGIN_NAMESPACE                                                 \
-inline int                                                          \
-func (float f)                                                      \
+inline rettype                                                      \
+rpl_func (float f)                                                  \
 {                                                                   \
   return _gl_cxx_ ## func ## f (f);                                 \
 }                                                                   \
-inline int                                                          \
-func (double d)                                                     \
+inline rettype                                                      \
+rpl_func (double d)                                                 \
 {                                                                   \
   return _gl_cxx_ ## func ## d (d);                                 \
 }                                                                   \
-inline int                                                          \
-func (long double l)                                                \
+inline rettype                                                      \
+rpl_func (long double l)                                            \
 {                                                                   \
   return _gl_cxx_ ## func ## l (l);                                 \
 }                                                                   \
@@ -2207,7 +2207,14 @@ _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
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite)
+#   if defined __MINGW32__
+  /* This platform's <cmath> defines isfinite through a set of inline
+     functions.  */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool)
+#    define isfinite rpl_isfinite
+#   else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, isfinite, bool)
+#   endif
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -2234,7 +2241,14 @@ _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
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf)
+#   if defined __MINGW32__
+  /* This platform's <cmath> defines isinf through a set of inline
+     functions.  */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, rpl_isinf, bool)
+#    define isinf rpl_isinf
+#   else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, isinf, bool)
+#   endif
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -2352,7 +2366,14 @@ _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
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan)
+#   if defined __MINGW32__
+  /* This platform's <cmath> defines isnan through a set of inline
+     functions.  */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)
+#    define isnan rpl_isnan
+#   else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool)
+#   endif
 #  endif
 # else
 /* Ensure isnan is a macro.  */
@@ -2428,7 +2449,14 @@ _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
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit)
+#   if defined __MINGW32__
+  /* This platform's <cmath> defines signbit through a set of inline
+     functions.  */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool)
+#    define signbit rpl_signbit
+#   else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, signbit, bool)
+#   endif
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK