From patchwork Tue Jun 20 15:39:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 778383 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wsX952RJxz9s7f for ; Wed, 21 Jun 2017 01:40:09 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="SwzHt80R"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; q=dns; s=default; b=UyI Gj5wQiXbgSnDtheom4PClFpcDzHvzCZ6E4S+TqrEqEZgh1U1NsJAlzTFO7SGw5M5 lbdlB+7FDxKzwnwnDy3OTjG8caoSW/hxAIYnXfTOKvGeS6wgcNVNPz4Ii2w3WYyg UxmpBUpEoR0nNd7EKcVEGKUSCNQaPt4AsTIVc2O4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=default; bh=xYdQRZow6 7GvnarwUAPB4xAKRq8=; b=SwzHt80Rvf5E+qsCAMgAjy4fyojVEBjfVhgm6z16u VT5gMGr9YOVvtbW9mOoolkz2GkHAhBDdObp6t5frN0BMADehYQLtx3l/BVgcyVgn 8tUCDGnPfbEPAWPdaHv9/6gGYaHR8c0Sr2FIh6Gs0X7HklmwzyfYP+xW7xarPLHu /0= Received: (qmail 29270 invoked by alias); 20 Jun 2017 15:40:00 -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 29247 invoked by uid 89); 20 Jun 2017 15:39:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=file.h, fileh X-HELO: mailbackend.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, fweimer@redhat.com Subject: [PATCH 1/2] Rename xlocale.h to bits/types/__locale_t.h. Date: Tue, 20 Jun 2017 11:39:53 -0400 Message-Id: <20170620153954.7351-1-zackw@panix.com> MIME-Version: 1.0 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 Florian has persuaded me that just dropping it is actually safer than replacing it with a deprecation shim, because most of the users are checking for it with autoconf, which will notice a complete removal but not a replacement that emits a #warning. 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 | 4 ++++ ctype/ctype.h | 16 ++-------------- dev/null | 0 include/bits/types/__locale_t.h | 1 + include/bits/types/locale_t.h | 1 + include/printf.h | 2 +- include/time.h | 2 +- include/xlocale.h | 1 - locale/Makefile | 3 ++- locale/{xlocale.h => bits/types/__locale_t.h} | 24 ++++++++++++------------ locale/bits/types/locale_t.h | 26 ++++++++++++++++++++++++++ locale/langinfo.h | 7 ++----- locale/locale.h | 20 +++++++------------- 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 ++-- 35 files changed, 90 insertions(+), 111 deletions(-) create mode 100644 dev/null create mode 100644 include/bits/types/__locale_t.h create mode 100644 include/bits/types/locale_t.h delete mode 100644 include/xlocale.h rename locale/{xlocale.h => bits/types/__locale_t.h} (72%) create mode 100644 locale/bits/types/locale_t.h diff --git a/NEWS b/NEWS index 4db334b687..0736b4b27f 100644 --- a/NEWS +++ b/NEWS @@ -74,6 +74,10 @@ Version 2.26 as this kind of optimization is better done by the compiler. The macros __USE_STRING_INLINES and __NO_STRING_INLINES no longer have any effect. +* The nonstandard header has been removed. Most programs should + use instead. If you have a specific need for the definition + of locale_t with no other declarations, please talk to us. + * 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/dev/null b/dev/null new file mode 100644 index 0000000000..e69de29bb2 diff --git a/include/bits/types/__locale_t.h b/include/bits/types/__locale_t.h new file mode 100644 index 0000000000..610b8197c7 --- /dev/null +++ b/include/bits/types/__locale_t.h @@ -0,0 +1 @@ +#include 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