[clang-tools-extra] 13629b1 - [C2x] Support -std=c23 and -std=gnu23

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 10 11:06:09 PDT 2023


Author: Aaron Ballman
Date: 2023-08-10T13:57:40-04:00
New Revision: 13629b140801870feff855ca168edf6b34dbef8d

URL: https://github.com/llvm/llvm-project/commit/13629b140801870feff855ca168edf6b34dbef8d
DIFF: https://github.com/llvm/llvm-project/commit/13629b140801870feff855ca168edf6b34dbef8d.diff

LOG: [C2x] Support -std=c23 and -std=gnu23

C2x was finalized at the June 2023 WG14 meeting. The DIS is out for
balloting and the comment period for that closes later this year/early
next year. While that does leave an opportunity for more changes to the
standard during the DIS ballot resolution process, only editorial
changes are anticipated and as a result, the C committee considers C2x
to be final. The committee took a straw poll on what we'd prefer the
informal name of the standard be, and we decided it should be called
C23 regardless of what year ISO publishes it.

However, because the final publication is not out, this patch does not
add the language standard alias for the -std=iso9899:<year> spelling of
the standard mode; that will be added once ISO finally publishes the
document and the year chosen will match the publication date.

This also changes the value of __STDC_VERSION__ from the placeholder
value 202000L to the final value 202311L.

Subsequent patches will start renaming things from c2x to c23, cleaning
up documentation, etc.

Differential Revision: https://reviews.llvm.org/D157606

Added: 
    

Modified: 
    clang-tools-extra/clangd/index/StdLib.cpp
    clang/docs/ReleaseNotes.rst
    clang/include/clang/Basic/LangStandards.def
    clang/lib/Frontend/InitPreprocessor.cpp
    clang/lib/Headers/limits.h
    clang/lib/Headers/stdalign.h
    clang/lib/Headers/stdarg.h
    clang/lib/Headers/stdatomic.h
    clang/lib/Headers/stddef.h
    clang/lib/Headers/stdint.h
    clang/test/C/C11/n1330.c
    clang/test/C/drs/dr0xx.c
    clang/test/C/drs/dr2xx.c
    clang/test/C/drs/dr3xx.c
    clang/test/C/drs/dr411.c
    clang/test/Driver/unknown-std.c
    clang/test/Headers/limits.cpp
    clang/test/Headers/stdint.c
    clang/test/Lexer/unicode.c
    clang/test/Lexer/utf8-char-literal.cpp
    clang/test/Preprocessor/c2x.c
    clang/test/Preprocessor/ucn-allowed-chars.c
    clang/test/Sema/atomic-expr.c

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/index/StdLib.cpp b/clang-tools-extra/clangd/index/StdLib.cpp
index d9aa46d6b75b15..f12b246255c9f1 100644
--- a/clang-tools-extra/clangd/index/StdLib.cpp
+++ b/clang-tools-extra/clangd/index/StdLib.cpp
@@ -60,7 +60,7 @@ LangStandard::Kind standardFromOpts(const LangOptions &LO) {
     return LangStandard::lang_cxx98;
   }
   if (LO.C2x)
-    return LangStandard::lang_c2x;
+    return LangStandard::lang_c23;
   // C17 has no new features, so treat {C11,C17} as C17.
   if (LO.C11)
     return LangStandard::lang_c17;

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 8fa0c14b9ed0c3..8d15845625b888 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -98,6 +98,10 @@ C Language Changes
 
 C2x Feature Support
 ^^^^^^^^^^^^^^^^^^^
+- Clang now accepts ``-std=c23`` and ``-std=gnu23`` as language standard modes,
+  and the ``__STDC_VERSION__`` macro now expands to ``202311L`` instead of its
+  previous placeholder value. Clang continues to accept ``-std=c2x`` and
+  ``-std=gnu2x`` as aliases for C23 and GNU C23, respectively.
 
 Non-comprehensive list of changes in this release
 -------------------------------------------------

diff  --git a/clang/include/clang/Basic/LangStandards.def b/clang/include/clang/Basic/LangStandards.def
index 5c28bdd28ef257..90e279ffb790c8 100644
--- a/clang/include/clang/Basic/LangStandards.def
+++ b/clang/include/clang/Basic/LangStandards.def
@@ -87,13 +87,17 @@ LANGSTANDARD(gnu17, "gnu17",
              LineComment | C99 | C11 | C17 | Digraphs | GNUMode | HexFloat)
 LANGSTANDARD_ALIAS(gnu17, "gnu18")
 
