From 38ab8ed6c3aa72e099b76f768c92d04ed671b3e9 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 28 Aug 2019 10:34:40 +0200 Subject: [PATCH] isfinite, isinf, isnan, signbit: Fix error in C++ mode on mingw. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported by Martin Storsjö in . * 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 cannot be overridden in another way. --- ChangeLog | 10 ++++++++++ lib/math.in.h | 50 +++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 49 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d065ac05a..6566b374f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2019-08-28 Bruno Haible + + isfinite, isinf, isnan, signbit: Fix error in C++ mode on mingw. + Reported by Martin Storsjö in + . + * 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 + cannot be overridden in another way. + 2019-08-27 Paul Eggert Revert macOS INT_MULTIPLY_WRAPV patch 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 @@ -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 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 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 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 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 -- 2.39.5