qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v8 06/26] qapi-types: Convert to QAPISchemaVisit


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v8 06/26] qapi-types: Convert to QAPISchemaVisitor, fixing flat unions
Date: Thu, 17 Sep 2015 11:00:50 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

On 09/16/2015 05:06 AM, Markus Armbruster wrote:
> Fixes flat unions to get the base's base members.  Test case is from
> commit 2fc0043, in qapi-schema-test.json:
> 
>     { 'union': 'UserDefFlatUnion',
>       'base': 'UserDefUnionBase',
>       'discriminator': 'enum1',
>       'data': { 'value1' : 'UserDefA',
>                 'value2' : 'UserDefB',
>                 'value3' : 'UserDefB' } }
> 
>     { 'struct': 'UserDefUnionBase',
>       'base': 'UserDefZero',
>       'data': { 'string': 'str', 'enum1': 'EnumOne' } }
> 
>     { 'struct': 'UserDefZero',
>       'data': { 'integer': 'int' } }
> 
> Patch's effect on UserDefFlatUnion:
> 
>      struct UserDefFlatUnion {
>          /* Members inherited from UserDefUnionBase: */
>     +    int64_t integer;
>          char *string;

There is another change not listed here.  When you were developing with
scaffolding patches, you split the 'typedef struct UserDefFlatUnion {'
into two lines in that patch, and then the diff seen by this patch when
generating the commit message didn't see anything change.  But now that
you reverted the scaffolding out of the series, it is now THIS patch
that is converting from inline:

typedef struct UserDefFlatUnion {
...
} UserDefFlatUnion;

to the separate:

typedef struct UserDefFlatUnion;
...
struct UserDefFlatUnion {
...
};


> -def generate_fwd_struct(name):
> +def gen_fwd_object_or_array(name):
>      return mcgen('''
>  
>  typedef struct %(name)s %(name)s;
> -
> -typedef struct %(name)sList {
> -    union {
> -        %(name)s *value;
> -        uint64_t padding;
> -    };
> -    struct %(name)sList *next;
> -} %(name)sList;
>  ''',
>                   name=c_name(name))
>  
> -def generate_fwd_enum_struct(name):
> +def gen_array(name, element_type):
>      return mcgen('''
>  
> -typedef struct %(name)sList {
> +struct %(name)s {

My R-b still stands, but it would be nice to update this commit message
to reflect that this change was intentional.

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