[Top][All Lists]

[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: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v3 2/4] compiler: rework BUG_ON using a struct
Date: Fri, 20 Jan 2017 08:44:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Eric Blake <address@hidden> writes:

> 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.

For what it's worth, I'd prefer a rewording.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]