strtod improvements
Eric Blake <[email protected]>
| Newsgroups | gmane.comp.gnu.m4.patches |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Based on my recent patches to gnulib, we can now rely on (mostly) C99 strtod behavior. This fixes the testsuite breakage that has been in place since 2007-05-29 (the 1.4.9b release) on platforms like mingw and OpenBSD where strtod is still stuck on C89 semantics. - -- Don't work too hard, make some time for fun as well! Eric Blake [email protected] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkfvDc0ACgkQ84KuGfSFAYAvzQCbB4ic+Qkzb6FmTQkLpJcmPKYg KoIAniuDClykGGfuSr3qkaS2EPSR5CyQ =exAw -----END PGP SIGNATURE----- _______________________________________________ M4-patches mailing list [email protected] http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch334
(text/plain, 3.2 KB)
From 7d4e87119e02c8478df678779b5f99fe13a3c3d9 Mon Sep 17 00:00:00 2001 From: Eric Blake <[email protected]> Date: Sat, 29 Mar 2008 20:57:19 -0600 Subject: [PATCH] Fix testsuite on mingw, OpenBSD. * src/format.c (ARG_DOUBLE): Use strtod, not atof. * src/Makefile.am (m4_LDADD): Use POW_LIB when needed. * doc/m4.texinfo (Format): Add hex-float support. * NEWS: Document this. Signed-off-by: Eric Blake <[email protected]> --- ChangeLog | 8 ++++++++ NEWS | 4 ++++ doc/m4.texinfo | 2 ++ src/Makefile.am | 4 ++-- src/format.c | 4 ++-- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f473358..2c9b114 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-03-29 Eric Blake <[email protected]> + + Fix testsuite on mingw, OpenBSD. + * src/format.c (ARG_DOUBLE): Use strtod, not atof. + * src/Makefile.am (m4_LDADD): Use POW_LIB when needed. + * doc/m4.texinfo (Format): Add hex-float support. + * NEWS: Document this. + 2008-03-27 Eric Blake <[email protected]> Pull other useful doc fixes from branch-1.6. diff --git a/NEWS b/NEWS index 6132a4c..a9020c8 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,10 @@ Foundation, Inc. now issued if this is attempted, although a future version of M4 may lift this restriction to match other implementations. +** Enhance the `format' builtin to parse all C99 floating point numbers, + even on platforms where strtod is lacking. This fixes testsuite + failures introduced in 1.4.9b. + ** A number of portability improvements inherited from gnulib. * Noteworthy changes in Version 1.4.10 (2007-07-09) [stable] diff --git a/doc/m4.texinfo b/doc/m4.texinfo index b00b334..02e0f6d 100644 --- a/doc/m4.texinfo +++ b/doc/m4.texinfo @@ -5477,6 +5477,8 @@ ifelse(format(`%.1A', `1.999'), `0X1.0P+1', `success', format(`%.1A', `1.999'), `0X2.0P+0', `success', format(`%.1A', `1.999')) @result{}success +format(`%g', `0xa.P+1') +@result{}20 @end example Using the @code{forloop} macro defined earlier (@pxref{Forloop}), this diff --git a/src/Makefile.am b/src/Makefile.am index 4d061c7..f2c1524 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am - template for generating Makefile via Automake ## -## Copyright (C) 2006, 2007 Free Software Foundation, Inc. +## Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. ## ## This file is part of GNU M4. ## @@ -27,4 +27,4 @@ macro.c output.c path.c symtab.c if STACKOVF m4_SOURCES += stackovf.c endif -m4_LDADD = ../lib/libm4.a $(LIBM4_LIBDEPS) +m4_LDADD = ../lib/libm4.a $(LIBM4_LIBDEPS) $(POW_LIB) diff --git a/src/format.c b/src/format.c index afb3876..c450f0c 100644 --- a/src/format.c +++ b/src/format.c @@ -1,6 +1,6 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006, 2007 + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GNU M4. @@ -41,7 +41,7 @@ #define ARG_DOUBLE(argc, argv) \ ((argc == 0) ? 0 : \ - (--argc, argv++, atof (TOKEN_DATA_TEXT (argv[-1])))) + (--argc, argv++, strtod (TOKEN_DATA_TEXT (argv[-1]), NULL))) /*------------------------------------------------------------------. -- 1.5.4