From: Andreas Grapentin <andreas@grapentin.org>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] use _Static_assert in QEMU_BUILD_BUG_ON
Date: Tue, 14 Mar 2017 19:38:34 +0100 [thread overview]
Message-ID: <20170314183834.GA23093@parabola-pocket> (raw)
In-Reply-To: <ddea3a8a-715e-c24d-e434-3fa55f5d81b2@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2413 bytes --]
The missing ! is because I generated the error messages by inverting the
condition and then forgot to change it back. I can send a v3 if you
like.
Thanks for being patient with me.
-A
On Tue, Mar 14, 2017 at 12:43:56PM -0500, Eric Blake wrote:
> On 03/14/2017 11:59 AM, Andreas Grapentin wrote:
> > QEMU_BUILD_BUG_ON should use C11's _Static_assert, if the compiler supports it,
> > to provide more readable messages on failure.
>
> >
> > with _Static_assert:
> >
> >> In file included from /qemu/include/qemu/osdep.h:36:0,
> >> from /qemu/qga/commands.c:13:
> >> /qemu/qga/commands.c: In function ‘qmp_guest_exec_status’:
> >> /qemu/include/qemu/compiler.h:94:30: error: static assertion failed: "not expecting: sizeof(*&gei->finished) > sizeof(void *)"
> >> #define QEMU_BUILD_BUG_ON(x) _Static_assert((x), #x)
>
> Manual copy-and-paste? Because this is missing the ! present in the
> actual definition...
>
> >> ^
> >> /qemu/include/qemu/atomic.h:146:5: note: in expansion of macro ‘QEMU_BUILD_BUG_ON’
> >> QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *)); \
> >> ^~~~~~~~~~~~~~~~~
> >> /qemu/include/qemu/atomic.h:417:5: note: in expansion of macro ‘atomic_load_acquire’
> >> atomic_load_acquire(ptr)
> >> ^~~~~~~~~~~~~~~~~~~
> >> /qemu/qga/commands.c:160:21: note: in expansion of macro ‘atomic_mb_read’
> >> bool finished = atomic_mb_read(&gei->finished);
> >> ^~~~~~~~~~~~~~
> >
> > Signed-off-by: Andreas Grapentin <andreas@grapentin.org>
> > ---
>
> > +++ b/include/qemu/compiler.h
> > @@ -90,7 +90,9 @@
> > int:(x) ? -1 : 1; \
> > }
> >
> > -#ifdef __COUNTER__
> > +#if defined(CONFIG_STATIC_ASSERT)
> > +#define QEMU_BUILD_BUG_ON(x) _Static_assert(!(x), "not expecting: " #x)
>
> ...here.
>
> But that's trivial, if the maintainer would like to correct the commit
> message.
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
>
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
--
------------------------------------------------------------------------------
my GPG Public Key: https://files.grapentin.org/.gpg/public.key
------------------------------------------------------------------------------
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2017-03-14 18:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-14 16:59 [Qemu-devel] [PATCH v2] use _Static_assert in QEMU_BUILD_BUG_ON Andreas Grapentin
2017-03-14 17:43 ` Eric Blake
2017-03-14 18:38 ` Andreas Grapentin [this message]
2017-03-14 22:02 ` Richard Henderson
2017-04-23 17:24 ` Michael Tokarev
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=20170314183834.GA23093@parabola-pocket \
--to=andreas@grapentin.org \
--cc=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.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 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).