Skip to content

Commit 8f5a4cf

Browse files
pbo-linarostsquad
authored andcommitted
win32: remove usage of attribute gcc_struct
This attribute is not recognized by clang. An investigation has been performed to ensure this attribute has no effect on layout of structures we use in QEMU [1], so it's safe to remove now. In the future, we'll forbid introducing new bitfields in packed struct, as they are the one potentially impacted by this change. [1] https://lore.kernel.org/qemu-devel/[email protected]/ Reviewed-by: Thomas Huth <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Acked-by: Stefano Garzarella <[email protected]> Signed-off-by: Pierrick Bouvier <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Tested-by: Stefan Weil <[email protected]> Tested-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Message-Id: <[email protected]>
1 parent 27f347e commit 8f5a4cf

File tree

4 files changed

+3
-21
lines changed

4 files changed

+3
-21
lines changed

include/qemu/compiler.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@
2222
#define QEMU_EXTERN_C extern
2323
#endif
2424

25-
#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
26-
# define QEMU_PACKED __attribute__((gcc_struct, packed))
27-
#else
28-
# define QEMU_PACKED __attribute__((packed))
29-
#endif
30-
25+
#define QEMU_PACKED __attribute__((packed))
3126
#define QEMU_ALIGNED(X) __attribute__((aligned(X)))
3227

3328
#ifndef glue

meson.build

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,6 @@ elif host_os == 'sunos'
377377
qemu_common_flags += '-D__EXTENSIONS__'
378378
elif host_os == 'haiku'
379379
qemu_common_flags += ['-DB_USE_POSITIVE_POSIX_ERRORS', '-D_BSD_SOURCE', '-fPIC']
380-
elif host_os == 'windows'
381-
if not compiler.compiles('struct x { int y; } __attribute__((gcc_struct));',
382-
args: '-Werror')
383-
error('Your compiler does not support __attribute__((gcc_struct)) - please use GCC instead of Clang')
384-
endif
385380
endif
386381

387382
# Choose instruction set (currently x86-only)

scripts/cocci-macro-file.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@
2323
#define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
2424
#define G_GNUC_NULL_TERMINATED __attribute__((sentinel))
2525

26-
#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
27-
# define QEMU_PACKED __attribute__((gcc_struct, packed))
28-
#else
29-
# define QEMU_PACKED __attribute__((packed))
30-
#endif
26+
#define QEMU_PACKED __attribute__((packed))
3127

3228
#define cat(x,y) x ## y
3329
#define cat2(x,y) cat(x,y)

subprojects/libvhost-user/libvhost-user.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,7 @@ typedef struct VhostUserShared {
186186
unsigned char uuid[UUID_LEN];
187187
} VhostUserShared;
188188

189-
#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
190-
# define VU_PACKED __attribute__((gcc_struct, packed))
191-
#else
192-
# define VU_PACKED __attribute__((packed))
193-
#endif
189+
#define VU_PACKED __attribute__((packed))
194190

195191
typedef struct VhostUserMsg {
196192
int request;

0 commit comments

Comments
 (0)