mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 06:06:34 +08:00
Bump the value of __STDC_VERSION__ in -std=c2x mode
Previously, we reported the same value as for C17, now we report 202000L, which is the same value currently used by GCC. Once C23 ships, this value will be bumped to the correct date.
This commit is contained in:
@@ -129,6 +129,9 @@ Windows Support
|
||||
C Language Changes in Clang
|
||||
---------------------------
|
||||
|
||||
- The value of ``__STDC_VERSION__`` has been bumped to ``202000L`` when passing
|
||||
``-std=c2x`` so that it can be distinguished from C17 mode. This value is
|
||||
expected to change again when C23 is published.
|
||||
- Wide multi-characters literals such as ``L'ab'`` that would previously be interpreted as ``L'b'``
|
||||
are now ill-formed in all language modes. The motivation for this change is outlined in
|
||||
`P2362 <wg21.link/P2362>`_.
|
||||
|
||||
@@ -371,7 +371,10 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
|
||||
// value is, are implementation-defined.
|
||||
// (Removed in C++20.)
|
||||
if (!LangOpts.CPlusPlus) {
|
||||
if (LangOpts.C17)
|
||||
// FIXME: Use correct value for C23.
|
||||
if (LangOpts.C2x)
|
||||
Builder.defineMacro("__STDC_VERSION__", "202000L");
|
||||
else if (LangOpts.C17)
|
||||
Builder.defineMacro("__STDC_VERSION__", "201710L");
|
||||
else if (LangOpts.C11)
|
||||
Builder.defineMacro("__STDC_VERSION__", "201112L");
|
||||
|
||||
5
clang/test/Preprocessor/c2x.c
Normal file
5
clang/test/Preprocessor/c2x.c
Normal file
@@ -0,0 +1,5 @@
|
||||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c2x %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
// FIXME: Test the correct value once C23 ships.
|
||||
_Static_assert(__STDC_VERSION__ > 201710L, "Incorrect __STDC_VERSION__");
|
||||
Reference in New Issue
Block a user