With the defined the macro, to specify a packed struct in LLVM, one should do
LLVM_PACKED (struct A {
... };)
Differential D14337
Define a portable macro for specifying packed struct davidxl on Nov 4 2015, 9:00 AM. Authored by
Details With the defined the macro, to specify a packed struct in LLVM, one should do LLVM_PACKED (struct A { ... };)
Diff Detail
Event TimelineComment Actions Updated the patch with two more macros. The first macro can not be used when we need to include a header file in the struct body (e.g, for common definitions). The START/END pair style can be used instead. PTAL. Comment Actions GCC and Clang also support packing pragmas, right? I think I'd rather use those so that this code doesn't behave differently: LLVM_PACKED_START struct A { ... }; struct B { ... }; // packed in msvc, not gcc/clang LLVM_PACKED_END Comment Actions Good point about the potential style difference in using the scope based macros. Updated the patch according to the comment -- using _Pragma keyword for clang and gcc. |