Declare strtof, strfromf functions for more _FloatN, _FloatNx types.
authorJoseph Myers <joseph@codesourcery.com>
Fri, 3 Nov 2017 17:09:21 +0000 (17:09 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 3 Nov 2017 17:10:39 +0000 (17:10 +0000)
Continuing the preparation for additional _FloatN / _FloatNx type
support, this patch arranges for <stdlib.h> to declare strtof and
strfromf functions for all such types, similarly to the declarations
already present for _Float128.

Tested for x86_64.

* stdlib/stdlib.h
[__HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (strtof16):
Declare.
[__HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (strtof32):
Likewise.
[__HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (strtof64):
Likewise.
[__HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(strtof32x): Likewise.
[__HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(strtof64x): Likewise.
[__HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(strtof128x): Likewise.
[__HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(strfromf16): Likewise.
[__HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(strfromf32): Likewise.
[__HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(strfromf64): Likewise.
[__HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(strfromf32x): Likewise.
[__HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(strfromf64x): Likewise.
[__HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(strfromf128x): Likewise.
[__USE_GNU && __HAVE_FLOAT16] (strtof16_l): Likewise.
[__USE_GNU && __HAVE_FLOAT32] (strtof32_l): Likewise.
[__USE_GNU && __HAVE_FLOAT64] (strtof64_l): Likewise.
[__USE_GNU && __HAVE_FLOAT32X] (strtof32x_l): Likewise.
[__USE_GNU && __HAVE_FLOAT64X] (strtof64x_l): Likewise.
[__USE_GNU && __HAVE_FLOAT128X] (strtof128x_l): Likewise.

ChangeLog
stdlib/stdlib.h

index d0ef94c..aa115b6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,37 @@
+2017-11-03  Joseph Myers  <joseph@codesourcery.com>
+
+       * stdlib/stdlib.h
+       [__HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (strtof16):
+       Declare.
+       [__HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (strtof32):
+       Likewise.
+       [__HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (strtof64):
+       Likewise.
+       [__HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
+       (strtof32x): Likewise.
+       [__HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
+       (strtof64x): Likewise.
+       [__HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
+       (strtof128x): Likewise.
+       [__HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
+       (strfromf16): Likewise.
+       [__HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
+       (strfromf32): Likewise.
+       [__HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
+       (strfromf64): Likewise.
+       [__HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
+       (strfromf32x): Likewise.
+       [__HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
+       (strfromf64x): Likewise.
+       [__HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
+       (strfromf128x): Likewise.
+       [__USE_GNU && __HAVE_FLOAT16] (strtof16_l): Likewise.
+       [__USE_GNU && __HAVE_FLOAT32] (strtof32_l): Likewise.
+       [__USE_GNU && __HAVE_FLOAT64] (strtof64_l): Likewise.
+       [__USE_GNU && __HAVE_FLOAT32X] (strtof32x_l): Likewise.
+       [__USE_GNU && __HAVE_FLOAT64X] (strtof64x_l): Likewise.
+       [__USE_GNU && __HAVE_FLOAT128X] (strtof128x_l): Likewise.
+
 2017-11-03  Richard Henderson  <rth@twiddle.net>
 
        * sysdeps/unix/sysv/linux/aarch64/sysconf.c: New file.
index 7a720cf..64dc394 100644 (file)
@@ -128,10 +128,47 @@ extern long double strtold (const char *__restrict __nptr,
      __THROW __nonnull ((1));
 #endif
 
+/* Likewise for '_FloatN' and '_FloatNx'.  */
+
+#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
+extern _Float16 strtof16 (const char *__restrict __nptr,
+                         char **__restrict __endptr)
+     __THROW __nonnull ((1));
+#endif
+
+#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
+extern _Float32 strtof32 (const char *__restrict __nptr,
+                         char **__restrict __endptr)
+     __THROW __nonnull ((1));
+#endif
+
+#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)
+extern _Float64 strtof64 (const char *__restrict __nptr,
+                         char **__restrict __endptr)
+     __THROW __nonnull ((1));
+#endif
+
 #if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
-/* Likewise for the '_Float128' format  */
 extern _Float128 strtof128 (const char *__restrict __nptr,
-                     char **__restrict __endptr)
+                           char **__restrict __endptr)
+     __THROW __nonnull ((1));
+#endif
+
+#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)
+extern _Float32x strtof32x (const char *__restrict __nptr,
+                           char **__restrict __endptr)
+     __THROW __nonnull ((1));
+#endif
+
+#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)
+extern _Float64x strtof64x (const char *__restrict __nptr,
+                           char **__restrict __endptr)
+     __THROW __nonnull ((1));
+#endif
+
+#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)
+extern _Float128x strtof128x (const char *__restrict __nptr,
+                             char **__restrict __endptr)
      __THROW __nonnull ((1));
 #endif
 
@@ -185,12 +222,48 @@ extern int strfroml (char *__dest, size_t __size, const char *__format,
      __THROW __nonnull ((3));
 #endif
 
+#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
+extern int strfromf16 (char *__dest, size_t __size, const char * __format,
+                      _Float16 __f)
+     __THROW __nonnull ((3));
+#endif
+
+#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
+extern int strfromf32 (char *__dest, size_t __size, const char * __format,
+                      _Float32 __f)
+     __THROW __nonnull ((3));
+#endif
+
+#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)
+extern int strfromf64 (char *__dest, size_t __size, const char * __format,
+                      _Float64 __f)
+     __THROW __nonnull ((3));
+#endif
+
 #if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
 extern int strfromf128 (char *__dest, size_t __size, const char * __format,
                        _Float128 __f)
      __THROW __nonnull ((3));
 #endif
 
+#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)
+extern int strfromf32x (char *__dest, size_t __size, const char * __format,
+                       _Float32x __f)
+     __THROW __nonnull ((3));
+#endif
+
+#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)
+extern int strfromf64x (char *__dest, size_t __size, const char * __format,
+                       _Float64x __f)
+     __THROW __nonnull ((3));
+#endif
+
+#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)
+extern int strfromf128x (char *__dest, size_t __size, const char * __format,
+                        _Float128x __f)
+     __THROW __nonnull ((3));
+#endif
+
 
 #ifdef __USE_GNU
 /* Parallel versions of the functions above which take the locale to
@@ -232,12 +305,54 @@ extern long double strtold_l (const char *__restrict __nptr,
                              locale_t __loc)
      __THROW __nonnull ((1, 3));
 
+# if __HAVE_FLOAT16
+extern _Float16 strtof16_l (const char *__restrict __nptr,
+                           char **__restrict __endptr,
+                           locale_t __loc)
+     __THROW __nonnull ((1, 3));
+# endif
+
+# if __HAVE_FLOAT32
+extern _Float32 strtof32_l (const char *__restrict __nptr,
+                           char **__restrict __endptr,
+                           locale_t __loc)
+     __THROW __nonnull ((1, 3));
+# endif
+
+# if __HAVE_FLOAT64
+extern _Float64 strtof64_l (const char *__restrict __nptr,
+                           char **__restrict __endptr,
+                           locale_t __loc)
+     __THROW __nonnull ((1, 3));
+# endif
+
 # if __HAVE_FLOAT128
 extern _Float128 strtof128_l (const char *__restrict __nptr,
                              char **__restrict __endptr,
                              locale_t __loc)
      __THROW __nonnull ((1, 3));
 # endif
+
+# if __HAVE_FLOAT32X
+extern _Float32x strtof32x_l (const char *__restrict __nptr,
+                             char **__restrict __endptr,
+                             locale_t __loc)
+     __THROW __nonnull ((1, 3));
+# endif
+
+# if __HAVE_FLOAT64X
+extern _Float64x strtof64x_l (const char *__restrict __nptr,
+                             char **__restrict __endptr,
+                             locale_t __loc)
+     __THROW __nonnull ((1, 3));
+# endif
+
+# if __HAVE_FLOAT128X
+extern _Float128x strtof128x_l (const char *__restrict __nptr,
+                               char **__restrict __endptr,
+                               locale_t __loc)
+     __THROW __nonnull ((1, 3));
+# endif
 #endif /* GNU */