[clang] [clang][docs] Add note about `-Wms-bitfield-padding` in MSVC compatibility docs (PR #155770)

via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 28 00:04:43 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Oliver Hunt (ojhunt)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/155770.diff


1 Files Affected:

- (modified) clang/docs/MSVCCompatibility.rst (+6) 


``````````diff
diff --git a/clang/docs/MSVCCompatibility.rst b/clang/docs/MSVCCompatibility.rst
index b4a7d23e1b2c6..63c8d8e70a997 100644
--- a/clang/docs/MSVCCompatibility.rst
+++ b/clang/docs/MSVCCompatibility.rst
@@ -284,3 +284,9 @@ Since `__m128` is not a class type in clang any overloads after a template defin
 With MSVC ``foo(__m128)`` will be selected but with clang ``foo<__m128>()`` will be selected since on clang `__m128` is a builtin type.
 
 In general the takeaway is `__m128` is a builtin type on clang while a class type on MSVC.
+
+Warnings
+========
+
+* ``-Wms-bitfield-padding``
+  When generating code compatible with MSVC, clang applies the bit-field padding ABI used by MSVC. The padding behavior of sequential bit-fields in a record's layout is dependent on whether the underlying storage type of those bit-fields are the same. To help diagnose unexpected padding the ``-Wms-bitfield-padding`` warning can be used to diagnose cases where the MSVC ABI will not pad bit-fields (even if not targeting relevant platforms).

``````````

</details>


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


More information about the cfe-commits mailing list