summaryrefslogtreecommitdiffabout
authorBruno Haible <bruno@clisp.org>2019-08-28 08:34:40 (GMT)
committer Bruno Haible <bruno@clisp.org>2019-08-28 08:39:35 (GMT)
commit38ab8ed6c3aa72e099b76f768c92d04ed671b3e9 (patch) (side-by-side diff)
tree0fd1f02ea1078bacd0cd8fa83d2716a170a6eaea
parentec0624f9f988e86abf78d6ea0e4538f2acb060ce (diff)
downloadgnulib-38ab8ed6c3aa72e099b76f768c92d04ed671b3e9.tar.gz
gnulib-38ab8ed6c3aa72e099b76f768c92d04ed671b3e9.tar.bz2
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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog10
-rw-r--r--lib/math.in.h50
2 files changed, 49 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d065ac..6566b37 100644
--- 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
diff --git a/lib/math.in.h b/lib/math.in.h
index 99a2c6a..8292650 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -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

Return to:

Send suggestions and report system problems to the System administrator.