From patchwork Fri Aug 9 00:03:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 1144267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-104246-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="KoYfMeQU"; dkim-atps=neutral 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 464QSn3HRjz9s7T for ; Fri, 9 Aug 2019 10:03:53 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=ROG/7FbCZgi6WxHDOdSuhAO4c/ERp wJiq+p+jSpck8hnEfnu6iuVaW6m8vewsc/e/KSTcvTMLLrjLFaj8WCH1DZLCG/ka G1C6tb4F3XYfVPLZnfiNXpiqu20honZXy9lG0kPshsJINQRz86LESzYgTQNLHH1f +Jdtik/CbZc6E8= 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:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=P7DnSs02LV/OJVdLnaJHpzcyGSo=; b=KoY fMeQUzOraO74pjiQ+23dkKm3sxp0I1aaF+JCZnq53Z0a7RXcptnY0in2F+zPPP37 udzeCAWRuH8iJ1Q9Scg8Uod6u/Z6uJ2xc8S4tn00V5xV3/B68Sb758B1h94v6Lgg mWPbsmHEwiv//KGwSaPOypMmqk9jq3ONkoGF6Sac= Received: (qmail 129370 invoked by alias); 9 Aug 2019 00:03:46 -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 129357 invoked by uid 89); 9 Aug 2019 00:03:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=20190809, 2019-08-09 X-HELO: esa3.mentor.iphmx.com IronPort-SDR: 4m5htm4VCTEczE+iMjiY4ibfqNpnTvgNZVDj3puuLSmfo67aVI+Ei2odzzCD6mNjCUKeUoaPTw G0bHjA5HQqiiHg4EC/9kXw+NEFN5fRwbZGBljuzEUfQgveg4lCbaWBXu1Cjdh9vimO2MqlgV7X iGpdmRGRQPKjXpXdaJR+uoCLkFyuL6QUtueZAifrC+XOHmQ3H+8ruweukAvC9/+i5r/iE85y7D B2Yx+ApnTJSfsDCPl6AfAqtFDhn8yKQj9+b3u0F9UE7XtHLXiMi3i2ChTDjdwzXkDVFfTfgw/t es0= IronPort-SDR: EVTVr0en/A+KF+xTEX7MUwbsBhwba6yZk+FRbIY39Lykd6Dx8JqeMCjgvGbUTWrZ+XW6fO3JqY R0r7hcgjBUozgVso6WP0X0dQUc948KVD174YmARsJqA4sfBgTZrn9o84pNhNlUsGAiZm6gJv2w K0GsaUV4UfjURZBaehP24yU2jV2AYkh5GIJ/hdqQA8D8SdsNcQVqVvdao40alHho3T4QisB0E2 HuqXxwPjGNNNBWKcjKW1uoqY78pgC2IwOPFphrXFij5C6JdUBNi9rCw+jZmChBypy/h4gTBqMf bc8= Date: Fri, 9 Aug 2019 00:03:38 +0000 From: Joseph Myers To: Subject: Add feature test macro _ISOC2X_SOURCE Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 This patch starts preparation for C2X support in glibc headers by adding a feature test macro _ISOC2X_SOURCE and corresponding __GLIBC_USE (ISOC2X). (I chose to use the newer __GLIBC_USE style for this rather than the older __USE_* macros tested with #ifdef.) As with other such macros, C2X features are also enabled by compiling for a standard newer than C17, or by using _GNU_SOURCE. This patch does not itself enable anything new in the headers for C2X; that is to be done in followup patches. (For example, most of the TS 18661-1 functions should be declared for C2X without any __STDC_WANT_IEC_60559_BFP_EXT__ being needed, but the ones that 18661-1 adds to Annex F because of their close relation to IEEE 754 formats do still need the WANT macro in C2X.) Once C2X becomes an actual standard we'll presumably move to using the actual year in the feature test macro and __GLIBC_USE, with some period when both macro spellings are accepted, as was done with _ISOC9X_SOURCE. Tested for x86_64. 2019-08-09 Joseph Myers * include/features.h (_ISOC2X_SOURCE): New feature test macro. Undefine and define to 1 if [_GNU_SOURCE]. (__GLIBC_USE_ISOC2X): New macro. Undefine and redefine depending on [_ISOC2X_SOURCE] and [__STDC_VERSION__ > 201710L]. * manual/creature.texi (_ISOC2X_SOURCE): Document. diff --git a/NEWS b/NEWS index 4326997ddd..8ca7585c2c 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,12 @@ Version 2.31 Major new features: - [Add new features here] +* The GNU C Library now supports a feature test macro _ISOC2X_SOURCE to + enable features from the draft ISO C2X standard. Only some features from + this draft standard are supported by the GNU C Library, and as the draft + is under active development, the set of features enabled by this macro is + liable to change. Features from C2X are also enabled by _GNU_SOURCE, or + by compiling with "gcc -std=gnu2x". Deprecated and removed features, and other changes affecting compatibility: diff --git a/include/features.h b/include/features.h index bf47d881dd..126222ad7a 100644 --- a/include/features.h +++ b/include/features.h @@ -24,6 +24,7 @@ __STRICT_ANSI__ ISO Standard C. _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. + _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. __STDC_WANT_LIB_EXT2__ Extensions to ISO C99 from TR 27431-2:2010. __STDC_WANT_IEC_60559_BFP_EXT__ @@ -139,6 +140,7 @@ #undef __USE_GNU #undef __USE_FORTIFY_LEVEL #undef __KERNEL_STRICT_NAMES +#undef __GLIBC_USE_ISOC2X #undef __GLIBC_USE_DEPRECATED_GETS #undef __GLIBC_USE_DEPRECATED_SCANF @@ -195,6 +197,8 @@ # define _ISOC99_SOURCE 1 # undef _ISOC11_SOURCE # define _ISOC11_SOURCE 1 +# undef _ISOC2X_SOURCE +# define _ISOC2X_SOURCE 1 # undef _POSIX_SOURCE # define _POSIX_SOURCE 1 # undef _POSIX_C_SOURCE @@ -216,12 +220,21 @@ #if (defined _DEFAULT_SOURCE \ || (!defined __STRICT_ANSI__ \ && !defined _ISOC99_SOURCE && !defined _ISOC11_SOURCE \ + && !defined _ISOC2X_SOURCE \ && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE \ && !defined _XOPEN_SOURCE)) # undef _DEFAULT_SOURCE # define _DEFAULT_SOURCE 1 #endif +/* This is to enable the ISO C2X extension. */ +#if (defined _ISOC2X_SOURCE \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L)) +# define __GLIBC_USE_ISOC2X 1 +#else +# define __GLIBC_USE_ISOC2X 0 +#endif + /* This is to enable the ISO C11 extension. */ #if (defined _ISOC11_SOURCE \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)) diff --git a/manual/creature.texi b/manual/creature.texi index 8876b2ab77..23c1f834f3 100644 --- a/manual/creature.texi +++ b/manual/creature.texi @@ -177,6 +177,13 @@ when the compiler uses an earlier language version. If this macro is defined, ISO C11 extensions to ISO C99 are included. @end defvr +@defvr Macro _ISOC2X_SOURCE +@standards{C2X, (none)} +If this macro is defined, ISO C2X extensions to ISO C99 are included. +Only some features from this draft standard are supported by +@theglibc{}. +@end defvr + @defvr Macro __STDC_WANT_LIB_EXT2__ @standards{ISO, (none)} If you define this macro to the value @code{1}, features from ISO/IEC