Skip to content

Conversation

ojhunt
Copy link
Contributor

@ojhunt ojhunt commented Aug 28, 2025

No description provided.

@ojhunt ojhunt requested a review from MaxEW707 August 28, 2025 07:04
@ojhunt ojhunt self-assigned this Aug 28, 2025
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Aug 28, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 28, 2025

@llvm/pr-subscribers-clang

Author: Oliver Hunt (ojhunt)

Changes

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

1 Files Affected:

  • (modified) clang/docs/MSVCCompatibility.rst (+6)
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).

@ojhunt
Copy link
Contributor Author

ojhunt commented Aug 28, 2025

I wasn't sure if this was warranted, but given little effort to add the note I figured that I could create it an ping the last person to touch it :D

@ojhunt ojhunt force-pushed the users/ojhunt/ms-bitfield-padding-doc branch from 8e0f9dc to cc25a94 Compare August 29, 2025 20:23
@ojhunt ojhunt requested a review from cor3ntin September 3, 2025 21:17
@ojhunt
Copy link
Contributor Author

ojhunt commented Sep 3, 2025

@cor3ntin prodding you in case you know who should review, or are ok signing off on it :D

========

* ``-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).
Copy link
Contributor

@MaxEW707 MaxEW707 Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth linking to, https://clang.llvm.org/docs/DiagnosticsReference.html#wms-bitfield-padding, since the warning explanation on that page has really good examples.

Something like, See :doc:`diagnostics reference <DiagnosticsReference>` for more information on the -Wms-bitfield-padding warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants