public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: "Joseph S. Myers" <josmyers@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] libcpp: Adjust __STDC_VERSION__ for C23
Date: Thu, 25 Apr 2024 13:46:27 +0200	[thread overview]
Message-ID: <ZipCkwLeRN1IDibh@tucnak> (raw)

Hi!

While the C23 standard isn't officially release yet,
in 2011 we've changed __STDC_VERSION__ value for C11 already
in the month in which the new __STDC_VERSION__ value has been
finalized, so we want to change this now or wait
until we implement all the C23 features?

Note, seems Clang up to 17 also used 202000L for -std=c2x but
Clang 18+ uses 202311L as specified in the latest C23 drafts.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2024-04-25  Jakub Jelinek  <jakub@redhat.com>

	* init.cc (cpp_init_builtins): Change __STDC_VERSION__
	for C23 from 202000L to 202311L.

	* doc/cpp.texi (__STDC_VERSION__): Document 202311L value
	for -std=c23/-std=gnu23.

--- libcpp/init.cc.jj	2024-01-03 12:07:27.552378565 +0100
+++ libcpp/init.cc	2024-04-24 23:54:32.613204591 +0200
@@ -594,7 +594,7 @@ cpp_init_builtins (cpp_reader *pfile, in
     _cpp_define_builtin (pfile, "__STDC_VERSION__ 199409L");
   else if (CPP_OPTION (pfile, lang) == CLK_STDC23
 	   || CPP_OPTION (pfile, lang) == CLK_GNUC23)
-    _cpp_define_builtin (pfile, "__STDC_VERSION__ 202000L");
+    _cpp_define_builtin (pfile, "__STDC_VERSION__ 202311L");
   else if (CPP_OPTION (pfile, lang) == CLK_STDC17
 	   || CPP_OPTION (pfile, lang) == CLK_GNUC17)
     _cpp_define_builtin (pfile, "__STDC_VERSION__ 201710L");
--- gcc/doc/cpp.texi.jj	2024-01-03 11:38:23.583695795 +0100
+++ gcc/doc/cpp.texi	2024-04-25 00:28:08.144182645 +0200
@@ -1886,8 +1886,8 @@ the 1999 revision of the C standard; the
 signifies the 2011 revision of the C standard; the value
 @code{201710L} signifies the 2017 revision of the C standard (which is
 otherwise identical to the 2011 version apart from correction of
-defects).  An unspecified value larger than @code{201710L} is used for
-the experimental @option{-std=c23} and @option{-std=gnu23} modes.
+defects).  The value @code{202311L} is used for the experimental
+@option{-std=c23} and @option{-std=gnu23} modes.
 
 This macro is not defined if the @option{-traditional-cpp} option is
 used, nor when compiling C++ or Objective-C@.

	Jakub


             reply	other threads:[~2024-04-25 11:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25 11:46 Jakub Jelinek [this message]
2024-04-29 21:42 ` Joseph Myers

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=ZipCkwLeRN1IDibh@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=josmyers@redhat.com \
    /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).