[clang] [clang][C23] Support N3029 Improved Normal Enumerations (PR #103917)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 5 05:16:22 PDT 2024


================
@@ -1039,7 +1039,8 @@ def err_opencl_invalid_param : Error<
   "declaring function parameter of type %0 is not allowed%select{; did you forget * ?|}1">;
 def err_opencl_invalid_return : Error<
   "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
-def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
+def ext_c23_enum_value_int_overflow : Extension<"incremented enumerator value that is exceeding range of 'int' is a C23 extension">, InGroup<C23>;
+def warn_c17_compat_enum_value_int_overflow : Warning<"incremented enumerator value that is exceeding range of 'int' is incompatible with C standards before C23">, InGroup<CPre23Compat>;
----------------
AaronBallman wrote:

```suggestion
def ext_c23_enum_value_int_overflow : Extension<
  "incremented enumerator value which exceeds the range of 'int' is a C23 extension">,
  InGroup<C23>;
def warn_c17_compat_enum_value_int_overflow : Warning<
  "incremented enumerator value which exceeds the range of 'int' is incompatible with "
  "C standards before C23">, InGroup<CPre23Compat>;
```
Some wording tweaks and may need reformatting, but trying to keep it under 80 columns. However, would it make sense to use `ext_c23_enum_value_not_int` and `warn_c17_compat_enum_value_not_int` instead as they're basically warning about the same thing? See suggestion below.

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


More information about the cfe-commits mailing list