-// C2x modes
-LANGSTANDARD(c2x, "c2x",
-             C, "Working Draft for ISO C2x",
+// C23 modes
+LANGSTANDARD(c23, "c23",
+             C, "Working Draft for ISO C23",
              LineComment | C99 | C11 | C17 | C2x | Digraphs | HexFloat)
-LANGSTANDARD(gnu2x, "gnu2x",
-             C, "Working Draft for ISO C2x with GNU extensions",
+LANGSTANDARD_ALIAS_DEPR(c23, "c2x")
+LANGSTANDARD(gnu23, "gnu23",
+             C, "Working Draft for ISO C23 with GNU extensions",
              LineComment | C99 | C11 | C17 | C2x | Digraphs | GNUMode | HexFloat)
+LANGSTANDARD_ALIAS_DEPR(gnu23, "gnu2x")
+// FIXME: Add the alias for iso9899:202* once we know the year ISO publishes
+// the document (expected to be 2024).
 
 // C++ modes
 LANGSTANDARD(cxx98, "c++98",

diff  --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 6df18a1d6e8880..0f5077712dd04a 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -438,9 +438,8 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
   //      value is, are implementation-defined.
   // (Removed in C++20.)
   if (!LangOpts.CPlusPlus) {
-    // FIXME: Use correct value for C23.
     if (LangOpts.C2x)
-      Builder.defineMacro("__STDC_VERSION__", "202000L");
+      Builder.defineMacro("__STDC_VERSION__", "202311L");
     else if (LangOpts.C17)
       Builder.defineMacro("__STDC_VERSION__", "201710L");
     else if (LangOpts.C11)

diff  --git a/clang/lib/Headers/limits.h b/clang/lib/Headers/limits.h
index 354e031a9d7b5c..eaebd494571fbb 100644
--- a/clang/lib/Headers/limits.h
+++ b/clang/lib/Headers/limits.h
@@ -67,9 +67,7 @@
 #define CHAR_BIT  __CHAR_BIT__
 
 /* C2x 5.2.4.2.1 */
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 #define BOOL_WIDTH   __BOOL_WIDTH__
 #define CHAR_WIDTH   CHAR_BIT
 #define SCHAR_WIDTH  CHAR_BIT

diff  --git a/clang/lib/Headers/stdalign.h b/clang/lib/Headers/stdalign.h
index 8ae6e658dd0a21..158508e65d2b34 100644
--- a/clang/lib/Headers/stdalign.h
+++ b/clang/lib/Headers/stdalign.h
@@ -10,10 +10,8 @@
 #ifndef __STDALIGN_H
 #define __STDALIGN_H
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
 #if defined(__cplusplus) ||                                                    \
-    (defined(__STDC_VERSION__) && __STDC_VERSION__ < 202000L)
+    (defined(__STDC_VERSION__) && __STDC_VERSION__ < 202311L)
 #ifndef __cplusplus
 #define alignas _Alignas
 #define alignof _Alignof

diff  --git a/clang/lib/Headers/stdarg.h b/clang/lib/Headers/stdarg.h
index ba978721f1f3dd..13742eea61f631 100644
--- a/clang/lib/Headers/stdarg.h
+++ b/clang/lib/Headers/stdarg.h
@@ -23,13 +23,11 @@ typedef __builtin_va_list va_list;
 #define _VA_LIST
 #endif
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
-/* C2x does not require the second parameter for va_start. */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
+/* C23 does not require the second parameter for va_start. */
 #define va_start(ap, ...) __builtin_va_start(ap, 0)
 #else
-/* Versions before C2x do require the second parameter. */
+/* Versions before C23 do require the second parameter. */
 #define va_start(ap, param) __builtin_va_start(ap, param)
 #endif
 #define va_end(ap)          __builtin_va_end(ap)

diff  --git a/clang/lib/Headers/stdatomic.h b/clang/lib/Headers/stdatomic.h
index aed33d4333e849..521c473dd169ab 100644
--- a/clang/lib/Headers/stdatomic.h
+++ b/clang/lib/Headers/stdatomic.h
@@ -45,16 +45,14 @@ extern "C" {
 #define ATOMIC_POINTER_LOCK_FREE    __CLANG_ATOMIC_POINTER_LOCK_FREE
 
 /* 7.17.2 Initialization */
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if (defined(__STDC_VERSION__) && __STDC_VERSION__ < 202000L) ||               \
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ < 202311L) ||               \
     defined(__cplusplus)
-/* ATOMIC_VAR_INIT was removed in C2x, but still remains in C++23. */
+/* ATOMIC_VAR_INIT was removed in C23, but still remains in C++23. */
 #define ATOMIC_VAR_INIT(value) (value)
 #endif
 
 #if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201710L &&              \
-      __STDC_VERSION__ < 202000L) ||                                           \
+      __STDC_VERSION__ < 202311L) ||                                           \
      (defined(__cplusplus) && __cplusplus >= 202002L)) &&                      \
     !defined(_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS)
 /* ATOMIC_VAR_INIT was deprecated in C17 and C++20. */

diff  --git a/clang/lib/Headers/stddef.h b/clang/lib/Headers/stddef.h
index 539541f0ed41af..dedf4e59a977eb 100644
--- a/clang/lib/Headers/stddef.h
+++ b/clang/lib/Headers/stddef.h
@@ -97,14 +97,12 @@ using ::std::nullptr_t;
 #undef __need_NULL
 #endif /* defined(__need_NULL) */
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 typedef typeof(nullptr) nullptr_t;
-#endif /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L */
+#endif /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L */
 
 #if defined(__need_STDDEF_H_misc) && defined(__STDC_VERSION__) &&              \
-    __STDC_VERSION__ >= 202000L
+    __STDC_VERSION__ >= 202311L
 #define unreachable() __builtin_unreachable()
 #endif /* defined(__need_STDDEF_H_misc) && >= C23 */
 

diff  --git a/clang/lib/Headers/stdint.h b/clang/lib/Headers/stdint.h
index a47e91be18896e..93af9a9c2c2c52 100644
--- a/clang/lib/Headers/stdint.h
+++ b/clang/lib/Headers/stdint.h
@@ -499,9 +499,8 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 # define INT64_MAX           INT64_C( 9223372036854775807)
 # define INT64_MIN         (-INT64_C( 9223372036854775807)-1)
 # define UINT64_MAX         UINT64_C(18446744073709551615)
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 # define UINT64_WIDTH         64
 # define INT64_WIDTH          UINT64_WIDTH
 
@@ -545,9 +544,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 # define INT_FAST64_MAX    __INT_LEAST64_MAX
 # define UINT_FAST64_MAX  __UINT_LEAST64_MAX
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) &&  __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) &&  __STDC_VERSION__ >= 202311L
 # define UINT_LEAST64_WIDTH __UINT_LEAST64_WIDTH
 # define INT_LEAST64_WIDTH  UINT_LEAST64_WIDTH
 # define UINT_FAST64_WIDTH  __UINT_LEAST64_WIDTH
