From patchwork Sat Jun 10 17:17:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 20897 Received: (qmail 110571 invoked by alias); 10 Jun 2017 17:17:44 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 110473 invoked by uid 89); 10 Jun 2017 17:17:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com Subject: [PATCH 6/6] Deprecate xlocale.h and add bits/types/locale_t.h. Date: Sat, 10 Jun 2017 13:17:38 -0400 Message-Id: <20170610171738.22362-7-zackw@panix.com> In-Reply-To: <20170610171738.22362-1-zackw@panix.com> References: <20170610171738.22362-1-zackw@panix.com> MIME-Version: 1.0 xlocale.h is already a single-type micro-header, defining locale_t, so it would be nice to bring it into the overall bits/types/ scheme. Unfortunately, it's in the top level of the system-header namespace and, despite the comment saying "This file is not standardized, don't rely on it, it can go away without warning", there are a lot of external uses, so we need to deprecate it first, which is what this patch does. The implementation-namespace alias, __locale_t, may not actually be necessary; there are no situations where it is available but locale_t isn't, and I did not find any cases in Issue 7 where a header that defines functions taking a locale_t argument is not also supposed to declare locale_t. However, like xlocale.h it seems to have a fair number of external uses, so we are probably stuck with it. 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/bits/types/locale_t.h: New file containing former contents of locale/xlocale.h, with minor adjustments to commentary. * locale/xlocale.h: Replace with deprecation shim that issues a warning and includes . * locale/Makefile: Install bits/types/locale_t.h. * scripts/check-installed-headers.sh: Skip xlocale.h. * include/xlocale.h: Delete 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. --- NEWS | 3 ++ ctype/ctype.h | 16 ++--------- include/bits/types/locale_t.h | 1 + include/printf.h | 2 +- include/time.h | 2 +- include/xlocale.h | 1 - locale/Makefile | 3 +- locale/bits/types/locale_t.h | 44 +++++++++++++++++++++++++++++ locale/langinfo.h | 7 ++--- locale/locale.h | 20 +++++-------- locale/xlocale.h | 50 +++++++-------------------------- scripts/check-installed-headers.sh | 4 +++ stdlib/monetary.h | 3 +- stdlib/stdlib.h | 20 +++---------- 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 +- string/string.h | 3 +- string/strings.h | 3 +- sysdeps/ieee754/ldbl-128ibm/strtold_l.c | 1 - sysdeps/ieee754/ldbl-64-128/strtold_l.c | 1 - time/time.h | 2 +- wcsmbs/wchar.h | 27 ++++-------------- wcsmbs/wcstod.c | 2 +- wcsmbs/wcstod_l.c | 2 +- wcsmbs/wcstof.c | 2 +- wcsmbs/wcstof_l.c | 2 +- wcsmbs/wcstold.c | 2 +- wcsmbs/wcstold_l.c | 2 +- wctype/wctype.h | 4 +-- 34 files changed, 108 insertions(+), 139 deletions(-) create mode 100644 include/bits/types/locale_t.h delete mode 100644 include/xlocale.h create mode 100644 locale/bits/types/locale_t.h diff --git a/NEWS b/NEWS index 1b96b3897d..cbb0c80d78 100644 --- a/NEWS +++ b/NEWS @@ -77,6 +77,9 @@ Version 2.26 * The obsolete signal constant SIGUNUSED is no longer defined by . +* The nonstandard header is deprecated, and will be removed in a + future release. Most programs should use instead. + * The reallocarray function has been added to libc. It is a realloc replacement with a check for integer overflow when calculating total allocation size. diff --git a/ctype/ctype.h b/ctype/ctype.h index 1fe89cf836..ce598d53e5 100644 --- a/ctype/ctype.h +++ b/ctype/ctype.h @@ -233,20 +233,8 @@ __NTH (toupper (int __c)) #ifdef __USE_XOPEN2K8 -/* 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 application is - the implementation of the internationalization handling in the - upcoming ISO C++ standard library. To support this another set of - the functions using locale data exist which have an additional - argument. - - Attention: all these functions are *not* standardized in any form. - This is a proof-of-concept implementation. */ - -/* Structure for reentrant locale using functions. This is an - (almost) opaque type for the user level programs. */ -# include +/* POSIX.1-2008 extended locale interface (see locale.h). */ +# include /* These definitions are similar to the ones above but all functions take as an argument a handle for the locale which shall be used. */ diff --git a/include/bits/types/locale_t.h b/include/bits/types/locale_t.h new file mode 100644 index 0000000000..24b074872f --- /dev/null +++ b/include/bits/types/locale_t.h @@ -0,0 +1 @@ +#include diff --git a/include/printf.h b/include/printf.h index 984f263167..7b4d209c47 100644 --- a/include/printf.h +++ b/include/printf.h @@ -4,7 +4,7 @@ # ifndef _ISOMAC -#include +#include /* Now define the internal interfaces. */ extern int __printf_fphex (FILE *, const struct printf_info *, diff --git a/include/time.h b/include/time.h index 3a828e0420..0a67cf3a19 100644 --- a/include/time.h +++ b/include/time.h @@ -2,7 +2,7 @@ #include