From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id D49B1385840A; Wed, 2 Aug 2023 15:04:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D49B1385840A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690988649; bh=jFqyLHdru+tG/59yD09aGt+IhANDtB45ebkRRoEGRyg=; h=From:To:Subject:Date:From; b=ijDxopaMUb/2Gs40OAV/Ao5sxKQvoixKLC0wIcTuGQd4NBCvQ5xTKro5DjJHF9/1f Gw4+SFLcj/fhqvjoBEBbkpul6u+rfDAHyH/vlT+syVfE8XDk/HkeYsPfzNwZo2rN+3 VEFW9Dm842KQ2kzU9Q2ZFRIKA5wqthspRWNz8g1E= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin/main] sys/features.h: Define _ISOC2X_SOURCE and __ISO_C_VISIBLE X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: 8fbbc668a01db50c3735d396f6e021940f7b3834 X-Git-Newrev: 290b56a87947620f171f65190616116fc1e0082c Message-Id: <20230802150409.D49B1385840A@sourceware.org> Date: Wed, 2 Aug 2023 15:04:09 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D290b56a8794= 7620f171f65190616116fc1e0082c commit 290b56a87947620f171f65190616116fc1e0082c Author: Corinna Vinschen AuthorDate: Wed Aug 2 16:52:27 2023 +0200 Commit: Corinna Vinschen CommitDate: Wed Aug 2 16:56:24 2023 +0200 sys/features.h: Define _ISOC2X_SOURCE and __ISO_C_VISIBLE =20 Add feature test for C2X code. Add matching definitions _ISOC2X_SOURCE for requesting sources and __ISO_C_VISIBLE to be used in headers. =20 Signed-off-by: Corinna Vinschen Diff: --- newlib/libc/include/sys/features.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/f= eatures.h index 45476ce4ad50..a7d4bc52d18f 100644 --- a/newlib/libc/include/sys/features.h +++ b/newlib/libc/include/sys/features.h @@ -87,6 +87,9 @@ extern "C" { * _ISOC11_SOURCE or gcc -std=3Dc11 or g++ -std=3Dc++11 * ISO C11 * + * _ISOC2x_SOURCE or gcc -std=3Dc2x or g++ -std=3Dc++20 + * ISO C11 + * * _ATFILE_SOURCE (implied by _POSIX_C_SOURCE >=3D 200809L) * "at" functions * @@ -114,6 +117,8 @@ extern "C" { #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 @@ -215,6 +220,11 @@ extern "C" { * g++ -std=3Dc++11 or newer (on by default since GCC 6), or with * _ISOC11_SOURCE. * + * __ISO_C_VISIBLE >=3D 2020 + * ISO C2x; enabled with gcc -std=3Dc2x or newer, + * g++ -std=3Dc++20 or newer, or with + * _ISOC2X_SOURCE. + * * __ATFILE_VISIBLE * "at" functions; enabled by default, with _ATFILE_SOURCE, * _POSIX_C_SOURCE >=3D 200809L, or _XOPEN_SOURCE >=3D 700. @@ -261,7 +271,10 @@ extern "C" { #define __GNU_VISIBLE 0 #endif =20 -#if defined(_ISOC11_SOURCE) || \ +#if defined(_ISOC2X_SOURCE) || \ + (__STDC_VERSION__ - 0) > 201710L || (__cplusplus - 0) >=3D 202002L +#define __ISO_C_VISIBLE 2020 +#elif defined(_ISOC11_SOURCE) || \ (__STDC_VERSION__ - 0) >=3D 201112L || (__cplusplus - 0) >=3D 201103L #define __ISO_C_VISIBLE 2011 #elif defined(_ISOC99_SOURCE) || (_POSIX_C_SOURCE - 0) >=3D 200112L || \