@@ -586,9 +583,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 # undef __UINT_LEAST8_MAX
 # define __UINT_LEAST8_MAX  UINT56_MAX
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 # define UINT56_WIDTH         56
 # define INT56_WIDTH          UINT56_WIDTH
 # define UINT_LEAST56_WIDTH   UINT56_WIDTH
@@ -635,9 +630,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 # undef __UINT_LEAST8_MAX
 # define __UINT_LEAST8_MAX  UINT48_MAX
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 #define UINT48_WIDTH         48
 #define INT48_WIDTH          UINT48_WIDTH
 #define UINT_LEAST48_WIDTH   UINT48_WIDTH
@@ -684,9 +677,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 # undef __UINT_LEAST8_MAX
 # define __UINT_LEAST8_MAX  UINT40_MAX
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 # define UINT40_WIDTH         40
 # define INT40_WIDTH          UINT40_WIDTH
 # define UINT_LEAST40_WIDTH   UINT40_WIDTH
@@ -727,9 +718,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 # undef __UINT_LEAST8_MAX
 # define __UINT_LEAST8_MAX  UINT32_MAX
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 # define UINT32_WIDTH         32
 # define INT32_WIDTH          UINT32_WIDTH
 # undef __UINT_LEAST32_WIDTH
@@ -749,9 +738,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 # define INT_FAST32_MAX    __INT_LEAST32_MAX
 # define UINT_FAST32_MAX  __UINT_LEAST32_MAX
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 # define UINT_LEAST32_WIDTH __UINT_LEAST32_WIDTH
 # define INT_LEAST32_WIDTH  UINT_LEAST32_WIDTH
 # define UINT_FAST32_WIDTH  __UINT_LEAST32_WIDTH
@@ -784,9 +771,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 # undef __UINT_LEAST8_MAX
 # define __UINT_LEAST8_MAX  UINT24_MAX
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 # define UINT24_WIDTH         24
 # define INT24_WIDTH          UINT24_WIDTH
 # define UINT_LEAST24_WIDTH   UINT24_WIDTH
@@ -819,9 +804,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 # undef __UINT_LEAST8_MAX
 # define __UINT_LEAST8_MAX  UINT16_MAX
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 # define UINT16_WIDTH         16
 # define INT16_WIDTH          UINT16_WIDTH
 # undef __UINT_LEAST16_WIDTH
@@ -839,9 +822,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 # define INT_FAST16_MAX    __INT_LEAST16_MAX
 # define UINT_FAST16_MAX  __UINT_LEAST16_MAX
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 # define UINT_LEAST16_WIDTH __UINT_LEAST16_WIDTH
 # define INT_LEAST16_WIDTH  UINT_LEAST16_WIDTH
 # define UINT_FAST16_WIDTH  __UINT_LEAST16_WIDTH
@@ -862,9 +843,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 # undef __UINT_LEAST8_MAX
 # define __UINT_LEAST8_MAX  UINT8_MAX
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 # define UINT8_WIDTH         8
 # define INT8_WIDTH          UINT8_WIDTH
 # undef __UINT_LEAST8_WIDTH
@@ -880,9 +859,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 # define INT_FAST8_MAX    __INT_LEAST8_MAX
 # define UINT_FAST8_MAX  __UINT_LEAST8_MAX
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 # define UINT_LEAST8_WIDTH __UINT_LEAST8_WIDTH
 # define INT_LEAST8_WIDTH  UINT_LEAST8_WIDTH
 # define UINT_FAST8_WIDTH  __UINT_LEAST8_WIDTH
@@ -908,9 +885,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 #define    SIZE_MAX      __SIZE_MAX__
 
 /* C2x 7.20.2.4 Width of integer types capable of holding object pointers. */
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 /* NB: The C standard requires that these be the same value, but the compiler
    exposes separate internal width macros. */
 #define INTPTR_WIDTH  __INTPTR_WIDTH__
@@ -929,9 +904,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 #define UINTMAX_MAX  __UINTMAX_MAX__
 
 /* C2x 7.20.2.5 Width of greatest-width integer types. */
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 /* NB: The C standard requires that these be the same value, but the compiler
    exposes separate internal width macros. */
 #define INTMAX_WIDTH __INTMAX_WIDTH__
@@ -965,9 +938,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
 #define UINTMAX_C(v) __int_c(v, __UINTMAX_C_SUFFIX__)
 
 /* C2x 7.20.3.x Width of other integer types. */
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
 #define PTRDIFF_WIDTH    __PTRDIFF_WIDTH__
 #define SIG_ATOMIC_WIDTH __SIG_ATOMIC_WIDTH__
 #define SIZE_WIDTH       __SIZE_WIDTH__

diff  --git a/clang/test/C/C11/n1330.c b/clang/test/C/C11/n1330.c
index b8f31a4dbc6ffa..4e6d18d036d38e 100644
--- a/clang/test/C/C11/n1330.c
+++ b/clang/test/C/C11/n1330.c
@@ -58,9 +58,7 @@ void test(void) {
   _Static_assert(1.0f, "this should not compile"); // expected-warning {{expression is not an integer constant expression; folding it to a constant is a GNU extension}}
 }
 
-// FIXME: This is using the placeholder date Clang produces for the macro in
-// C2x mode; switch to the correct value once it's been published.
-#if __STDC_VERSION__ < 202000L
+#if __STDC_VERSION__ < 202311L
 // The use of a _Static_assert in a K&R C function definition is prohibited per
 // 6.9.1p6 requiring each declaration to have a declarator (which a static
 // assertion does not have) and only declare identifiers from the identifier

