coreutils
[Top][All Lists]
Advanced

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

[PATCH] gnulib: update to use new strtold module


From: Pádraig Brady
Subject: [PATCH] gnulib: update to use new strtold module
Date: Sun, 10 Feb 2019 20:33:42 -0800

* gnulib: Update to make the new strtold module available.
* bootstrap.conf: strtod is now a dependency of c-strtod,
which in turn is a dependency of cl-strtod.  This treats
strtold and strtod similarly.
* gl/lib/cl-strtod.c: Adjust to assume strtold is available.
* tests/misc/sort-float.sh: Likewise.
* src/sort.c: Likewise.
(nan_compare): Adjust comment to indicate
we still have to init padding bits as per
https://sourceware.org/bugzilla/show_bug.cgi?id=13246
---
 bootstrap.conf           |  2 --
 gl/lib/cl-strtod.c       |  7 +------
 gnulib                   |  2 +-
 src/sort.c               | 18 +++++-------------
 tests/misc/sort-float.sh |  4 ----
 5 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index fb36918..a525ef4 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -40,7 +40,6 @@ gnulib_modules="
   base64
   buffer-lcm
   c-strcase
-  c-strtod
   cl-strtod
   cl-strtold
   calloc-gnu
@@ -241,7 +240,6 @@ gnulib_modules="
   strncat
   strnumcmp
   strsignal
-  strtod
   strtoimax
   strtoumax
   symlinkat
diff --git a/gl/lib/cl-strtod.c b/gl/lib/cl-strtod.c
index 998c2ef..b4d9c5c 100644
--- a/gl/lib/cl-strtod.c
+++ b/gl/lib/cl-strtod.c
@@ -30,16 +30,11 @@
 # define CL_STRTOD cl_strtold
 # define DOUBLE long double
 # define C_STRTOD c_strtold
+# define STRTOD strtold
 #else
 # define CL_STRTOD cl_strtod
 # define DOUBLE double
 # 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
 
diff --git a/gnulib b/gnulib
index 8da562a..341723e 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 8da562a8ae58c5924b560c57e0e2bd88156ac9bd
+Subproject commit 341723e1b879d70a08afdf4d8c566606f267e081
diff --git a/src/sort.c b/src/sort.c
index c9191c2..5ab363f 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -96,14 +96,6 @@ struct rlimit { size_t rlim_cur; };
 
 #define UCHAR_LIM (UCHAR_MAX + 1)
 
-#if HAVE_C99_STRTOLD
-# define long_double long double
-#else
-# define long_double double
-# undef strtold
-# define strtold strtod
-#endif
-
 #ifndef DEFAULT_TMPDIR
 # define DEFAULT_TMPDIR "/tmp"
 #endif
@@ -2011,16 +2003,16 @@ numcompare (char const *a, char const *b)
 
 /* Work around a problem whereby the long double value returned by glibc's
    strtold ("NaN", ...) contains uninitialized bits: clear all bytes of
-   A and B before calling strtold.  FIXME: remove this function once
+   A and B before calling strtold.  FIXME: remove this function if
    gnulib guarantees that strtold's result is always well defined.  */
 static int
 nan_compare (char const *sa, char const *sb)
 {
-  long_double a;
+  long double a;
   memset (&a, 0, sizeof a);
   a = strtold (sa, NULL);
 
-  long_double b;
+  long double b;
   memset (&b, 0, sizeof b);
   b = strtold (sb, NULL);
 
@@ -2035,8 +2027,8 @@ general_numcompare (char const *sa, char const *sb)
 
   char *ea;
   char *eb;
-  long_double a = strtold (sa, &ea);
-  long_double b = strtold (sb, &eb);
+  long double a = strtold (sa, &ea);
+  long double b = strtold (sb, &eb);
 
   /* Put conversion errors at the start of the collating sequence.  */
   if (sa == ea)
diff --git a/tests/misc/sort-float.sh b/tests/misc/sort-float.sh
index 0a9616d..9aa2fd2 100755
--- a/tests/misc/sort-float.sh
+++ b/tests/misc/sort-float.sh
@@ -57,10 +57,6 @@ for LOC in C $LOCALE_FR; do
 
   LC_ALL=$LOC getlimits_
 
-  # See if sort should be using long doubles
-  grep '^#define HAVE_C99_STRTOLD 1' $CONFIG_HEADER > /dev/null ||
-    { LDBL_MAX="$DBL_MAX"; LDBL_MIN="$DBL_MIN"; }
-
   # If DBL_MIN happens to be smaller than LDBL_MIN, swap them,
   # so that out expected output is sorted.
   if test $reversed = 1; then
-- 
2.9.3




reply via email to

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