summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-08-28 10:34:40 +0200
committerBruno Haible <bruno@clisp.org>2019-08-28 10:39:35 +0200
commit38ab8ed6c3aa72e099b76f768c92d04ed671b3e9 (patch)
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.
-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 2d065ac05a..6566b374f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1 +1,11 @@
+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>
diff --git a/lib/math.in.h b/lib/math.in.h
index 99a2c6a979..8292650d73 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -69,6 +69,6 @@ _gl_cxx_ ## func ## l (long double 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) \
{ \
@@ -76,4 +76,4 @@ func (float f) \
} \
-inline int \
-func (double d) \
+inline rettype \
+rpl_func (double d) \
{ \
@@ -81,4 +81,4 @@ func (double d) \
} \
-inline int \
-func (long double l) \
+inline rettype \
+rpl_func (long double l) \
{ \
@@ -2209,3 +2209,10 @@ _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
@@ -2236,3 +2243,10 @@ _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
@@ -2354,3 +2368,10 @@ _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
@@ -2430,3 +2451,10 @@ _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

Return to:

Send suggestions and report system problems to the System administrator.