]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
math: Merge strtod_nan_*.h into math-type-macros-*.h
authorFlorian Weimer <fweimer@redhat.com>
Wed, 16 May 2018 04:03:08 +0000 (06:03 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Wed, 16 May 2018 04:03:08 +0000 (06:03 +0200)
This change will eventually make it possible to compile
stdlib/strtod_nan_main.c as part of math/s_nan_template.c.

22 files changed:
ChangeLog
manual/arith.texi
stdlib/strtod_nan.c
stdlib/strtod_nan_main.c
stdlib/strtof_nan.c
stdlib/strtold_nan.c
sysdeps/generic/math-nan-payload-double.h [moved from stdlib/strtod_nan_double.h with 89% similarity]
sysdeps/generic/math-nan-payload-float.h [moved from stdlib/strtod_nan_float.h with 88% similarity]
sysdeps/generic/math-type-macros-double.h
sysdeps/generic/math-type-macros-float.h
sysdeps/generic/math-type-macros-float128.h
sysdeps/generic/math-type-macros-ldouble.h
sysdeps/generic/math-type-macros.h
sysdeps/ieee754/float128/math-nan-payload-float128.h [moved from sysdeps/ieee754/float128/strtod_nan_float128.h with 89% similarity]
sysdeps/ieee754/float128/strtof128_nan.c
sysdeps/ieee754/float128/wcstof128_nan.c
sysdeps/ieee754/ldbl-128/math-nan-payload-ldouble.h [moved from sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h with 89% similarity]
sysdeps/ieee754/ldbl-128ibm/math-nan-payload-ldouble.h [moved from sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h with 88% similarity]
sysdeps/ieee754/ldbl-96/math-nan-payload-ldouble.h [moved from sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h with 88% similarity]
wcsmbs/wcstod_nan.c
wcsmbs/wcstof_nan.c
wcsmbs/wcstold_nan.c

index 9e0468491786fd7bcb8aa8e3a8038c0730383a55..88ffee6b552b40623d31fd1858999d566bef6142 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,69 @@
+2018-05-16  Florian Weimer  <fweimer@redhat.com>
+
+       * stdlib/strtod_nan.c: Include <math-type-macros-double.h> instead
+       of <strtod_nan_double.h>.
+       * stdlib/strtod_nan_main.c (STRTOD_NAN): Use SET_NAN_PAYLOAD
+       instead of SET_MANTISSA.
+       * stdlib/strtof_nan.c: Include <math-type-macros-float.h> instead
+       of include <strtod_nan_float.h>.
+       * stdlib/strtold_nan.c: Include <math-type-macros-ldouble.h>
+       instead of <strtod_nan_ldouble.h>.
+       * stdlib/strtod_nan_double.h: Move to ...
+       * sysdeps/generic/math-nan-payload-double.h: ... here.
+       (FLOAT): Remove definition.
+       (SET_MANTISSA): Rename to ...
+       (SET_NAN_PAYLOAD): ... this.
+       * stdlib/strtod_nan_float.h: Move to ...
+       * sysdeps/generic/math-nan-payload-float.h: ... here.
+       (FLOAT): Remove definition.
+       (SET_MANTISSA): Rename to ...
+       (SET_NAN_PAYLOAD): ... this.
+       * sysdeps/generic/math-type-macros-double.h: Include
+       <math-nan-payload-double.h>.  Include <math/math-svid-compat.h>
+       instead of <math-svid-compat.h>.
+       * sysdeps/generic/math-type-macros-float.h: Include
+       <math-nan-payload-float.h>.  Include <math/math-svid-compat.h>
+       instead of <math-svid-compat.h>.
+       * sysdeps/generic/math-type-macros-float128.h: Include
+       <math-nan-payload-float128.h>.
+       * sysdeps/generic/math-type-macros-ldouble.h: Include
+       <math-nan-payload-ldouble.h>.  Include <math/math-svid-compat.h>
+       instead of <math-svid-compat.h>.
+       * sysdeps/generic/math-type-macros.h: Document SET_NAN_PAYLOAD and
+       check for definition.
+       * sysdeps/ieee754/float128/strtod_nan_float128.h: Move to ...
+       * sysdeps/ieee754/float128/math-nan-payload-float128.h: ... here.
+       Include <ieee754_float128.h>.
+       (FLOAT): Remove definition.
+       (SET_MANTISSA): Rename to ...
+       (SET_NAN_PAYLOAD): ... this.
+       * sysdeps/ieee754/float128/strtof128_nan.c: Include
+       <math-type-macros-float128.h> instead of <strtod_nan_float128.h>.
+       Do not include <float128_private.h>.
+       * sysdeps/ieee754/float128/wcstof128_nan.c: Likewise.
+       * sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h: Move to ...
+       * sysdeps/ieee754/ldbl-128/math-nan-payload-ldouble.h: ... here.
+       (FLOAT): Remove definition.
+       (SET_MANTISSA): Rename to ...
+       (SET_NAN_PAYLOAD): ... this.
+       * sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h: Move to ...
+       * sysdeps/ieee754/ldbl-128ibm/math-nan-payload-ldouble.h: ... here.
+       (FLOAT): Remove definition.
+       (SET_MANTISSA): Rename to ...
+       (SET_NAN_PAYLOAD): ... this.
+       * sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h: Move to ...
+       * sysdeps/ieee754/ldbl-96/math-nan-payload-ldouble.h: ... here.
+       (FLOAT): Remove definition.
+       (SET_MANTISSA): Rename to ...
+       (SET_NAN_PAYLOAD): ... this.
+       * wcsmbs/wcstod_nan.c: Include <math-type-macros-double.h> instead
+       of "../stdlib/strtod_nan_double.h".
+       * wcsmbs/wcstof_nan.c: Include <math-type-macros-float.h> instead
+       of "../stdlib/strtod_nan_float.h".
+       * wcsmbs/wcstold_nan.c: Include <math-type-macros-ldouble.h>
+       instead of "../stdlib/strtod_nan_ldouble.h".
+       * manual/arith.texi (Parsing of Floats): Adjust comment.
+
 2018-05-16  Joseph Myers  <joseph@codesourcery.com>
 
        * math/Makefile (libm-narrow-fns): Add mul.
index 3c5b69bdb398b591fcd4a0444f6211894ad3dc9c..2764f692368b6620ccbf6241198d335c74e4023b 100644 (file)
@@ -2784,7 +2784,7 @@ as well.
 @c mpn_lshift_1 -> mpn_lshift ok
 @c STRTOF_INTERNAL
 @c   MPN_VAR ok
-@c   SET_MANTISSA ok
+@c   SET_NAN_PAYLOAD ok
 @c   STRNCASECMP ok, wide and narrow
 @c   round_and_return ok
 @c   mpn_mul ok
index f64fec18974c3ec505c8aa20c6c5a3090e8373e1..c5876b59a0de18ca42b6f5fea0d434e9abb1fa54 100644 (file)
@@ -18,7 +18,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <strtod_nan_narrow.h>
-#include <strtod_nan_double.h>
+#include <math-type-macros-double.h>
 
 #define STRTOD_NAN __strtod_nan
 #include <strtod_nan_main.c>
index 12f6e7383dc4948a2944bab227d3b24a794dcbe7..80ecb7857269c11694cbd4d308c539410c0c4881 100644 (file)
@@ -52,7 +52,7 @@ STRTOD_NAN (const STRING_TYPE *str, STRING_TYPE **endptr, STRING_TYPE endc)
 
   mant = STRTOULL (str, &endp, 0);
   if (endp == cp)
-    SET_MANTISSA (retval, mant);
+    SET_NAN_PAYLOAD (retval, mant);
 
  out:
   if (endptr != NULL)
index ea3decb7291526e2c1f8c98393f03e666a3b0c74..f085c5b4fb2df87270f5ffcbd187564f14c29d84 100644 (file)
@@ -18,7 +18,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <strtod_nan_narrow.h>
-#include <strtod_nan_float.h>
+#include <math-type-macros-float.h>
 
 #define STRTOD_NAN __strtof_nan
 #include <strtod_nan_main.c>
index d4bbcc0a8be19e6a73e885af7a54559d4c41b064..eadfe546e2f764e8e4c2ec76c70e667c59260204 100644 (file)
@@ -23,7 +23,7 @@
    representation.  */
 #ifndef __NO_LONG_DOUBLE_MATH
 # include <strtod_nan_narrow.h>
-# include <strtod_nan_ldouble.h>
+# include <math-type-macros-ldouble.h>
 
 # define STRTOD_NAN __strtold_nan
 # include <strtod_nan_main.c>
similarity index 89%
rename from stdlib/strtod_nan_double.h
rename to sysdeps/generic/math-nan-payload-double.h
index d76a03bbe7960fd2d030dd105927ef6b692a7f8f..cfcc53a7b6a591f77ade73ad6f580447a20387e6 100644 (file)
@@ -1,4 +1,4 @@
-/* Convert string for NaN payload to corresponding NaN.  For double.
+/* NaN payload handling for double.
    Copyright (C) 1997-2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -16,8 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define FLOAT          double
-#define SET_MANTISSA(flt, mant)                                \
+#define SET_NAN_PAYLOAD(flt, mant)                     \
   do                                                   \
     {                                                  \
       union ieee754_double u;                          \
similarity index 88%
rename from stdlib/strtod_nan_float.h
rename to sysdeps/generic/math-nan-payload-float.h
index 80249d6fab701bba59304ce6603a505dca3c316a..2a4ff8ca641d46547053cccacb159dcc6f5dc5aa 100644 (file)
@@ -1,4 +1,4 @@
-/* Convert string for NaN payload to corresponding NaN.  For float.
+/* NaN payload handling for float.
    Copyright (C) 1997-2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -16,8 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define        FLOAT           float
-#define SET_MANTISSA(flt, mant)                        \
+#define SET_NAN_PAYLOAD(flt, mant)             \
   do                                           \
     {                                          \
       union ieee754_float u;                   \
index 1af4c74e4b0019324b7062011649a1b24bf95865..156418221da4b2c45958020a598d55a83a68f98d 100644 (file)
@@ -27,6 +27,7 @@
 #define CFLOAT _Complex double
 #define M_STRTO_NAN __strtod_nan
 
+#include <math-nan-payload-double.h>
 #include <libm-alias-double.h>
 
 #ifndef declare_mgen_alias
@@ -42,7 +43,7 @@
 
 /* Do not use the type-generic wrapper templates if compatibility with
    SVID error handling is needed.  */
-#include <math-svid-compat.h>
+#include <math/math-svid-compat.h>
 #define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT
 
 #endif
index 9273bdee0efba7afab80207aae9bb344a011e571..7dd0b74e2425f73183648d36391f61c403491cc2 100644 (file)
@@ -30,6 +30,7 @@
    the double macro constants.  */
 #define M_MLIT(c) c
 
+#include <math-nan-payload-float.h>
 #include <libm-alias-float.h>
 
 #ifndef declare_mgen_alias
@@ -45,7 +46,7 @@
 
 /* Do not use the type-generic wrapper templates if compatibility with
    SVID error handling is needed.  */
-#include <math-svid-compat.h>
+#include <math/math-svid-compat.h>
 #define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT
 
 #endif
index 485c13bb88a1995c69d62e11ea819d1323dd938b..6144bc047ad51d441b31f66bce623fe806a336d0 100644 (file)
@@ -29,6 +29,7 @@
 
 #define M_MLIT(c) c ## f128
 
+#include <math-nan-payload-float128.h>
 #include <libm-alias-float128.h>
 
 #ifndef declare_mgen_alias
index 5fe1600231a0465cca52f2d7ce5bea699aebc6cb..db411998eb320fd67d6981c2cdf5163a4d404c85 100644 (file)
@@ -27,6 +27,7 @@
 #define CFLOAT _Complex long double
 #define M_STRTO_NAN __strtold_nan
 
+#include <math-nan-payload-ldouble.h>
 #include <libm-alias-ldouble.h>
 
 #ifndef declare_mgen_alias
@@ -42,7 +43,7 @@
 
 /* Do not use the type-generic wrapper templates if compatibility with
    SVID error handling is needed.  */
-#include <math-svid-compat.h>
+#include <math/math-svid-compat.h>
 #define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT
 
 #endif
index ffcf7b80b608df537f578fcb0ae584d46fe68eb1..0e8ef16d7a5839eef85af8a17cdf644c0ef8b051 100644 (file)
 
   declare_mgen_alias_r(from,to)
       This exposes the appropriate symbol(s) for a
-      function f_r of type FLOAT.  */
+      function f_r of type FLOAT.
+
+  SET_NAN_PAYLOAD(flt, mant)
+      Set the NaN payload bits of the variable FLT of type FLOAT to
+      the mantissa MANT.  */
 
 #ifndef M_PFX
 # error "M_PFX must be defined."
@@ -66,6 +70,9 @@
 #ifndef declare_mgen_alias_r
 # error "declare_mgen_alias_r must be defined."
 #endif
+#ifndef SET_NAN_PAYLOAD
+# error "SET_NAN_PAYLOAD must be defined."
+#endif
 
 #define __M_CONCAT(a,b) a ## b
 #define __M_CONCATX(a,b) __M_CONCAT(a,b)
similarity index 89%
rename from sysdeps/ieee754/float128/strtod_nan_float128.h
rename to sysdeps/ieee754/float128/math-nan-payload-float128.h
index c3eaca4c80615fdf301154841d080324494306b5..95ab953596e8de44f506874bfbf64c8d4de53c3f 100644 (file)
@@ -1,4 +1,4 @@
-/* Convert string for NaN payload to corresponding NaN.  For _Float128.
+/* NaN payload handling for _Float128.
    Copyright (C) 2017-2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -16,8 +16,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define FLOAT          _Float128
-#define SET_MANTISSA(flt, mant)                                \
+#include <ieee754_float128.h>
+
+#define SET_NAN_PAYLOAD(flt, mant)                     \
   do                                                   \
     {                                                  \
       union ieee854_float128 u;                                \
index 36a9bfffedba9a7f5b6a993ab7ddd6eaaf8e08fd..37a7f4e02e9bd12d2f30d0fba56b8c9258b83416 100644 (file)
 
 #include <math.h>
 
-#include <float128_private.h>
-
 #include <strtod_nan_narrow.h>
-#include <strtod_nan_float128.h>
+#include <math-type-macros-float128.h>
 
 #define STRTOD_NAN __strtof128_nan
 #include <stdlib/strtod_nan_main.c>
index ffc72a016afbc6f9d0f82e81ae0332c00024460d..f504809dcf239d7ba98f67d4252b6c4cbd4ee78a 100644 (file)
@@ -18,7 +18,6 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <stdlib/strtod_nan_wide.h>
-#include <float128_private.h>
-#include <strtod_nan_float128.h>
+#include <math-type-macros-float128.h>
 #define STRTOD_NAN __wcstof128_nan
 #include <stdlib/strtod_nan_main.c>
similarity index 89%
rename from sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h
rename to sysdeps/ieee754/ldbl-128/math-nan-payload-ldouble.h
index 77d81acf33e57c4a393c950d39c4d2bcc5791b82..e2f092d3e160d9d903353bae168d2af5f4d83cd6 100644 (file)
@@ -1,4 +1,4 @@
-/* Convert string for NaN payload to corresponding NaN.  For ldbl-128.
+/* NaN payload handling for ldbl-128.
    Copyright (C) 1997-2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -16,8 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define FLOAT          long double
-#define SET_MANTISSA(flt, mant)                                \
+#define SET_NAN_PAYLOAD(flt, mant)                     \
   do                                                   \
     {                                                  \
       union ieee854_long_double u;                     \
similarity index 88%
rename from sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h
rename to sysdeps/ieee754/ldbl-128ibm/math-nan-payload-ldouble.h
index cfa9c1efef315a9bd6d38e6557be9755a391ee9e..653407597f1c645486fca5823952babebc55e2dc 100644 (file)
@@ -1,4 +1,4 @@
-/* Convert string for NaN payload to corresponding NaN.  For ldbl-128ibm.
+/* NaN payload handling or ldbl-128ibm.
    Copyright (C) 1997-2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -16,8 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define FLOAT          long double
-#define SET_MANTISSA(flt, mant)                                        \
+#define SET_NAN_PAYLOAD(flt, mant)                             \
   do                                                           \
     {                                                          \
       union ibm_extended_long_double u;                                \
similarity index 88%
rename from sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h
rename to sysdeps/ieee754/ldbl-96/math-nan-payload-ldouble.h
index 08104b7892c000a03402410d4057397662ead42d..ab2542c097fa4b0ac41da1825ff813919e7e5f73 100644 (file)
@@ -1,4 +1,4 @@
-/* Convert string for NaN payload to corresponding NaN.  For ldbl-96.
+/* NaN payload handling for ldbl-96.
    Copyright (C) 1997-2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -16,8 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define FLOAT          long double
-#define SET_MANTISSA(flt, mant)                                \
+#define SET_NAN_PAYLOAD(flt, mant)                     \
   do                                                   \
     {                                                  \
       union ieee854_long_double u;                     \
index 1aee82d84408636d9da026bfbe47726ec975acf8..1423f3e8aad3c17b162b41abf8ced4e1122f6bc7 100644 (file)
@@ -17,7 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include "../stdlib/strtod_nan_wide.h"
-#include "../stdlib/strtod_nan_double.h"
+#include <math-type-macros-double.h>
 
 #define STRTOD_NAN __wcstod_nan
 #include "../stdlib/strtod_nan_main.c"
index 9c89e2437055a7441be2878f80cb04e6aa08f026..96f219866755c5afc5ffc882e072b35ba494fb78 100644 (file)
@@ -17,7 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include "../stdlib/strtod_nan_wide.h"
-#include "../stdlib/strtod_nan_float.h"
+#include <math-type-macros-float.h>
 
 #define STRTOD_NAN __wcstof_nan
 #include "../stdlib/strtod_nan_main.c"
index a4d274f37ff7a90c7d236c2c691b27ea6870b78f..66793ec45906cd35f742ea9a1fc149569ec5c9cf 100644 (file)
@@ -23,7 +23,7 @@
    representation.  */
 #ifndef __NO_LONG_DOUBLE_MATH
 # include "../stdlib/strtod_nan_wide.h"
-# include <strtod_nan_ldouble.h>
+# include <math-type-macros-ldouble.h>
 
 # define STRTOD_NAN __wcstold_nan
 # include "../stdlib/strtod_nan_main.c"