diff options
84 files changed, 1683 insertions, 24 deletions
@@ -9,7 +9,12 @@ Version 2.38 Major new features: - [Add new features here] +* When C2X features are enabled and the base argument is 0 or 2, the + following functions support binary integers prefixed by 0b or 0B as + input: strtol, strtoll, strtoul, strtoull, strtol_l, strtoll_l, + strtoul_l, strtoull_l, strtoimax, strtoumax, strtoq, strtouq, wcstol, + wcstoll, wcstoul, wcstoull, wcstol_l, wcstoll_l, wcstoul_l, + wcstoull_l, wcstoimax, wcstoumax, wcstoq, wcstouq. Deprecated and removed features, and other changes affecting compatibility: 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 |
