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