On Sat, Dec 2, 2023 at 4:50 PM Dan Klishch <daklis...@gmail.com> wrote: > > Hi, > > In the discussion of LLVM's PR adding `[[gnu::gcc_struct]]` support to Clang > (https://github.com/llvm/llvm-project/pull/71148), maintainers asked > me to make sure that whatever > is done there, makes sense for GCC too. > > To summarize the long discussion on GitHub, GCC supports gcc_struct, > ms_struct, and > `-m{no-,}ms-bitfields` only on X86, while Clang currently supports ms_struct > and > `-m{no-,}ms-bitfields` on all targets with Itanium C++ ABI. > Correspondingly, my PR adds support for > gcc_struct for all targets with the Itanium C++ ABI and paves the road > for gcc_struct and ms_struct > support on targets with Microsoft C++ ABI (mainly, > x86_64-pc-windows-msvc). There, I envision > `ms_struct` to be a no-op (just like `gcc_struct` is usually a no-op > with Itanium C++ ABI) and > `gcc_struct` to change layout of C structs (or fields within C++ > classes) to be compatible with the > GenericItanium C++ ABI. > > As far as I can tell, the maintainer's question is "in a theoretical > event GCC starts supporting > Microsoft C++ ABI, would it make sense to implement gcc_struct and > ms_struct on it just like I > propose to?".
Turns out that I wasn't quite right here about what John (@rjmccall) asked. Quoting him: "Right, I'd just like to make sure that we're not deepening a divergence here. It would be good to get agreement from the GCC devs that they think ms_struct probably ought to do something on e.g. ARM MinGW targets and that they consider this a bug (in a feature that they may not really support, which is fine). But if they think we're wrong and that this really should only have effect on x86, I would like to know that". I hope ARM MinGW target for GCC is much less far-fetched and I would actually get a reply from someone. > > Thanks, > Dan Klishch