[llvm] Add -Wms-bitfield-padding warning when possible (PR #139828)

Vlad Serebrennikov via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 04:33:51 PDT 2025


Endilll wrote:

I figured out I should compile lld and lldb, too. Here are additional warnings:
```
/home/user/endill/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h:192:12: warning: bit-field 'm_sibling_idx' of type 'uint32_t' (aka 'unsigned int') has a different storage size than the preceding bit-field (4 vs 8 bytes) and will not be packed under the Microsoft ABI [-Wms-bitfield-padding]
  192 |   uint32_t m_sibling_idx : 31, m_has_children : 1;
      |            ^
/home/user/endill/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h:187:15: note: preceding bit-field 'm_parent_idx' declared here with type 'dw_offset_t' (aka 'unsigned long')
  187 |   dw_offset_t m_parent_idx : 64 - DW_DIE_OFFSET_MAX_BITSIZE;
      |               ^
      
/home/user/endill/llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp:104:16: warning: bit-field '_priv1' of type 'uint64_t' (aka 'unsigned long') has a different storage size than the preceding bit-field (8 vs 4 bytes) and will not be packed under the Microsoft ABI [-Wms-bitfield-padding]
  104 |       uint64_t _priv1 : 4;
      |                ^
/home/user/endill/llvm-project/lldb/source/Plugins/Language/ObjC/NSArray.cpp:103:16: note: preceding bit-field '_size' declared here with type 'uint32_t' (aka 'unsigned int')
  103 |       uint32_t _size : 28;
      |                ^
      
/home/user/endill/llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.cpp:65:14: warning: bit-field '_szidx' of type 'uint32_t' (aka 'unsigned int') has a different storage size than the preceding bit-field (4 vs 8 bytes) and will not be packed under the Microsoft ABI [-Wms-bitfield-padding]
   65 |     uint32_t _szidx : 6;
      |              ^
/home/user/endill/llvm-project/lldb/source/Plugins/Language/ObjC/NSSet.cpp:64:14: note: preceding bit-field '_used' declared here with type 'uint64_t' (aka 'unsigned long')
   64 |     uint64_t _used : 58;
      |              ^
      
/home/user/endill/llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:276:16: warning: bit-field '_kvo' of type 'uint32_t' (aka 'unsigned int') has a different storage size than the preceding bit-field (4 vs 8 bytes) and will not be packed under the Microsoft ABI [-Wms-bitfield-padding]
  276 |       uint32_t _kvo : 1;
      |                ^
/home/user/endill/llvm-project/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp:275:16: note: preceding bit-field '_used' declared here with type 'uint64_t' (aka 'unsigned long')
  275 |       uint64_t _used : 58;
      |                ^
      
/home/user/endill/llvm-project/lld/wasm/InputChunks.h:107:12: warning: bit-field 'live' of type 'unsigned int' has a different storage size than the preceding bit-field (4 vs 1 bytes) and will not be packed under the Microsoft ABI [-Wms-bitfield-padding]
  107 |   unsigned live : 1;
      |            ^
/home/user/endill/llvm-project/lld/wasm/InputChunks.h:102:11: note: preceding bit-field 'sectionKind' declared here with type 'uint8_t' (aka 'unsigned char')
  102 |   uint8_t sectionKind : 3;
      |           ^
```

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


More information about the llvm-commits mailing list