[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 2 15:32:12 PST 2024
================
@@ -6418,6 +6418,12 @@ def warn_signed_bitfield_enum_conversion : Warning<
InGroup<BitFieldEnumConversion>, DefaultIgnore;
def note_change_bitfield_sign : Note<
"consider making the bitfield type %select{unsigned|signed}0">;
+def warn_ms_bitfield_mismatched_storage_packing : Warning<
+ "bit-field %0 of type %1 has a different storage size (%2 vs %3 bytes) than the "
+ "preceding bit-field and may not be packed under MSVC ABI">,
+ InGroup<MSBitfieldCompatibility>, DefaultIgnore;
----------------
rnk wrote:
If we did do this, it would be a Windows-thing, not an MSVC-thing, since it affects mingw. cc @mstorsjo for a mingw PoV
I don't think we should enable it by default until we have more confidence that there aren't false positives. I don't see that as a blocker to land it, though.
https://github.com/llvm/llvm-project/pull/117428
More information about the cfe-commits
mailing list