[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: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3 2/4] compiler: rework BUG_ON using a struct |
Date: |
Thu, 19 Jan 2017 15:26:55 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 |
On 01/19/2017 03:07 PM, Michael S. Tsirkin wrote:
> There are theoretical concerns that some compilers might not trigger
> build failures on attempts to define an array of size -1 and make it a
> variable sized array instead.
Rather, the concern is that if someone changes code so that the 'x' of
QEMU_BUILD_BUG_ON(x) is no longer a compile time constant, we want a
compile-time failure rather than a runtime variable-sized array that may
or may not crash.
> Let rewrite using a struct with a negative
> bit field size instead as there are no dynamic bit field sizes. This is
> similar to what Linux does.
>
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
> include/qemu/compiler.h | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
I don't know if you want to tweak the commit wording, but I'm okay with
the patch itself.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
Re: [Qemu-devel] [PATCH v3 2/4] compiler: rework BUG_ON using a struct, Dr. David Alan Gilbert, 2017/01/20
[Qemu-devel] [PATCH v3 3/4] compiler: expression version of QEMU_BUILD_BUG_ON, Michael S. Tsirkin, 2017/01/19