qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH] qapi: Rename simple union's generated tag m


From: Eric Blake
Subject: Re: [Qemu-devel] [RFC PATCH] qapi: Rename simple union's generated tag member to type
Date: Thu, 8 Oct 2015 08:56:59 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 10/08/2015 06:26 AM, Markus Armbruster wrote:
> Struct and union type members are generally named alike in QMP and C,
> except for a simple union's implicit tag member, which is "type" in
> QMP, and "kind" in C.  Can't change QMP, so rename it in C.
> 
> Since the implicit enumeration type is still called *Kind, this
> doesn't clean up the type vs. kind mess completely.

Looks very similar to my v5 31/46

https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg05445.html

and still waiting for us to get that far into the reviews.

I guess pulling it earlier into the series is worth doing, if it will
help us avoid some hacks.

> 
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> +++ b/scripts/qapi-types.py
> @@ -135,10 +135,9 @@ struct %(c_name)s {
>      /* Own members: */
>  ''')
>      else:
> -        ret += mcgen('''
> -    %(c_type)s kind;
> -''',
> -                     c_type=c_name(variants.tag_member.type.name))
> +        ret += gen_struct_field(variants.tag_member.name,
> +                                variants.tag_member.type,
> +                                False);


Hmm, I hadn't even thought to use that. But it would require tweaks to
work with my pending change to alternates to use 'qtype_code', because
in that patch I intentionally left variants.tag_member.type as None (and
instead used variants.tag_member.c_type() to get the string 'qtype_code'):

https://lists.gnu.org/archive/html/qemu-devel/2015-10/msg01985.html


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