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

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 29 09:23:59 PST 2023


MaskRay wrote:

`-mms-bitfields` is a GCC x86 specific option (`aarch64-linux-gnu-gcc -mms-bitfields -xc /dev/null -E` => `error: unrecognized command-line option ‘-mms-bitfields’`).
It does not make sense for MSVC.
Currently, Driver defaults to pass -mms-bitfields to cc1 for `windows-gnu` triples (https://reviews.llvm.org/D81795).
`windows-msvc` triples don't get `-mms-bitfields`.

This patch changes `getCXXABI().isMicrosoft()` to use the `-mms-bitfields` behavior (`RecordDecl::isMsStruct`), which is a drastic change.
Is it really necessary to achieve your goal?

For the `gcc_struct` feature request #24757 , I believe it's for windows-gnu triples, not for windows-msvc.
We don't necessarily enable it for windows-msvc. The patch tries to do something with windows-msvc and introduces CC1 options whose names are different from Driver options.
These introduce a lot complexity.


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


More information about the cfe-commits mailing list