On 26/01/19 23:20, Paul Eggert wrote: > This fixes a thinko in the previous patch. > * gl/lib/cl-strtod.c (STRTOD): New macro. > (CL_STRTOD): Use it. > --- > gl/lib/cl-strtod.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/gl/lib/cl-strtod.c b/gl/lib/cl-strtod.c > index fa77235ba..dd6eef825 100644 > --- a/gl/lib/cl-strtod.c > +++ b/gl/lib/cl-strtod.c > @@ -29,10 +29,12 @@ > #if LONG > # define CL_STRTOD cl_strtold > # define DOUBLE long double > +# define STRTOD strtold > # define C_STRTOD c_strtold > #else > # define CL_STRTOD cl_strtod > # define DOUBLE double > +# define STRTOD strtod > # define C_STRTOD c_strtod > #endif > > @@ -57,7 +59,7 @@ DOUBLE > CL_STRTOD (char const *nptr, char **restrict endptr) > { > char *end; > - DOUBLE d = strtod (nptr, &end); > + DOUBLE d = STRTOD (nptr, &end); > if (*end) > { > int strtod_errno = errno;
strtold isn't generally available, which we already handle in sort.c for example. The attached fixes the build failure on systems like android. Bruno has a more general fix in gnulib, that makes strtold more consistent across all platforms, but we should add that as a separate commit I think. cheers, Pádraig
From b97570a7cec19a25991f68020cb5b5dc03a72ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com> Date: Tue, 29 Jan 2019 22:10:49 -0800 Subject: [PATCH] build: fix recent build failure on systems without strtold Recently introduced in commit v8.30-50-geb73e23 * gl/lib/cl-strtod.c: Fall back to strtod() on systems without strtold() (like we already do in sort). --- gl/lib/cl-strtod.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gl/lib/cl-strtod.c b/gl/lib/cl-strtod.c index dd6eef8..998c2ef 100644 --- a/gl/lib/cl-strtod.c +++ b/gl/lib/cl-strtod.c @@ -29,15 +29,20 @@ #if LONG # define CL_STRTOD cl_strtold # define DOUBLE long double -# define STRTOD strtold # define C_STRTOD c_strtold #else # define CL_STRTOD cl_strtod # define DOUBLE double -# define STRTOD strtod # define C_STRTOD c_strtod #endif +/* fall back on strtod if strtold doesn't conform to C99. */ +#if LONG && HAVE_C99_STRTOLD +# define STRTOD strtold +#else +# define STRTOD strtod +#endif + /* This function acts like strtod or strtold, except that it falls back on the C locale if the initial prefix is not parsable in the current locale. If the prefix is parsable in both locales, -- 2.9.3