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: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] QEMU_BUILD_BUG_ON: use __COUNTER__
Date: Tue, 31 Jan 2017 12:58:15 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

On 01/31/2017 12:43 PM, Markus Armbruster wrote:
> "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.

Making it a hard requirement is as simple as:

#if !defined __COUNTER__ || __COUNTER__ == __COUNTER__
#error Upgrade your compiler
#endif

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

Since the v4 pull request was botched, if you'd like to add R-b for the
v5 pull request, you can also add

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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