diff  --git a/clang/test/C/drs/dr0xx.c b/clang/test/C/drs/dr0xx.c
index 6a3717f0729b60..9eb626397b6e07 100644
--- a/clang/test/C/drs/dr0xx.c
+++ b/clang/test/C/drs/dr0xx.c
@@ -234,7 +234,7 @@ void dr031(int i) {
  */
 int dr032 = (1, 2); /* expected-warning {{left operand of comma operator has no effect}} */
 
-#if __STDC_VERSION__ < 202000L
+#if __STDC_VERSION__ < 202311L
 /* WG14 DR035: partial
  * Questions about definition of functions without a prototype
  */
@@ -251,7 +251,7 @@ void dr035_2(c) /* expected-warning {{a function definition without a prototype
    */
   int test = q; /* expected-error {{use of undeclared identifier 'q'}} */
 }
-#endif /* __STDC_VERSION__ < 202000L */
+#endif /* __STDC_VERSION__ < 202311L */
 
 /* WG14 DR038: yes
  * Questions about argument substitution during macro expansion
@@ -339,7 +339,7 @@ void dr050(void) {
   (void)NULL; /* expected-error {{use of undeclared identifier 'NULL'}} */
 }
 
-#if __STDC_VERSION__ < 202000L
+#if __STDC_VERSION__ < 202311L
 /* WG14 DR053: yes
  * Accessing a pointer to a function with a prototype through a pointer to
  * pointer to function without a prototype
@@ -356,7 +356,7 @@ void dr053(void) {
   fpp = &fp1;
   (**fpp)(3); /* expected-warning {{passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x}} */
 }
-#endif /* __STDC_VERSION__ < 202000L */
+#endif /* __STDC_VERSION__ < 202311L */
 
 /* WG14 DR064: yes
  * Null pointer constants
@@ -385,7 +385,7 @@ void dr068(void) {
 #endif
 }
 
-#if __STDC_VERSION__ < 202000L
+#if __STDC_VERSION__ < 202311L
 /* WG14: DR070: yes
  * Interchangeability of function arguments
  *
@@ -406,7 +406,7 @@ void dr070_2(void) {
   dr070_1(6);
   dr070_1(6U); /* Pedantically UB */
 }
-#endif /* __STDC_VERSION__ < 202000L */
+#endif /* __STDC_VERSION__ < 202311L */
 
 /* WG14 DR071: yes
  * Enumerated types

diff  --git a/clang/test/C/drs/dr2xx.c b/clang/test/C/drs/dr2xx.c
index 95d8eefaa2a99c..1aa8db504d61ce 100644
--- a/clang/test/C/drs/dr2xx.c
+++ b/clang/test/C/drs/dr2xx.c
@@ -231,7 +231,7 @@ void dr251(void) {
   struct dr251_fred *ptr; /* expected-error {{use of 'dr251_fred' with tag type that does not match previous declaration}} */
 }
 
-#if __STDC_VERSION__ < 202000L
+#if __STDC_VERSION__ < 202311L
 /* WG14 DR252: yes
  * Incomplete argument types when calling non-prototyped functions
  */
@@ -250,7 +250,7 @@ void dr252(void) {
                                     expected-warning {{passing arguments to 'dr252_no_proto' without a prototype is deprecated in all versions of C and is not supported in C2x}}
                                   */
 }
-#endif /* __STDC_VERSION__ < 202000L */
+#endif /* __STDC_VERSION__ < 202311L */
 
 /* WG14 DR258: yes
  * Ordering of "defined" and macro replacement

diff  --git a/clang/test/C/drs/dr3xx.c b/clang/test/C/drs/dr3xx.c
index d11cf208e543fa..9493e95123ed24 100644
--- a/clang/test/C/drs/dr3xx.c
+++ b/clang/test/C/drs/dr3xx.c
@@ -114,7 +114,7 @@ _Static_assert(sizeof(dr315.a + dr315.b) == sizeof(unsigned long long), ""); /*
  */
 _Static_assert(sizeof(dr315.c + dr315.d) == sizeof(int), "");
 
-#if __STDC_VERSION__ < 202000L
+#if __STDC_VERSION__ < 202311L
 /* WG14 DR316: yes
  * Unprototyped function types
  */
@@ -137,7 +137,7 @@ void dr317_2(void) {
                    expected-warning {{passing arguments to 'dr317_1' without a prototype is deprecated in all versions of C and is not supported in C2x}}
                  */
 }
-#endif /* __STDC_VERSION__ < 202000L */
+#endif /* __STDC_VERSION__ < 202311L */
 
 /* WG14 DR320: yes
  * Scope of variably modified type
@@ -243,7 +243,7 @@ void *dr339 = &(int (*)[dr339_v]){ 0 }; /* c89only-warning {{variable length arr
  * unclear whether the Clang behavior is intentional, but because the code is
  * UB, any behavior is acceptable.
  */
