Contributors are repeatedly sending patches to remove the blockage of clang on Windows, ignoring that we need 'gcc_struct' support. Put some more explicit comments in the code to discourage people from doing this.
Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> --- include/qemu/compiler.h | 7 +++++++ meson.build | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index c06954ccb4..38ed8997ca 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -22,6 +22,13 @@ #define QEMU_EXTERN_C extern #endif +/* + * QEMU requires 'gcc_struct' on Windows for correct guest ABI. + * meson.build checks for 'gcc_struct' and blocks use of CLang + * on Windows, pending a fix for: + * + * https://github.com/llvm/llvm-project/issues/24757 + */ #if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__)) # define QEMU_PACKED __attribute__((gcc_struct, packed)) #else diff --git a/meson.build b/meson.build index 2c9086a3fe..37b7daa758 100644 --- a/meson.build +++ b/meson.build @@ -330,9 +330,18 @@ elif host_os == 'sunos' elif host_os == 'haiku' qemu_common_flags += ['-DB_USE_POSITIVE_POSIX_ERRORS', '-D_BSD_SOURCE', '-fPIC'] elif host_os == 'windows' + # Clang is blocked, pending impl of 'gcc_struct' support: + # + # https://gitlab.com/qemu-project/qemu/-/issues/2476 + # https://github.com/llvm/llvm-project/issues/24757 + # https://github.com/llvm/llvm-project/pull/71148 + # + # Once the above is available this check should "do the right thing". + # This check can then eventually be removed once the CLang minimum + # version checked 50 lines earlier guarantees support if not compiler.compiles('struct x { int y; } __attribute__((gcc_struct));', args: '-Werror') - error('Your compiler does not support __attribute__((gcc_struct)) - please use GCC instead of Clang') + error('Your compiler does not support __attribute__((gcc_struct)) - please use GCC instead of Clang (https://github.com/llvm/llvm-project/issues/24757)') endif endif -- 2.46.0