[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 2/4] compiler: rework BUG_ON using a struct
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [Qemu-devel] [PATCH v3 2/4] compiler: rework BUG_ON using a struct |
Date: |
Fri, 20 Jan 2017 14:53:38 +0000 |
User-agent: |
Mutt/1.7.1 (2016-10-04) |
* Eric Blake (address@hidden) wrote:
> On 01/20/2017 03:41 AM, Dr. David Alan Gilbert wrote:
>
> >> -#define QEMU_BUILD_BUG_ON(x) \
> >> - typedef char glue(qemu_build_bug_on__, __LINE__)[(x) ? -1 : 1] \
> >> - __attribute__((unused))
> >> +#define QEMU_BUILD_BUG_ON_STRUCT(x) \
> >> + struct { \
> >> + int qemu_build_bug_on : (x) ? -1 : 1; \
> >> + }
> >
> > The problem with this is it can't be used as an expression, where as
> > your previous version could.
> > I've got a similar case (see previous reply) that needed an expression
> > bug-on that would evaluate to zero.
>
> Keep reading the series - the version usable in an expression is
> QEMU_BUILD_BUG_ON_ZERO, introduced in 3/4. Patch 2/4 is just rewriting
> the existing check, with no change in the fact that it is still a
> declaration.
Ah hmm, yeh that's OK.
Dave
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK
Re: [Qemu-devel] [PATCH v3 0/4] ARRAY_SIZE fixups, Markus Armbruster, 2017/01/20
Re: [Qemu-devel] [PATCH v3 0/4] ARRAY_SIZE fixups, no-reply, 2017/01/20