This attribute is not recognized by clang, but the associated option is.
Signed-off-by: Pierrick Bouvier <[email protected]>
---
meson.build | 8 ++++----
include/qemu/compiler.h | 7 +------
subprojects/libvhost-user/libvhost-user.h | 6 +-----
3 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/meson.build b/meson.build
index d8af08299e0..d0d5dbe1479 100644
--- a/meson.build
+++ b/meson.build
@@ -330,10 +330,10 @@ elif host_os == 'sunos'
elif host_os == 'haiku'
qemu_common_flags += ['-DB_USE_POSITIVE_POSIX_ERRORS', '-D_BSD_SOURCE',
'-fPIC']
elif host_os == 'windows'
- 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')
- endif
+ # https://gcc.gnu.org/onlinedocs/gcc/x86-Type-Attributes.html
+ # We use this compilation option instead of relying on gcc_struct attribute
+ # because clang does not support it (but supports the option).
+ qemu_common_flags += ['-mno-ms-bitfields']
endif
# Choose instruction set (currently x86-only)
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index c06954ccb41..d904408e5ed 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -22,12 +22,7 @@
#define QEMU_EXTERN_C extern
#endif
-#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
-# define QEMU_PACKED __attribute__((gcc_struct, packed))
-#else
-# define QEMU_PACKED __attribute__((packed))
-#endif
-
+#define QEMU_PACKED __attribute__((packed))
#define QEMU_ALIGNED(X) __attribute__((aligned(X)))
#ifndef glue
diff --git a/subprojects/libvhost-user/libvhost-user.h
b/subprojects/libvhost-user/libvhost-user.h
index deb40e77b3f..2ffc58c11b1 100644
--- a/subprojects/libvhost-user/libvhost-user.h
+++ b/subprojects/libvhost-user/libvhost-user.h
@@ -186,11 +186,7 @@ typedef struct VhostUserShared {
unsigned char uuid[UUID_LEN];
} VhostUserShared;
-#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
-# define VU_PACKED __attribute__((gcc_struct, packed))
-#else
-# define VU_PACKED __attribute__((packed))
-#endif
+#define VU_PACKED __attribute__((packed))
typedef struct VhostUserMsg {
int request;
--
2.39.5