Re: [Qemu-devel] [PATCH RFC v2 27/47] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

2015-07-29 Thread Eric Blake
On 07/29/2015 02:00 AM, Markus Armbruster wrote: We don't have any code that demonstrates this, but probably should. I ran into it while working up my POC of what it would take to unbox inherited structs (http://thread.gmane.org/gmane.comp.emulators.qemu/353204) >>> >>> Is thi

Re: [Qemu-devel] [PATCH RFC v2 27/47] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

2015-07-29 Thread Markus Armbruster
Eric Blake writes: > On 07/28/2015 12:44 AM, Markus Armbruster wrote: > >>> +def gen_visit_union(name, base, variants): +ret = '' if base: -assert discriminator -base_fields = find_struct(base)['data'].copy() -del base_fields[d

Re: [Qemu-devel] [PATCH RFC v2 27/47] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

2015-07-29 Thread Markus Armbruster
Eric Blake writes: > On 07/28/2015 12:41 AM, Markus Armbruster wrote: >>> Like reserving ourselves a namespace based on single _ for internal use. >>> We practically already have that - all user names either start with a >>> letter or double underscore, so we could use single (and triple) >>> un

Re: [Qemu-devel] [PATCH RFC v2 27/47] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

2015-07-28 Thread Eric Blake
On 07/28/2015 12:44 AM, Markus Armbruster wrote: >> >>> +def gen_visit_union(name, base, variants): >>> +ret = '' >>> >>> if base: >>> -assert discriminator >>> -base_fields = find_struct(base)['data'].copy() >>> -del base_fields[discriminator] >>> -ret +

Re: [Qemu-devel] [PATCH RFC v2 27/47] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

2015-07-28 Thread Eric Blake
On 07/28/2015 12:41 AM, Markus Armbruster wrote: >> Like reserving ourselves a namespace based on single _ for internal use. >> We practically already have that - all user names either start with a >> letter or double underscore, so we could use single (and triple) >> underscore for internally-gen

Re: [Qemu-devel] [PATCH RFC v2 27/47] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

2015-07-27 Thread Markus Armbruster
Eric Blake writes: > On 07/01/2015 02:22 PM, Markus Armbruster wrote: >> Fixes flat unions to visit the base's base members (the previous >> commit merely added them to the struct). Same test case. >> >> Patch's effect on visit_type_UserDefFlatUnion(): >> >> static void visit_type_UserDef

Re: [Qemu-devel] [PATCH RFC v2 27/47] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

2015-07-27 Thread Markus Armbruster
Eric Blake writes: > On 07/27/2015 11:53 AM, Markus Armbruster wrote: > >>> Oh, and that means our generator has a collision bug that none of my >>> added tests have exposed yet: you cannot have a base class and >>> simultaneously add a member named 'base': >>> >>> { 'struct': 'Base', 'data': { '

Re: [Qemu-devel] [PATCH RFC v2 27/47] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

2015-07-27 Thread Eric Blake
On 07/01/2015 02:22 PM, Markus Armbruster wrote: > Fixes flat unions to visit the base's base members (the previous > commit merely added them to the struct). Same test case. > > Patch's effect on visit_type_UserDefFlatUnion(): > > static void visit_type_UserDefFlatUnion_fields(Visitor *m,

Re: [Qemu-devel] [PATCH RFC v2 27/47] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

2015-07-27 Thread Eric Blake
On 07/27/2015 11:53 AM, Markus Armbruster wrote: >> Oh, and that means our generator has a collision bug that none of my >> added tests have exposed yet: you cannot have a base class and >> simultaneously add a member named 'base': >> >> { 'struct': 'Base', 'data': { 'i': 'int' } } >> { 'struct':

Re: [Qemu-devel] [PATCH RFC v2 27/47] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

2015-07-27 Thread Markus Armbruster
Eric Blake writes: > On 07/01/2015 02:22 PM, Markus Armbruster wrote: >> Fixes flat unions to visit the base's base members (the previous >> commit merely added them to the struct). Same test case. >> >> Patch's effect on visit_type_UserDefFlatUnion(): >> >> static void visit_type_UserDef

Re: [Qemu-devel] [PATCH RFC v2 27/47] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

2015-07-22 Thread Eric Blake
On 07/01/2015 02:22 PM, Markus Armbruster wrote: > Fixes flat unions to visit the base's base members (the previous > commit merely added them to the struct). Same test case. > > Patch's effect on visit_type_UserDefFlatUnion(): > > static void visit_type_UserDefFlatUnion_fields(Visitor *m,

[Qemu-devel] [PATCH RFC v2 27/47] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs

2015-07-01 Thread Markus Armbruster
Fixes flat unions to visit the base's base members (the previous commit merely added them to the struct). Same test case. Patch's effect on visit_type_UserDefFlatUnion(): static void visit_type_UserDefFlatUnion_fields(Visitor *m, UserDefFlatUnion **obj, Error **errp) { Error