about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/features.h12
-rw-r--r--include/stdlib.h46
-rw-r--r--include/wchar.h50
3 files changed, 101 insertions, 7 deletions
diff --git a/include/features.h b/include/features.h
index 26534f2b52..9eae86a2d8 100644
--- a/include/features.h
+++ b/include/features.h
@@ -151,6 +151,7 @@
 #undef	__GLIBC_USE_ISOC2X
 #undef	__GLIBC_USE_DEPRECATED_GETS
 #undef	__GLIBC_USE_DEPRECATED_SCANF
+#undef	__GLIBC_USE_C2X_STRTOL
 
 /* Suppress kernel-name space pollution unless user expressedly asks
    for it.  */
@@ -464,6 +465,17 @@
 # define __GLIBC_USE_DEPRECATED_SCANF 0
 #endif
 
+/* ISO C2X added support for a 0b or 0B prefix on binary constants as
+   inputs to strtol-family functions (base 0 or 2).  This macro is
+   used to condition redirection in headers to allow that redirection
+   to be disabled when building those functions, despite _GNU_SOURCE
+   being defined.  */
+#if __GLIBC_USE (ISOC2X)
+# define __GLIBC_USE_C2X_STRTOL 1
+#else
+# define __GLIBC_USE_C2X_STRTOL 0
+#endif
+
 /* Get definitions of __STDC_* predefined macros, if the compiler has
    not preincluded this header automatically.  */
 #include <stdc-predef.h>
diff --git a/include/stdlib.h b/include/stdlib.h
index db51f4a4f6..7deb8193d7 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -1,6 +1,7 @@
 #ifndef _STDLIB_H
 
 #ifndef _ISOMAC
+# include <stdbool.h>
 # include <stddef.h>
 #endif
 
@@ -35,6 +36,45 @@ libc_hidden_proto (__strtod_l)
 libc_hidden_proto (__strtof_l)
 libc_hidden_proto (__strtold_l)
 
+extern __typeof (strtol) __isoc23_strtol __attribute_copy__ (strtol);
+extern __typeof (strtoul) __isoc23_strtoul __attribute_copy__ (strtoul);
+extern __typeof (strtoll) __isoc23_strtoll __attribute_copy__ (strtoll);
+extern __typeof (strtoull) __isoc23_strtoull __attribute_copy__ (strtoull);
+extern __typeof (strtol_l) __isoc23_strtol_l __attribute_copy__ (strtol_l);
+extern __typeof (strtoul_l) __isoc23_strtoul_l __attribute_copy__ (strtoul_l);
+extern __typeof (strtoll_l) __isoc23_strtoll_l __attribute_copy__ (strtoll_l);
+extern __typeof (strtoull_l) __isoc23_strtoull_l __attribute_copy__ (strtoull_l);
+libc_hidden_proto (__isoc23_strtol)
+libc_hidden_proto (__isoc23_strtoul)
+libc_hidden_proto (__isoc23_strtoll)
+libc_hidden_proto (__isoc23_strtoull)
+libc_hidden_proto (__isoc23_strtol_l)
+libc_hidden_proto (__isoc23_strtoul_l)
+libc_hidden_proto (__isoc23_strtoll_l)
+libc_hidden_proto (__isoc23_strtoull_l)
+
+#if __GLIBC_USE (C2X_STRTOL)
+/* Redirect internal uses of these functions to the C2X versions; the
+   redirection in the installed header does not work with
+   libc_hidden_proto.  */
+# undef strtol
+# define strtol __isoc23_strtol
+# undef strtoul
+# define strtoul __isoc23_strtoul
+# undef strtoll
+# define strtoll __isoc23_strtoll
+# undef strtoull
+# define strtoull __isoc23_strtoull
+# undef strtol_l
+# define strtol_l __isoc23_strtol_l
+# undef strtoul_l
+# define strtoul_l __isoc23_strtoul_l
+# undef strtoll_l
+# define strtoll_l __isoc23_strtoll_l
+# undef strtoull_l
+# define strtoull_l __isoc23_strtoull_l
+#endif
+
 libc_hidden_proto (exit)
 libc_hidden_proto (abort)
 libc_hidden_proto (getenv)
@@ -202,23 +242,25 @@ extern long double ____strtold_l_internal (const char *__restrict __nptr,
 extern long int ____strtol_l_internal (const char *__restrict __nptr,
 				       char **__restrict __endptr,
 				       int __base, int __group,
-				       locale_t __loc);
+				       bool __bin_cst, locale_t __loc);
 extern unsigned long int ____strtoul_l_internal (const char *
 						 __restrict __nptr,
 						 char **__restrict __endptr,
 						 int __base, int __group,
+						 bool __bin_cst,
 						 locale_t __loc);
 __extension__
 extern long long int ____strtoll_l_internal (const char *__restrict __nptr,
 					     char **__restrict __endptr,
 					     int __base, int __group,
-					     locale_t __loc);
+					     bool __bin_cst, locale_t __loc);
 __extension__
 extern unsigned long long int ____strtoull_l_internal (const char *
 						       __restrict __nptr,
 						       char **
 						       __restrict __endptr,
 						       int __base, int __group,
+						       bool __bin_cst,
 						       locale_t __loc);
 
 libc_hidden_proto (____strtof_l_internal)
