qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 07/26] qapi: Fix generated code when flat union


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 07/26] qapi: Fix generated code when flat union has member 'kind'
Date: Tue, 4 Aug 2015 10:17:07 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 08/04/2015 03:17 AM, Markus Armbruster wrote:
> A flat union's tag member gets renamed to 'kind' in the generated
> code.  Breaks when another member is named 'kind' exists.

Too many verbs. Drop either 'is' or 'exists'.

> 
> Example, adapted from qapi-schema-test.json:
> 
>     { 'struct': 'UserDefUnionBase',
>       'data': { 'kind': 'str', 'enum1': 'EnumOne' } }
> 
> We generate:
> 
>     struct UserDefFlatUnion
>     {
>         EnumOne kind;
>         union {
>             void *data;
>             UserDefA *value1;
>             UserDefB *value2;
>             UserDefB *value3;
>         };
>         char *kind;
>     };
> 
> Kill the silly rename.
> 
> Reported-by: Eric Blake <address@hidden>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
>  scripts/qapi-types.py           | 3 ++-
>  scripts/qapi-visit.py           | 7 +++++--
>  tests/test-qmp-input-visitor.c  | 2 +-
>  tests/test-qmp-output-visitor.c | 2 +-
>  4 files changed, 9 insertions(+), 5 deletions(-)

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]