-#if __STDC_VERSION__ < 202000L
+#if __STDC_VERSION__ < 202311L
 void dr340(int x, int y) {
   typedef void (*T1)(int);
   typedef void (*T2)(); /* expected-warning {{a function declaration without a prototype is deprecated in all versions of C}} */
@@ -254,7 +254,7 @@ void dr340(int x, int y) {
                          */
   (y ? a : b)[0][0]();
 }
-#endif /* __STDC_VERSION__ < 202000L */
+#endif /* __STDC_VERSION__ < 202311L */
 
 /* WG14 DR341: yes
  * [*] in abstract declarators

diff  --git a/clang/test/C/drs/dr411.c b/clang/test/C/drs/dr411.c
index 0cb0000b3c3161..e182c72766482c 100644
--- a/clang/test/C/drs/dr411.c
+++ b/clang/test/C/drs/dr411.c
@@ -25,8 +25,7 @@ _Static_assert(__STDC_VERSION__ == 201112L, "");
 #elif defined(C17)
 _Static_assert(__STDC_VERSION__ == 201710L, "");
 #elif defined(C2X)
-/* FIXME: this value will change once WG14 picks the final value for C2x. */
-_Static_assert(__STDC_VERSION__ == 202000L, "");
+_Static_assert(__STDC_VERSION__ == 202311L, "");
 #else
 #error "unknown language standard version"
 #endif

diff  --git a/clang/test/Driver/unknown-std.c b/clang/test/Driver/unknown-std.c
index d87a968894b36d..564c633c09bd9c 100644
--- a/clang/test/Driver/unknown-std.c
+++ b/clang/test/Driver/unknown-std.c
@@ -16,8 +16,8 @@
 // CHECK-NEXT: note: use 'gnu11' for 'ISO C 2011 with GNU extensions' standard
 // CHECK-NEXT: note: use 'c17', 'iso9899:2017', 'c18', or 'iso9899:2018' for 'ISO C 2017' standard
 // CHECK-NEXT: note: use 'gnu17' or 'gnu18' for 'ISO C 2017 with GNU extensions' standard
-// CHECK-NEXT: note: use 'c2x' for 'Working Draft for ISO C2x' standard
-// CHECK-NEXT: note: use 'gnu2x' for 'Working Draft for ISO C2x with GNU extensions' standard
+// CHECK-NEXT: note: use 'c23' for 'Working Draft for ISO C23' standard
+// CHECK-NEXT: note: use 'gnu23' for 'Working Draft for ISO C23 with GNU extensions' standard
 
 // Make sure that no other output is present.
 // CHECK-NOT: {{^.+$}}

diff  --git a/clang/test/Headers/limits.cpp b/clang/test/Headers/limits.cpp
index fbf6ed0f751cbb..da7a64901831d5 100644
--- a/clang/test/Headers/limits.cpp
+++ b/clang/test/Headers/limits.cpp
@@ -126,9 +126,7 @@ _Static_assert(EXPR_TYPE_IS(ULLONG_MAX, unsigned long long), "");
 int LLONG_MIN, LLONG_MAX, ULLONG_MAX; // Not defined.
 #endif
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if __STDC_VERSION__ >= 202000L
+#if __STDC_VERSION__ >= 202311L
 /* Validate the standard requirements. */
 _Static_assert(BOOL_WIDTH >= 1);
 #if BOOL_WIDTH

diff  --git a/clang/test/Headers/stdint.c b/clang/test/Headers/stdint.c
index 9c52b4d164dd1c..e8b193785ff085 100644
--- a/clang/test/Headers/stdint.c
+++ b/clang/test/Headers/stdint.c
@@ -20,9 +20,7 @@
 
 #include <stdint.h>
 
-/* FIXME: This is using the placeholder dates Clang produces for these macros
-   in C2x mode; switch to the correct values once they've been published. */
-#if __STDC_VERSION__ >= 202000L
+#if __STDC_VERSION__ >= 202311L
 /* Validate the standard requirements. */
 _Static_assert(SIG_ATOMIC_WIDTH >= 8);
 _Static_assert(SIZE_WIDTH >= 16);
@@ -52,7 +50,7 @@ int PTRDIFF_WIDTH, SIG_ATOMIC_WIDTH, SIZE_WIDTH, WCHAR_WIDTH, WINT_WIDTH,
     INTPTR_WIDTH, UINTPTR_WIDTH, INTMAX_WIDTH, UINTMAX_WIDTH;
 #endif
 
-#if defined(INT8_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT8_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT8_WIDTH == 8, "");
 _Static_assert(UINT8_WIDTH == INT8_WIDTH, "");
 _Static_assert(INT8_WIDTH / __CHAR_BIT__ == sizeof(int8_t), "");
@@ -60,7 +58,7 @@ _Static_assert(UINT8_WIDTH / __CHAR_BIT__ == sizeof(uint8_t), "");
 #else
 int INT8_WIDTH, UINT8_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_LEAST8_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_LEAST8_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_LEAST8_WIDTH >= 8, "");
 _Static_assert(INT_LEAST8_WIDTH / __CHAR_BIT__ == sizeof(int_least8_t), "");
 _Static_assert(UINT_LEAST8_WIDTH == INT_LEAST8_WIDTH, "");
@@ -68,7 +66,7 @@ _Static_assert(UINT_LEAST8_WIDTH / __CHAR_BIT__ == sizeof(uint_least8_t), "");
 #else
 int INT_LEAST8_WIDTH, UINT_LEAST8_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_FAST8_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_FAST8_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_FAST8_WIDTH >= 8, "");
 _Static_assert(INT_FAST8_WIDTH / __CHAR_BIT__ == sizeof(int_fast8_t), "");
 _Static_assert(UINT_FAST8_WIDTH == INT_FAST8_WIDTH, "");
@@ -77,7 +75,7 @@ _Static_assert(UINT_FAST8_WIDTH / __CHAR_BIT__ == sizeof(uint_fast8_t), "");
 int INT_FAST8_WIDTH, UINT_FAST8_WIDTH; /* None of these are defined. */
 #endif
 
-#if defined(INT16_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT16_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT16_WIDTH == 16, "");
 _Static_assert(UINT16_WIDTH == INT16_WIDTH, "");
 _Static_assert(INT16_WIDTH / __CHAR_BIT__ == sizeof(int16_t), "");
