From f0be25b6336db7492e47d2e8e72eb8af53b5506d Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Fri, 9 Jun 2017 12:02:06 -0400 Subject: Rename xlocale.h to bits/types/__locale_t.h. xlocale.h is already a single-type micro-header, defining struct __locale_struct and the typedefs __locale_t and locale_t. This patch brings it into the bits/types/ scheme: there are now bits/types/__locale_t.h which defines only __locale_struct and __locale_t, and bits/types/locale_t.h which defines locale_t as well as the other two. None of *our* headers need __locale_t.h, but it appears to me that libstdc++ could make use of it. There are a lot of external uses of xlocale.h, but all the uses I checked had an autoconf test or equivalent for its existence. It has never been available from other C libraries, and it has always contained a comment reading "This file is not standardized, don't rely on it, it can go away without warning" so I think dropping it is pretty safe. I also took the opportunity to clean up comments in various public header files that still talk about the *_l interfaces as though they were completely nonstandard. There are a few of them, notably the strtoX_l and wcstoX_l families, that haven't been standardized, but the bulk are in POSIX.1-2008. * locale/xlocale.h: Rename to... * locale/bits/types/__locale_t.h: ...here. Adjust commentary. Only define struct __locale_struct and __locale_t, not locale_t. * locale/bits/types/locale_t.h: New file; define locale_t here. * locale/Makefile (headers): Update to match. * include/xlocale.h: Delete wrapper. * include/bits/types/__locale_t.h: New wrapper. * include/bits/types/locale_t.h: New wrapper. * ctype/ctype.h, include/printf.h, include/time.h * locale/langinfo.h, locale/locale.h, stdlib/monetary.h * stdlib/stdlib.h, string/string.h, string/strings.h, time/time.h * wcsmbs/wchar.h, wctype/wctype.h: Use bits/types/locale_t.h. Correct outdated comments regarding the standardization status of the functions that take locale_t arguments. * stdlib/strtod_l.c, stdlib/strtof_l.c, stdlib/strtol_l.c * stdlib/strtold_l.c, stdlib/strtoul_l.c, stdlib/strtoull_l.c * sysdeps/ieee754/ldbl-128ibm/strtold_l.c * sysdeps/ieee754/ldbl-64-128/strtold_l.c * wcsmbs/wcstod.c, wcsmbs/wcstod_l.c, wcsmbs/wcstof.c * wcsmbs/wcstof_l.c, wcsmbs/wcstold.c, wcsmbs/wcstold_l.c: Don't include xlocale.h. If necessary, include locale.h instead. * stdlib/strtold_l.c: Unconditionally include wchar.h. --- stdlib/monetary.h | 3 ++- stdlib/stdlib.h | 22 +++++----------------- stdlib/strtod_l.c | 3 +-- stdlib/strtof_l.c | 2 +- stdlib/strtol_l.c | 1 - stdlib/strtold_l.c | 6 +----- stdlib/strtoll_l.c | 2 +- stdlib/strtoul_l.c | 2 +- stdlib/strtoull_l.c | 2 +- 9 files changed, 13 insertions(+), 30 deletions(-) (limited to 'stdlib') diff --git a/stdlib/monetary.h b/stdlib/monetary.h index dcfbfc5..c1fcbf0 100644 --- a/stdlib/monetary.h +++ b/stdlib/monetary.h @@ -40,7 +40,8 @@ extern ssize_t strfmon (char *__restrict __s, size_t __maxsize, __THROW __attribute_format_strfmon__ (3, 4); #ifdef __USE_XOPEN2K8 -# include +/* POSIX.1-2008 extended locale interface (see locale.h). */ +# include /* Formatting a monetary value according to the given locale. */ extern ssize_t strfmon_l (char *__restrict __s, size_t __maxsize, diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 6f1e70e..ce2602e 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -193,23 +193,11 @@ extern int strfromf128 (char *__dest, size_t __size, const char * __format, #ifdef __USE_GNU -/* The concept of one static locale per category is not very well - thought out. Many applications will need to process its data using - information from several different locales. Another problem is - the implementation of the internationalization handling in the - ISO C++ standard library. To support this another set of - the functions using locale data exist which take an additional - argument. - - Attention: even though several *_l interfaces are part of POSIX:2008, - these are not. */ - -/* Structure for reentrant locale using functions. This is an - (almost) opaque type for the user level programs. */ -# include - -/* Special versions of the functions above which take the locale to - use as an additional parameter. */ +/* Parallel versions of the functions above which take the locale to + use as an additional parameter. These are GNU extensions inspired + by the POSIX.1-2008 extended locale API. */ +# include + extern long int strtol_l (const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) __THROW __nonnull ((1, 4)); diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index 99c2af3..a782a24 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -17,7 +17,7 @@ License along with the GNU C Library; if not, see . */ -#include +#include extern double ____strtod_l_internal (const char *, char **, int, __locale_t); @@ -46,7 +46,6 @@ extern double ____strtod_l_internal (const char *, char **, int, __locale_t); #include #include #include "../locale/localeinfo.h" -#include #include #include #include diff --git a/stdlib/strtof_l.c b/stdlib/strtof_l.c index 57e5575..ea76c34 100644 --- a/stdlib/strtof_l.c +++ b/stdlib/strtof_l.c @@ -17,7 +17,7 @@ License along with the GNU C Library; if not, see . */ -#include +#include extern float ____strtof_l_internal (const char *, char **, int, __locale_t); diff --git a/stdlib/strtol_l.c b/stdlib/strtol_l.c index 5a0683b..48e9ab5 100644 --- a/stdlib/strtol_l.c +++ b/stdlib/strtol_l.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include diff --git a/stdlib/strtold_l.c b/stdlib/strtold_l.c index bef2a4d..7b9efd8 100644 --- a/stdlib/strtold_l.c +++ b/stdlib/strtold_l.c @@ -17,11 +17,7 @@ #include #include -#include - -#if defined _LIBC || defined HAVE_WCHAR_H -# include -#endif +#include #ifdef USE_WIDE_CHAR # define STRING_TYPE wchar_t diff --git a/stdlib/strtoll_l.c b/stdlib/strtoll_l.c index 2a712eb..003f425 100644 --- a/stdlib/strtoll_l.c +++ b/stdlib/strtoll_l.c @@ -19,7 +19,7 @@ #define QUAD 1 -#include +#include extern long long int ____strtoll_l_internal (const char *, char **, int, int, __locale_t); diff --git a/stdlib/strtoul_l.c b/stdlib/strtoul_l.c index 6d23ee2..45b0585 100644 --- a/stdlib/strtoul_l.c +++ b/stdlib/strtoul_l.c @@ -19,7 +19,7 @@ #define UNSIGNED 1 -#include +#include extern unsigned long int ____strtoul_l_internal (const char *, char **, int, int, __locale_t); diff --git a/stdlib/strtoull_l.c b/stdlib/strtoull_l.c index 53ecb91..da6d7cd 100644 --- a/stdlib/strtoull_l.c +++ b/stdlib/strtoull_l.c @@ -20,7 +20,7 @@ #define QUAD 1 #define UNSIGNED 1 -#include +#include extern unsigned long long int ____strtoull_l_internal (const char *, char **, int, int, __locale_t); -- cgit v1.1