qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] QEMU_BUILD_BUG_ON: use __COUNTER__


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH] QEMU_BUILD_BUG_ON: use __COUNTER__
Date: Tue, 31 Jan 2017 19:43:31 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

"Daniel P. Berrange" <address@hidden> writes:

> On Tue, Jan 31, 2017 at 04:43:52PM +0200, Michael S. Tsirkin wrote:
>> Some headers use QEMU_BUILD_BUG_ON. This causes a problem
>> if the C file including that header happens to have
>> QEMU_BUILD_BUG_ON at the same line number.
>
> Do we actually hit this problem in practice ?  Even if we do hit the
> problem, it surely has a trivial workaround of just inserting/removing
> a blank line somewhere in the file before the QEMU_BUILD_BUG_ON.
>
> IOW, is it really a benefit to change to use COUNTER, given that it is
> less portable that what we have today ?

__COUNTER__ is the best solution I've seen so far.

The proposed fallback for compilers lacking __COUNTER__ is not quite
correct, but it's relatively unlikely to break, and I'm vanishingly
unlikely to compile with such an old compiler ever again, so I'm okay
with it.  I'd also be okay with making __COUNTER__ support a hard
requirement.

I guess that means:
Reviewed-by: Markus Armbruster <address@hidden>



reply via email to

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