[clang] [clang] Stub out gcc_struct attribute (PR #71148)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 29 12:53:51 PST 2023


mstorsjo wrote:

> One more thing. Re binary compatibility concerns: `-mno-ms-bitfields` on MinGW is an equally-sized footgun as on MSVC. Without proper header annotation with `#pragma ms_struct on`, either of them will silently make an ABI mismatch. However, for some reason, supporting `-mno-ms-bitfields` on MinGW is not argued upon.

I guess this is for historical reasons. Originally the MinGW target had this as an opt-in, and this was indeed a silent ABI mismatch. Users who needed to use affected structs and interact with Microsoft APIs had to remember to build their code with `-mms-bitfields` (and hope they don't link in some code that is built without it, with affected structs in their interface). It became the default only by GCC 4.7 (in 2012), and we picked up on this way much later in Clang, in Clang 11 in 2020.

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


More information about the cfe-commits mailing list