qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions
Date: Wed, 29 Jul 2015 14:15:01 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 07/29/2015 01:33 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
> 
>> On 07/01/2015 02:21 PM, Markus Armbruster wrote:
>>> The struct generated for a flat union is weird: the members of its
>>> base are at the end, except for the union tag, which is renamed to
>>> 'kind' and put at the beginning.
>>

>> Therefore, it might be worth mentioning that avoiding the rename to
>> 'kind' is a bug fix, not just a nicer struct :)
> 
> Cool!  I'll work (a variation of) this test case into my series.

Another name collision bug: our code generates flat unions as:

struct BlockdevOptions {
    BlockdevDriver driver;
...
    /* End fields inherited from BlockdevOptionsBase. */
    /* union tag is BlockdevDriver driver */
    union {
        void *data;
        BlockdevOptionsArchipelago *archipelago;
...

which means that if we name any of the branches 'data' (that is, if
'data' is a member of the enum discriminator), things fail to compile.
We could probably fix that by naming our dummy branch '_data'.

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