]> Savannah Git Hosting - gnulib.git/commitdiff
strtod: fix clash with strtold
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Mar 2019 23:40:29 +0000 (16:40 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Mar 2019 23:41:16 +0000 (16:41 -0700)
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.

ChangeLog
lib/strtod.c

index b633380b5c7e90191d4e94ba58da60b582c8283a..e5ba0caa4bac7b4b85a4fb3c45236cd2afe529b8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index b9eaa51b488211ec42f66520c8c4e6cc1ade67a7..69b1564e11464552cd7b4f8baba9526fb8b81ede 100644 (file)
@@ -294,16 +294,15 @@ parse_number (const char *nptr,
    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.  */
-#if defined __hpux || defined __sgi || defined __ICC
 static DOUBLE
-compute_minus_zero (void)
+minus_zero (void)
 {
+#if defined __hpux || defined __sgi || defined __ICC
   return -MIN * MIN;
-}
-# define minus_zero compute_minus_zero ()
 #else
-DOUBLE minus_zero = -0.0;
+  return -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 @@ STRTOD (const char *nptr, char **endptr)
   /* 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;
 }