[clang] [Clang] [C23] Implement N2653: u8 strings are char8_t[] (PR #97208)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 2 12:00:03 PDT 2024


================
@@ -104,6 +107,7 @@ typedef _Atomic(long)               atomic_long;
 typedef _Atomic(unsigned long)      atomic_ulong;
 typedef _Atomic(long long)          atomic_llong;
 typedef _Atomic(unsigned long long) atomic_ullong;
+typedef _Atomic(unsigned char)      atomic_char8_t;
 typedef _Atomic(uint_least16_t)     atomic_char16_t;
 typedef _Atomic(uint_least32_t)     atomic_char32_t;
----------------
AaronBallman wrote:

Let's address that one in a separate PR, but yes `atomic_char8_t` should be gated behind C23 because the identifier isn't reserved until C23. For C++, it should be gated behind C++20.

As for the definition, technically in C they should be using `char8_t` and friends as well, but those are defined in `uchar.h` which we don't vend with the compiler (should we be vending that one in freestanding?). GCC seems to use `unsigned char` directly rather than use a transitive include, so I think that approach is fine for us to take as well.

https://github.com/llvm/llvm-project/pull/97208


More information about the cfe-commits mailing list