bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] strtod: make it more-accurate typically, and don't require l


From: Bruno Haible
Subject: Re: [PATCH] strtod: make it more-accurate typically, and don't require libm
Date: Tue, 13 Jul 2010 10:10:14 +0200
User-agent: KMail/1.9.9

Hi Paul,

> but won't the "return 0.0" cause some compilers to
> issue bogus warnings about X and EXPONENT not being used?
> That's why I had the "x + exponent" in there.

We have a macro for this purpose in gnulib (actually, even two): _GL_UNUSED
and _UNUSED_PARAMETER_. Alternatively, a cast to void could also be used.
I committed this:


2010-07-13  Bruno Haible  <address@hidden>

        strtod: Add safety check.
        * lib/strtod.c (ldexp): Abort if this dummy replacement gets called.

--- lib/strtod.c.orig   Tue Jul 13 10:05:26 2010
+++ lib/strtod.c        Tue Jul 13 10:04:54 2010
@@ -45,7 +45,12 @@
 
 #if !HAVE_LDEXP_IN_LIBC
  #define ldexp dummy_ldexp
- static double ldexp (double x, int exponent) { return x + exponent; }
+ /* A dummy definition that will never be invoked.  */
+ static double ldexp (double x _GL_UNUSED, int exponent _GL_UNUSED)
+ {
+   abort ();
+   return 0.0;
+ }
 #endif
 
 /* Return X * BASE**EXPONENT.  Return an extreme value and set errno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]