Skip to content

meson: Include -Wno-incompatible-ms-struct in cflags whenever -mms-bitfields is included

Clang gives fatal errors when compiling nontrivial C++ classes, if the -mms-bitfields flag is passed (as this flag requests struct layout compatibility with MSVC, while the C++ ABI is incompatible).

Glib itself doesn't trigger this warning, but glib places the -mms-bitfields flag in the cflags of the generated pkg-config file, breaking compilation for users of the library that use it from C++.

This requires passing the -Wno-incompatible-ms-struct flag in the pkg-config file along with -mms-bitfields, but this flag is only understood by Clang - making the installed pkg-config file usable only by the same compiler that built glib itself.

Not sure if this is exactly ideal, or if there's better workarounds - but posting it as an RFC at least. It at least fixes the case when glib is compiled and used by the same compiler, but won't help for cases where multiple different compilers are involved.

Merge request reports