From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Cc: qemu-devel@nongnu.org,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
xen-devel@lists.xenproject.org,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Anthony PERARD" <anthony@xenproject.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Stefano Stabellini" <sstabellini@kernel.org>
Subject: Re: [PATCH 2/2] qom/object: Remove pre-C11 check
Date: Mon, 15 Jun 2026 07:05:32 +0200 [thread overview]
Message-ID: <87h5n4tmub.fsf@pond.sub.org> (raw)
In-Reply-To: <20260613175151.1357-3-philmd@oss.qualcomm.com> ("Philippe Mathieu-Daudé"'s message of "Sat, 13 Jun 2026 19:51:51 +0200")
Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> writes:
> We mandate a compiler supporting C11 since 2021-06-15 in
> commit d22797ce36a ("configure: Use -std=gnu11"), thus the
> max_align_t type definition exists. Remove what is now dead
> code.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
> qom/object.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/qom/object.c b/qom/object.c
> index 0ac201de4c1..f79b2cf3618 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -675,18 +675,6 @@ static void object_finalize(void *data)
> }
> }
>
> -/* Find the minimum alignment guaranteed by the system malloc. */
> -#if __STDC_VERSION__ >= 201112L
> -typedef max_align_t qemu_max_align_t;
> -#else
> -typedef union {
> - long l;
> - void *p;
> - double d;
> - long double ld;
> -} qemu_max_align_t;
> -#endif
> -
> static Object *object_new_with_type(Type type)
> {
> Object *obj;
> @@ -703,7 +691,7 @@ static Object *object_new_with_type(Type type)
> * Do not use qemu_memalign unless required. Depending on the
> * implementation, extra alignment implies extra overhead.
> */
> - if (likely(align <= __alignof__(qemu_max_align_t))) {
> + if (likely(align <= __alignof__(max_align_t))) {
> obj = g_malloc(size);
> obj_free = g_free;
> } else {
obj = qemu_memalign(align, size);
obj_free = qemu_vfree;
}
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Context leads me to qemu_try_memalign() via qemu_memalign():
#elif defined(CONFIG_ALIGNED_MALLOC)
ptr = _aligned_malloc(size, alignment);
#elif defined(CONFIG_VALLOC)
ptr = valloc(size);
#elif defined(CONFIG_MEMALIGN)
ptr = memalign(alignment, size);
#else
#error No function to allocate aligned memory available
#endif
C11 provides aligned_alloc().
prev parent reply other threads:[~2026-06-15 5:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-13 17:51 [PATCH 0/2] misc: Remove pre-C99/C11 checks Philippe Mathieu-Daudé
2026-06-13 17:51 ` [PATCH 1/2] hw/xen/interface: Remove pre-C99 checks Philippe Mathieu-Daudé
2026-06-13 18:13 ` Bastian Blank
2026-06-14 16:40 ` Philippe Mathieu-Daudé
2026-06-13 17:51 ` [PATCH 2/2] qom/object: Remove pre-C11 check Philippe Mathieu-Daudé
2026-06-15 5:05 ` Markus Armbruster [this message]
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=87h5n4tmub.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=anthony@xenproject.org \
--cc=berrange@redhat.com \
--cc=edgar.iglesias@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.