[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 11 11:37:19 PDT 2025


================
@@ -6519,6 +6519,13 @@ def warn_signed_bitfield_enum_conversion : Warning<
   InGroup<BitFieldEnumConversion>, DefaultIgnore;
 def note_change_bitfield_sign : Note<
   "consider making the bit-field type %select{unsigned|signed}0">;
+def warn_ms_bitfield_mismatched_storage_packing : Warning<
+  "bit-field %0 of type %1 has a different storage size than the "
+  "preceding bit-field (%2 vs %3 bytes) and will not be packed under "
+  "the MS Windows platform ABI">,
----------------
AaronBallman wrote:

Thanks for the explanation!

Would you recommend we go with `Windows ABI` and leave the `Microsoft` off? Or should we use `Microsoft Windows ABI`? I mostly want to avoid `MS`.

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


More information about the cfe-commits mailing list