qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Cc: qemu-devel@nongnu.org, "Mahmoud Mandour" <ma.mandourr@gmail.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Stefano Garzarella" <sgarzare@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Alexandre Iooss" <erdnaxe@crans.org>,
	"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: [PATCH v4 1/3] win32: remove usage of attribute gcc_struct
Date: Mon, 13 Jan 2025 18:38:23 -0500	[thread overview]
Message-ID: <20250113183102-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20250110203401.178532-2-pierrick.bouvier@linaro.org>

On Fri, Jan 10, 2025 at 12:33:59PM -0800, Pierrick Bouvier wrote:
> 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/66c346de-7e20-4831-b3eb-1cda83240af9@linaro.org/
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Acked-by: Stefano Garzarella <sgarzare@redhat.com>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>  meson.build                               | 5 -----
>  include/qemu/compiler.h                   | 7 +------
>  scripts/cocci-macro-file.h                | 6 +-----
>  subprojects/libvhost-user/libvhost-user.h | 6 +-----
>  4 files changed, 3 insertions(+), 21 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index d06f59095c6..da279cc1124 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -377,11 +377,6 @@ elif host_os == 'sunos'
>    qemu_common_flags += '-D__EXTENSIONS__'
>  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
>  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/scripts/cocci-macro-file.h b/scripts/cocci-macro-file.h
> index d247a5086e9..c64831d5408 100644
> --- a/scripts/cocci-macro-file.h
> +++ b/scripts/cocci-macro-file.h
> @@ -23,11 +23,7 @@
>  #define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
>  #define G_GNUC_NULL_TERMINATED __attribute__((sentinel))
>  
> -#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 cat(x,y) x ## y
>  #define cat2(x,y) cat(x,y)
> 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;



Acked-by: Michael S. Tsirkin <mst@redhat.com>

> -- 
> 2.39.5



  reply	other threads:[~2025-01-13 23:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-10 20:33 [PATCH v4 0/3] Enable clang build on Windows Pierrick Bouvier
2025-01-10 20:33 ` [PATCH v4 1/3] win32: remove usage of attribute gcc_struct Pierrick Bouvier
2025-01-13 23:38   ` Michael S. Tsirkin [this message]
2025-01-10 20:34 ` [PATCH v4 2/3] docs/devel/style: add a section about bitfield, and disallow them for packed structures Pierrick Bouvier
2025-01-10 20:34 ` [PATCH v4 3/3] plugins: enable linking with clang/lld Pierrick Bouvier
2025-01-10 20:37 ` [PATCH v4 0/3] Enable clang build on Windows Pierrick Bouvier
2025-01-11 15:47   ` Philippe Mathieu-Daudé
2025-01-12 18:03     ` Philippe Mathieu-Daudé
2025-01-13  6:26     ` Thomas Huth
2025-01-13 20:17       ` Pierrick Bouvier
2025-01-13 21:19         ` Alex Bennée
2025-01-13 21:22           ` Pierrick Bouvier
2025-01-11 22:08 ` Stefan Weil via
2025-01-12 17:54   ` Pierrick Bouvier
2025-02-18  4:11   ` Brian Cain
2025-02-18 16:22     ` Pierrick Bouvier
2025-02-18 16:26       ` Daniel P. Berrangé
2025-02-18 20:59       ` Stefan Weil via
2025-02-18 23:17         ` Pierrick Bouvier
2025-02-19  6:39           ` Stefan Weil via
2025-02-19  7:01             ` Pierrick Bouvier
2025-02-19  7:38               ` Stefan Weil via
2025-01-14  8:20 ` Alex Bennée
2025-01-14  8:35   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250113183102-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=erdnaxe@crans.org \
    --cc=ma.mandourr@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sgarzare@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).