@@ -85,7 +83,7 @@ _Static_assert(UINT16_WIDTH / __CHAR_BIT__ == sizeof(uint16_t), "");
 #else
 int INT16_WIDTH, UINT16_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_LEAST16_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_LEAST16_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_LEAST16_WIDTH >= 16, "");
 _Static_assert(INT_LEAST16_WIDTH / __CHAR_BIT__ == sizeof(int_least16_t), "");
 _Static_assert(UINT_LEAST16_WIDTH == INT_LEAST16_WIDTH, "");
@@ -93,7 +91,7 @@ _Static_assert(UINT_LEAST16_WIDTH / __CHAR_BIT__ == sizeof(uint_least16_t), "");
 #else
 int INT_LEAST16_WIDTH, UINT_LEAST16_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_FAST16_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_FAST16_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_FAST16_WIDTH >= 16, "");
 _Static_assert(INT_FAST16_WIDTH / __CHAR_BIT__ == sizeof(int_fast16_t), "");
 _Static_assert(UINT_FAST16_WIDTH == INT_FAST16_WIDTH, "");
@@ -102,7 +100,7 @@ _Static_assert(UINT_FAST16_WIDTH / __CHAR_BIT__ == sizeof(int_fast16_t), "");
 int INT_FAST16_WIDTH, UINT_FAST16_WIDTH; /* None of these are defined. */
 #endif
 
-#if defined(INT24_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT24_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT24_WIDTH == 24, "");
 _Static_assert(UINT24_WIDTH == INT24_WIDTH, "");
 _Static_assert(INT24_WIDTH / __CHAR_BIT__ == sizeof(int24_t), "");
@@ -110,7 +108,7 @@ _Static_assert(UINT24_WIDTH / __CHAR_BIT__ == sizeof(uint24_t), "");
 #else
 int INT24_WIDTH, UINT24_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_LEAST24_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_LEAST24_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_LEAST24_WIDTH >= 24, "");
 _Static_assert(INT_LEAST24_WIDTH / __CHAR_BIT__ == sizeof(int_least24_t), "");
 _Static_assert(UINT_LEAST24_WIDTH == INT_LEAST24_WIDTH, "");
@@ -118,7 +116,7 @@ _Static_assert(UINT_LEAST24_WIDTH / __CHAR_BIT__ == sizeof(uint_least24_t), "");
 #else
 int INT_LEAST24_WIDTH, UINT_LEAST24_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_FAST24_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_FAST24_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_FAST24_WIDTH >= 24, "");
 _Static_assert(INT_FAST24_WIDTH / __CHAR_BIT__ == sizeof(int_fast24_t), "");
 _Static_assert(UINT_FAST24_WIDTH == INT_FAST24_WIDTH, "");
@@ -127,7 +125,7 @@ _Static_assert(UINT_FAST24_WIDTH / __CHAR_BIT__ == sizeof(uint_fast24_t), "");
 int INT_FAST24_WIDTH, UINT_FAST24_WIDTH; /* None of these are defined. */
 #endif
 
-#if defined(INT32_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT32_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT32_WIDTH == 32, "");
 _Static_assert(UINT32_WIDTH == INT32_WIDTH, "");
 _Static_assert(INT32_WIDTH / __CHAR_BIT__ == sizeof(int32_t), "");
@@ -135,7 +133,7 @@ _Static_assert(UINT32_WIDTH / __CHAR_BIT__ == sizeof(uint32_t), "");
 #else
 int INT32_WIDTH, UINT32_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_LEAST32_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_LEAST32_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_LEAST32_WIDTH >= 32, "");
 _Static_assert(INT_LEAST32_WIDTH / __CHAR_BIT__ == sizeof(int_least32_t), "");
 _Static_assert(UINT_LEAST32_WIDTH == INT_LEAST32_WIDTH, "");
@@ -143,7 +141,7 @@ _Static_assert(UINT_LEAST32_WIDTH / __CHAR_BIT__ == sizeof(uint_least32_t), "");
 #else
 int INT_LEAST32_WIDTH, UINT_LEAST32_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_FAST32_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_FAST32_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_FAST32_WIDTH >= 32, "");
 _Static_assert(INT_FAST32_WIDTH / __CHAR_BIT__ == sizeof(int_fast32_t), "");
 _Static_assert(UINT_FAST32_WIDTH == INT_FAST32_WIDTH, "");
@@ -152,7 +150,7 @@ _Static_assert(UINT_FAST32_WIDTH / __CHAR_BIT__ == sizeof(uint_fast32_t), "");
 int INT_FAST32_WIDTH, UINT_FAST32_WIDTH; /* None of these are defined. */
 #endif
 
-#if defined(INT40_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT40_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT40_WIDTH == 40, "");
 _Static_assert(UINT40_WIDTH == INT40_WIDTH, "");
 _Static_assert(INT40_WIDTH / __CHAR_BIT__ == sizeof(int40_t), "");
@@ -160,7 +158,7 @@ _Static_assert(UINT40_WIDTH / __CHAR_BIT__ == sizeof(uint40_t), "");
 #else
 int INT40_WIDTH, UINT40_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_LEAST40_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_LEAST40_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_LEAST40_WIDTH >= 40, "");
 _Static_assert(INT_LEAST40_WIDTH / __CHAR_BIT__ == sizeof(int_least40_t), "");
 _Static_assert(UINT_LEAST40_WIDTH == INT_LEAST40_WIDTH, "");
@@ -168,7 +166,7 @@ _Static_assert(UINT_LEAST40_WIDTH / __CHAR_BIT__ == sizeof(int_least40_t), "");
 #else
 int INT_LEAST40_WIDTH, UINT_LEAST40_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_FAST40_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_FAST40_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_FAST40_WIDTH >= 40, "");
 _Static_assert(INT_FAST40_WIDTH / __CHAR_BIT__ == sizeof(int_fast40_t), "");
 _Static_assert(UINT_FAST40_WIDTH == INT_FAST40_WIDTH, "");