diff --git a/include/wchar.h b/include/wchar.h
index db83297bca..ea7888f605 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -12,6 +12,7 @@
 # ifndef _ISOMAC
 
 #include <bits/floatn.h>
+#include <stdbool.h>
 
 extern __typeof (wcscasecmp_l) __wcscasecmp_l;
 extern __typeof (wcsncasecmp_l) __wcsncasecmp_l;
@@ -34,6 +35,45 @@ libc_hidden_proto (__wcstof_l)
 libc_hidden_proto (__wcstold_l)
 libc_hidden_proto (__wcsftime_l)
 
+extern __typeof (wcstol) __isoc23_wcstol __attribute_copy__ (wcstol);
+extern __typeof (wcstoul) __isoc23_wcstoul __attribute_copy__ (wcstoul);
+extern __typeof (wcstoll) __isoc23_wcstoll __attribute_copy__ (wcstoll);
+extern __typeof (wcstoull) __isoc23_wcstoull __attribute_copy__ (wcstoull);
+extern __typeof (wcstol_l) __isoc23_wcstol_l __attribute_copy__ (wcstol_l);
+extern __typeof (wcstoul_l) __isoc23_wcstoul_l __attribute_copy__ (wcstoul_l);
+extern __typeof (wcstoll_l) __isoc23_wcstoll_l __attribute_copy__ (wcstoll_l);
+extern __typeof (wcstoull_l) __isoc23_wcstoull_l __attribute_copy__ (wcstoull_l);
+libc_hidden_proto (__isoc23_wcstol)
+libc_hidden_proto (__isoc23_wcstoul)
+libc_hidden_proto (__isoc23_wcstoll)
+libc_hidden_proto (__isoc23_wcstoull)
+libc_hidden_proto (__isoc23_wcstol_l)
+libc_hidden_proto (__isoc23_wcstoul_l)
+libc_hidden_proto (__isoc23_wcstoll_l)
+libc_hidden_proto (__isoc23_wcstoull_l)
+
+#if __GLIBC_USE (C2X_STRTOL)
+/* Redirect internal uses of these functions to the C2X versions; the
+   redirection in the installed header does not work with
+   libc_hidden_proto.  */
+# undef wcstol
+# define wcstol __isoc23_wcstol
+# undef wcstoul
+# define wcstoul __isoc23_wcstoul
+# undef wcstoll
+# define wcstoll __isoc23_wcstoll
+# undef wcstoull
+# define wcstoull __isoc23_wcstoull
+# undef wcstol_l
+# define wcstol_l __isoc23_wcstol_l
+# undef wcstoul_l
+# define wcstoul_l __isoc23_wcstoul_l
+# undef wcstoll_l
+# define wcstoll_l __isoc23_wcstoll_l
+# undef wcstoull_l
+# define wcstoull_l __isoc23_wcstoull_l
+#endif
+
 
 extern double __wcstod_internal (const wchar_t *__restrict __nptr,
 				 wchar_t **__restrict __endptr, int __group)
@@ -63,7 +103,7 @@ extern unsigned long long int __wcstoull_internal (const wchar_t *
 						   int __group) __THROW;
 extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
 						       wchar_t **, int, int,
-						       locale_t);
+						       bool, locale_t);
 libc_hidden_proto (__wcstof_internal)
 libc_hidden_proto (__wcstod_internal)
 libc_hidden_proto (__wcstold_internal)
@@ -86,17 +126,17 @@ extern double ____wcstod_l_internal (const wchar_t *, wchar_t **, int,
 extern long double ____wcstold_l_internal (const wchar_t *, wchar_t **,
 					   int, locale_t) attribute_hidden;
 extern long int ____wcstol_l_internal (const wchar_t *, wchar_t **, int,
-				       int, locale_t) attribute_hidden;
+				       int, bool, locale_t) attribute_hidden;
 extern unsigned long int ____wcstoul_l_internal (const wchar_t *,
 						 wchar_t **,
-						 int, int, locale_t)
+						 int, int, bool, locale_t)
      attribute_hidden;
 extern long long int ____wcstoll_l_internal (const wchar_t *, wchar_t **,
-					     int, int, locale_t)
+					     int, int, bool, locale_t)
      attribute_hidden;
 extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
 						       wchar_t **, int, int,
-						       locale_t)
+						       bool, locale_t)
      attribute_hidden;
 
 #if __HAVE_DISTINCT_FLOAT128