[clang] [clang][docs] Add note about `-Wms-bitfield-padding` in MSVC compatibility docs (PR #155770)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 29 13:23:32 PDT 2025
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/155770
>From cc25a94f6f2e28e386b00ca8feee4d2c53c1ee01 Mon Sep 17 00:00:00 2001
From: Oliver Hunt <oliver at apple.com>
Date: Thu, 28 Aug 2025 00:01:13 -0700
Subject: [PATCH] [clang][docs] Add note about `-Wms-bitfield-padding` in MSVC
compatibility docs
---
clang/docs/MSVCCompatibility.rst | 6 ++++++
1 file changed, 6 insertions(+)
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).
More information about the cfe-commits
mailing list