diff options
author | Bruno Haible <bruno@clisp.org> | 2019-08-28 10:34:40 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2019-08-28 10:39:35 +0200 |
commit | 38ab8ed6c3aa72e099b76f768c92d04ed671b3e9 (patch) | |
tree | 0fd1f02ea1078bacd0cd8fa83d2716a170a6eaea | |
parent | ec0624f9f988e86abf78d6ea0e4538f2acb060ce (diff) | |
download | gnulib-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-- | ChangeLog | 10 | ||||
-rw-r--r-- | lib/math.in.h | 50 |
2 files changed, 49 insertions, 11 deletions
@@ -1,3 +1,13 @@ | |||
1 | 2019-08-28 Bruno Haible <bruno@clisp.org> | ||
2 | |||
3 | isfinite, isinf, isnan, signbit: Fix error in C++ mode on mingw. | ||
4 | Reported by Martin Storsjö <martin@martin.st> in | ||
5 | <https://lists.gnu.org/archive/html/bug-gnulib/2019-08/msg00075.html>. | ||
6 | * lib/math.in.h (_GL_MATH_CXX_REAL_FLOATING_DECL_2): Add more arguments. | ||
7 | (isfinite, isinf, isnan, signbit): On mingw, use an override through | ||
8 | '#define', because the inline definitions in the platform's <cmath> | ||
9 | cannot be overridden in another way. | ||
10 | |||
1 | 2019-08-27 Paul Eggert <eggert@cs.ucla.edu> | 11 | 2019-08-27 Paul Eggert <eggert@cs.ucla.edu> |
2 | 12 | ||
3 | Revert macOS INT_MULTIPLY_WRAPV patch | 13 | 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) \ | |||
67 | { \ | 67 | { \ |
68 | return func (l); \ | 68 | return func (l); \ |
69 | } | 69 | } |
70 | # define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func) \ | 70 | # define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func,rpl_func,rettype) \ |
71 | _GL_BEGIN_NAMESPACE \ | 71 | _GL_BEGIN_NAMESPACE \ |
72 | inline int \ | 72 | inline rettype \ |
73 | func (float f) \ | 73 | rpl_func (float f) \ |
74 | { \ | 74 | { \ |
75 | return _gl_cxx_ ## func ## f (f); \ | 75 | return _gl_cxx_ ## func ## f (f); \ |
76 | } \ | 76 | } \ |
77 | inline int \ | 77 | inline rettype \ |
78 | func (double d) \ | 78 | rpl_func (double d) \ |
79 | { \ | 79 | { \ |
80 | return _gl_cxx_ ## func ## d (d); \ | 80 | return _gl_cxx_ ## func ## d (d); \ |
81 | } \ | 81 | } \ |
82 | inline int \ | 82 | inline rettype \ |
83 | func (long double l) \ | 83 | rpl_func (long double l) \ |
84 | { \ | 84 | { \ |
85 | return _gl_cxx_ ## func ## l (l); \ | 85 | return _gl_cxx_ ## func ## l (l); \ |
86 | } \ | 86 | } \ |
@@ -2207,7 +2207,14 @@ _GL_EXTERN_C int gl_isfinitel (long double x); | |||
2207 | # if defined isfinite || defined GNULIB_NAMESPACE | 2207 | # if defined isfinite || defined GNULIB_NAMESPACE |
2208 | _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite) | 2208 | _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite) |
2209 | # undef isfinite | 2209 | # undef isfinite |
2210 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite) | 2210 | # if defined __MINGW32__ |
2211 | /* This platform's <cmath> defines isfinite through a set of inline | ||
2212 | functions. */ | ||
2213 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool) | ||
2214 | # define isfinite rpl_isfinite | ||
2215 | # else | ||
2216 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, isfinite, bool) | ||
2217 | # endif | ||
2211 | # endif | 2218 | # endif |
2212 | # endif | 2219 | # endif |
2213 | #elif defined GNULIB_POSIXCHECK | 2220 | #elif defined GNULIB_POSIXCHECK |
@@ -2234,7 +2241,14 @@ _GL_EXTERN_C int gl_isinfl (long double x); | |||
2234 | # if defined isinf || defined GNULIB_NAMESPACE | 2241 | # if defined isinf || defined GNULIB_NAMESPACE |
2235 | _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf) | 2242 | _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf) |
2236 | # undef isinf | 2243 | # undef isinf |
2237 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf) | 2244 | # if defined __MINGW32__ |
2245 | /* This platform's <cmath> defines isinf through a set of inline | ||
2246 | functions. */ | ||
2247 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, rpl_isinf, bool) | ||
2248 | # define isinf rpl_isinf | ||
2249 | # else | ||
2250 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, isinf, bool) | ||
2251 | # endif | ||
2238 | # endif | 2252 | # endif |
2239 | # endif | 2253 | # endif |
2240 | #elif defined GNULIB_POSIXCHECK | 2254 | #elif defined GNULIB_POSIXCHECK |
@@ -2352,7 +2366,14 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST; | |||
2352 | # if defined isnan || defined GNULIB_NAMESPACE | 2366 | # if defined isnan || defined GNULIB_NAMESPACE |
2353 | _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan) | 2367 | _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan) |
2354 | # undef isnan | 2368 | # undef isnan |
2355 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan) | 2369 | # if defined __MINGW32__ |
2370 | /* This platform's <cmath> defines isnan through a set of inline | ||
2371 | functions. */ | ||
2372 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool) | ||
2373 | # define isnan rpl_isnan | ||
2374 | # else | ||
2375 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool) | ||
2376 | # endif | ||
2356 | # endif | 2377 | # endif |
2357 | # else | 2378 | # else |
2358 | /* Ensure isnan is a macro. */ | 2379 | /* Ensure isnan is a macro. */ |
@@ -2428,7 +2449,14 @@ _GL_EXTERN_C int gl_signbitl (long double arg); | |||
2428 | # if defined signbit || defined GNULIB_NAMESPACE | 2449 | # if defined signbit || defined GNULIB_NAMESPACE |
2429 | _GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit) | 2450 | _GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit) |
2430 | # undef signbit | 2451 | # undef signbit |
2431 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit) | 2452 | # if defined __MINGW32__ |
2453 | /* This platform's <cmath> defines signbit through a set of inline | ||
2454 | functions. */ | ||
2455 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool) | ||
2456 | # define signbit rpl_signbit | ||
2457 | # else | ||
2458 | _GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, signbit, bool) | ||
2459 | # endif | ||
2432 | # endif | 2460 | # endif |
2433 | # endif | 2461 | # endif |
2434 | #elif defined GNULIB_POSIXCHECK | 2462 | #elif defined GNULIB_POSIXCHECK |