Mercurial > gnulib
changeset 40231:9b3c79fdfe0b
strtod: fix clash with strtold
Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817).
* lib/strtod.c (compute_minus_zero, minus_zero):
Simplify by remving the macro / external variable,
and having just a function. User changed. This avoids
the need for an external variable that might clash.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Mon, 11 Mar 2019 16:40:29 -0700 |
parents | 25f5a9e7e5fb |
children | 6771da173563 |
files | ChangeLog lib/strtod.c |
diffstat | 2 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Mar 11 09:16:52 2019 -0700 +++ b/ChangeLog Mon Mar 11 16:40:29 2019 -0700 @@ -1,3 +1,12 @@ +2019-03-11 Paul Eggert <eggert@cs.ucla.edu> + + strtod: fix clash with strtold + Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817). + * lib/strtod.c (compute_minus_zero, minus_zero): + Simplify by remving the macro / external variable, + and having just a function. User changed. This avoids + the need for an external variable that might clash. + 2019-03-10 Bruno Haible <bruno@clisp.org> alloca-opt: Fix conflict mingw's new <alloca.h> file.
--- a/lib/strtod.c Mon Mar 11 09:16:52 2019 -0700 +++ b/lib/strtod.c Mon Mar 11 16:40:29 2019 -0700 @@ -294,16 +294,15 @@ ICC 10.0 has a bug when optimizing the expression -zero. The expression -MIN * MIN does not work when cross-compiling to PowerPC on Mac OS X 10.5. */ +static DOUBLE +minus_zero (void) +{ #if defined __hpux || defined __sgi || defined __ICC -static DOUBLE -compute_minus_zero (void) -{ return -MIN * MIN; +#else + return -0.0; +#endif } -# define minus_zero compute_minus_zero () -#else -DOUBLE minus_zero = -0.0; -#endif /* Convert NPTR to a DOUBLE. If ENDPTR is not NULL, a pointer to the character after the last one used in the number is put in *ENDPTR. */ @@ -479,6 +478,6 @@ /* Special case -0.0, since at least ICC miscompiles negation. We can't use copysign(), as that drags in -lm on some platforms. */ if (!num && negative) - return minus_zero; + return minus_zero (); return negative ? -num : num; }