[clang] [Clang] Consider preferred_type in bitfield warnings (#116760) (PR #116785)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 12 06:04:17 PDT 2025
================
@@ -6517,8 +6517,22 @@ def warn_signed_bitfield_enum_conversion : Warning<
"signed bit-field %0 needs an extra bit to represent the largest positive "
"enumerators of %1">,
InGroup<BitFieldEnumConversion>, DefaultIgnore;
+def warn_preferred_type_bitfield_too_small_for_enum : Warning<
+ "bit-field %0 is not wide enough to store all enumerators of preferred type %1">,
+ InGroup<PreferredTypeBitFieldEnumConversion>, DefaultError;
+def warn_preferred_type_unsigned_bitfield_assigned_signed_enum : Warning<
+ "assigning value of preferred signed enum type %1 to unsigned bit-field %0; "
+ "negative enumerators of enum %1 will be converted to positive values">,
+ InGroup<PreferredTypeBitFieldEnumConversion>, DefaultIgnore;
----------------
AaronBallman wrote:
I still think use of the attribute should mean this can be on by default rather than ignored by default. WDYT?
https://github.com/llvm/llvm-project/pull/116785
More information about the cfe-commits
mailing list