[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
strtod improvements
From: |
Eric Blake |
Subject: |
strtod improvements |
Date: |
Sat, 29 Mar 2008 21:49:33 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
-----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 address@hidden
-----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-----
>From 7d4e87119e02c8478df678779b5f99fe13a3c3d9 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
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 <address@hidden>
---
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 <address@hidden>
+
+ 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 <address@hidden>
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')
address@hidden
@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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- strtod improvements,
Eric Blake <=