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: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v8 06/26] qapi-types: Convert to QAPISchemaVisitor, fixing flat unions
Date: Fri, 18 Sep 2015 08:54:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Eric Blake <address@hidden> writes:

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

Can do.  Thanks!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]