[clang] [clang][sema] Add support and documentation for `__has_extension(c_fixed_enum)` (PR #117507)

Aidan Goldfarb via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 27 09:11:50 PST 2024


================
@@ -121,6 +121,14 @@ int NegativeShortTest[NegativeShort == -1 ? 1 : -1];
 enum Color { Red, Green, Blue }; // expected-note{{previous use is here}}
 typedef struct Color NewColor; // expected-error {{use of 'Color' with tag type that does not match previous declaration}}
 
+// Enumerations with a fixed underlying type. 
+// https://github.com/llvm/llvm-project/issues/116880
+#if __STDC_VERSION__ >= 202311L && !__has_extension(c_fixed_enum)
----------------
AidanGoldfarb wrote:

Updated this, my thought process was to check for `__has_extension()` when <C23, and `__has_feature` in >=C23. 
Previously I had only checked for `__has_extension()` when >=C23, which in my mind was both incomplete (`__has_feature()` missing) and incorrect (`__has_extension()` should be associated with >C23 not >=C23).

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


More information about the cfe-commits mailing list