@@ -177,7 +175,7 @@ _Static_assert(UINT_FAST40_WIDTH / __CHAR_BIT__ == sizeof(uint_fast40_t), "");
 int INT_FAST40_WIDTH, UINT_FAST40_WIDTH; /* None of these are defined. */
 #endif
 
-#if defined(INT48_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT48_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT48_WIDTH == 48, "");
 _Static_assert(UINT48_WIDTH == INT48_WIDTH, "");
 _Static_assert(INT48_WIDTH / __CHAR_BIT__ == sizeof(int48_t), "");
@@ -185,7 +183,7 @@ _Static_assert(UINT48_WIDTH / __CHAR_BIT__ == sizeof(uint48_t), "");
 #else
 int INT48_WIDTH, UINT48_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_LEAST48_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_LEAST48_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_LEAST48_WIDTH >= 48, "");
 _Static_assert(INT_LEAST48_WIDTH / __CHAR_BIT__ == sizeof(int_least48_t), "");
 _Static_assert(UINT_LEAST48_WIDTH == INT_LEAST48_WIDTH, "");
@@ -193,7 +191,7 @@ _Static_assert(UINT_LEAST48_WIDTH / __CHAR_BIT__ == sizeof(int_least48_t), "");
 #else
 int INT_LEAST48_WIDTH, UINT_LEAST48_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_FAST48_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_FAST48_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_FAST48_WIDTH >= 48, "");
 _Static_assert(INT_FAST48_WIDTH / __CHAR_BIT__ == sizeof(int_fast48_t), "");
 _Static_assert(UINT_FAST48_WIDTH == INT_FAST48_WIDTH, "");
@@ -202,7 +200,7 @@ _Static_assert(UINT_FAST48_WIDTH / __CHAR_BIT__ == sizeof(int_fast48_t), "");
 int INT_FAST48_WIDTH, UINT_FAST48_WIDTH; /* None of these are defined. */
 #endif
 
-#if defined(INT56_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT56_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT56_WIDTH == 56, "");
 _Static_assert(UINT56_WIDTH == INT56_WIDTH, "");
 _Static_assert(INT56_WIDTH / __CHAR_BIT__ == sizeof(int56_t), "");
@@ -210,7 +208,7 @@ _Static_assert(UINT56_WIDTH / __CHAR_BIT__ == sizeof(uint56_t), "");
 #else
 int INT56_WIDTH, UINT56_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_LEAST56_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_LEAST56_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_LEAST56_WIDTH >= 56, "");
 _Static_assert(INT_LEAST56_WIDTH / __CHAR_BIT__ == sizeof(int_least56_t), "");
 _Static_assert(UINT_LEAST56_WIDTH == INT_LEAST56_WIDTH, "");
@@ -218,7 +216,7 @@ _Static_assert(UINT_LEAST56_WIDTH / __CHAR_BIT__ == sizeof(int_least56_t), "");
 #else
 int INT_LEAST56_WIDTH, UINT_LEAST56_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_FAST56_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_FAST56_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_FAST56_WIDTH >= 56, "");
 _Static_assert(INT_FAST56_WIDTH / __CHAR_BIT__ == sizeof(int_fast56_t), "");
 _Static_assert(UINT_FAST56_WIDTH == INT_FAST56_WIDTH, "");
@@ -227,7 +225,7 @@ _Static_assert(UINT_FAST56_WIDTH / __CHAR_BIT__ == sizeof(int_fast56_t), "");
 int INT_FAST56_WIDTH, UINT_FAST56_WIDTH; /* None of these are defined. */
 #endif
 
-#if defined(INT64_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT64_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT64_WIDTH == 64, "");
 _Static_assert(UINT64_WIDTH == INT64_WIDTH, "");
 _Static_assert(INT64_WIDTH / __CHAR_BIT__ == sizeof(int64_t), "");
@@ -235,7 +233,7 @@ _Static_assert(UINT64_WIDTH / __CHAR_BIT__ == sizeof(uint64_t), "");
 #else
 int INT64_WIDTH, UINT64_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_LEAST64_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_LEAST64_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_LEAST64_WIDTH >= 64, "");
 _Static_assert(INT_LEAST64_WIDTH / __CHAR_BIT__ == sizeof(int_least64_t), "");
 _Static_assert(UINT_LEAST64_WIDTH == INT_LEAST64_WIDTH, "");
@@ -243,7 +241,7 @@ _Static_assert(UINT_LEAST64_WIDTH / __CHAR_BIT__ == sizeof(int_least64_t), "");
 #else
 int INT_LEAST64_WIDTH, UINT_LEAST64_WIDTH; /* None of these are defined. */
 #endif
-#if defined(INT_FAST64_MAX) && __STDC_VERSION__ >= 202000L
+#if defined(INT_FAST64_MAX) && __STDC_VERSION__ >= 202311L
 _Static_assert(INT_FAST64_WIDTH >= 64, "");
 _Static_assert(INT_FAST64_WIDTH / __CHAR_BIT__ == sizeof(int_fast64_t), "");
 _Static_assert(UINT_FAST64_WIDTH == INT_FAST64_WIDTH, "");

diff  --git a/clang/test/Lexer/unicode.c b/clang/test/Lexer/unicode.c
index 45c998e7f87721..d86ac2d5e26049 100644
--- a/clang/test/Lexer/unicode.c
+++ b/clang/test/Lexer/unicode.c
@@ -32,7 +32,7 @@ int a;
 extern int X\UAAAAAAAA; // expected-error {{not allowed in an identifier}}
 int Y = '\UAAAAAAAA'; // expected-error {{invalid universal character}}
 
