public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin/main] sys/features.h: Define _ISOC2X_SOURCE and __ISO_C_VISIBLE
Date: Wed,  2 Aug 2023 15:04:09 +0000 (GMT)	[thread overview]
Message-ID: <20230802150409.D49B1385840A@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=290b56a87947620f171f65190616116fc1e0082c

commit 290b56a87947620f171f65190616116fc1e0082c
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Wed Aug 2 16:52:27 2023 +0200
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Wed Aug 2 16:56:24 2023 +0200

    sys/features.h: Define _ISOC2X_SOURCE and __ISO_C_VISIBLE
    
    Add feature test for C2X code. Add matching definitions
    _ISOC2X_SOURCE for requesting sources and __ISO_C_VISIBLE
    to be used in headers.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

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/features.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=c11 or g++ -std=c++11
  * 	ISO C11
  *
+ * _ISOC2x_SOURCE or gcc -std=c2x or g++ -std=c++20
+ * 	ISO C11
+ *
  * _ATFILE_SOURCE (implied by _POSIX_C_SOURCE >= 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=c++11 or newer (on by default since GCC 6), or with
  * 	_ISOC11_SOURCE.
  *
+ * __ISO_C_VISIBLE >= 2020
+ * 	ISO C2x; enabled with gcc -std=c2x or newer,
+ * 	g++ -std=c++20 or newer, or with
+ * 	_ISOC2X_SOURCE.
+ *
  * __ATFILE_VISIBLE
  *	"at" functions; enabled by default, with _ATFILE_SOURCE,
  * 	_POSIX_C_SOURCE >= 200809L, or _XOPEN_SOURCE >= 700.
@@ -261,7 +271,10 @@ extern "C" {
 #define	__GNU_VISIBLE		0
 #endif
 
-#if defined(_ISOC11_SOURCE) || \
+#if defined(_ISOC2X_SOURCE) || \
+  (__STDC_VERSION__ - 0) > 201710L || (__cplusplus - 0) >= 202002L
+#define __ISO_C_VISIBLE		2020
+#elif defined(_ISOC11_SOURCE) || \
   (__STDC_VERSION__ - 0) >= 201112L || (__cplusplus - 0) >= 201103L
 #define	__ISO_C_VISIBLE		2011
 #elif defined(_ISOC99_SOURCE) || (_POSIX_C_SOURCE - 0) >= 200112L || \

                 reply	other threads:[~2023-08-02 15:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230802150409.D49B1385840A@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).