-#if defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L)
+#if defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
 
 extern int ༀ;
 extern int 𑩐;

diff  --git a/clang/test/Lexer/utf8-char-literal.cpp b/clang/test/Lexer/utf8-char-literal.cpp
index 931f58a16b666a..4db7a2ec7d1cf9 100644
--- a/clang/test/Lexer/utf8-char-literal.cpp
+++ b/clang/test/Lexer/utf8-char-literal.cpp
@@ -16,7 +16,7 @@ char c = u8'\u0080'; // expected-error {{character too large for enclosing chara
 char d = u8'\u1234'; // expected-error {{character too large for enclosing character literal type}}
 char e = u8'ሴ'; // expected-error {{character too large for enclosing character literal type}}
 char f = u8'ab'; // expected-error {{Unicode character literals may not contain multiple characters}}
-#elif __STDC_VERSION__ >= 202000L
+#elif __STDC_VERSION__ >= 202311L
 char a = u8'ñ';      // expected-error {{character too large for enclosing character literal type}}
 char b = u8'\x80';   // ok
 char c = u8'\u0000'; // ok
@@ -49,8 +49,8 @@ _Static_assert(
 #  endif
 #endif
 
-/// In C2x, u8 char literals are always unsigned.
-#if __STDC_VERSION__ >= 202000L
+/// In C23, u8 char literals are always unsigned.
+#if __STDC_VERSION__ >= 202311L
 #  if u8'\xff' == '\xff'// expected-warning {{right side of operator converted from negative value to unsigned}}
 #    error u8 char literal is not unsigned
 #  endif

diff  --git a/clang/test/Preprocessor/c2x.c b/clang/test/Preprocessor/c2x.c
index 96fc9273a28685..d137d58f815bdd 100644
--- a/clang/test/Preprocessor/c2x.c
+++ b/clang/test/Preprocessor/c2x.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c2x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c23 %s
 // expected-no-diagnostics
 
-// FIXME: Test the correct value once C23 ships.
-_Static_assert(__STDC_VERSION__ > 201710L, "Incorrect __STDC_VERSION__");
+_Static_assert(__STDC_VERSION__ == 202311L, "Incorrect __STDC_VERSION__");

diff  --git a/clang/test/Preprocessor/ucn-allowed-chars.c b/clang/test/Preprocessor/ucn-allowed-chars.c
index 608bf58be63762..0409ad07c559a0 100644
--- a/clang/test/Preprocessor/ucn-allowed-chars.c
+++ b/clang/test/Preprocessor/ucn-allowed-chars.c
@@ -53,8 +53,8 @@ extern char \u0D61; // C99, C11, C++03, C++11
 
 # endif
 #else
-# if __STDC_VERSION__ >= 201800L
-// C2X
+# if __STDC_VERSION__ >= 202311L
+// C23
 // expected-warning at 8 {{using this character in an identifier is incompatible with C99}}
 // expected-error at 10 {{character <U+0384> not allowed in an identifier}}
 // expected-error at 12 {{character <U+FFFF> not allowed in an identifier}}

diff  --git a/clang/test/Sema/atomic-expr.c b/clang/test/Sema/atomic-expr.c
index b77e9465b38b88..b34c15e4fca8b4 100644
--- a/clang/test/Sema/atomic-expr.c
+++ b/clang/test/Sema/atomic-expr.c
@@ -152,23 +152,23 @@ void func_17(void) {
   _Atomic(const int *) acip5 = cicp;
   _Atomic(const void *) acvip3 = cicp;
 
-#if __STDC_VERSION__ >= 202000L
+#if __STDC_VERSION__ >= 202311L
   // the left operand has an atomic ... version of the nullptr_t type and the
   // right operand is a null pointer constant or its type is nullptr_t
   typedef typeof(nullptr) nullptr_t;
   nullptr_t n;
   _Atomic nullptr_t cn2 = n;
   _Atomic nullptr_t cn3 = nullptr;
-#endif // __STDC_VERSION__ >= 202000L
+#endif // __STDC_VERSION__ >= 202311L
 
   // the left operand is an atomic ... pointer, and the right operand is a null
   // pointer constant or its type is nullptr_t;
   _Atomic(int *) aip2 = 0;
-#if __STDC_VERSION__ >= 202000L
+#if __STDC_VERSION__ >= 202311L
   _Atomic(int *) ip2 = n;
   _Atomic(int *) ip3 = nullptr;
   _Atomic(const int *) ip4 = nullptr;
-#endif // __STDC_VERSION__ >= 202000L
+#endif // __STDC_VERSION__ >= 202311L
 }
 
 // Ensure that the assignment constraints also work at file scope.
@@ -185,14 +185,14 @@ _Atomic(const int *) acip1 = cip; // expected-error {{initializer element is not
 const void *cvp = 0;
 _Atomic(const int *) acip2 = cvp; // expected-error {{initializer element is not a compile-time constant}}
 
-#if __STDC_VERSION__ >= 202000L
+#if __STDC_VERSION__ >= 202311L
   // the left operand has an atomic ... version of the nullptr_t type and the
   // right operand is a null pointer constant or its type is nullptr_t
   typedef typeof(nullptr) nullptr_t;
   nullptr_t n;
   _Atomic nullptr_t cn2 = n; // expected-error {{initializer element is not a compile-time constant}}
   _Atomic(int *) aip2 = nullptr;
-#endif // __STDC_VERSION__ >= 202000L
+#endif // __STDC_VERSION__ >= 202311L
 
 // FIXME: &ai is an address constant, so this should be accepted as an
 // initializer, but the bit-cast inserted due to the pointer conversion is


        


More information about the cfe-commits mailing list