Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union

2014-09-12 Thread Michael Roth
Quoting Paolo Bonzini (2014-09-12 11:29:46) > Il 12/09/2014 18:17, Michael Roth ha scritto: > > Quoting Paolo Bonzini (2014-09-12 10:39:49) > >> Il 12/09/2014 17:34, Michael Roth ha scritto: > >>> > >>> { 'union': 'UserDefUnion', > >>> 'base': 'UserDefZero', > >>> 'data': { 'a' : 'int', 'b' : '

Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union

2014-09-12 Thread Paolo Bonzini
Il 12/09/2014 18:17, Michael Roth ha scritto: > Quoting Paolo Bonzini (2014-09-12 10:39:49) >> Il 12/09/2014 17:34, Michael Roth ha scritto: >>> >>> { 'union': 'UserDefUnion', >>> 'base': 'UserDefZero', >>> 'data': { 'a' : 'int', 'b' : 'UserDefB' } } >>> >>> If UserDefUnion.a is 0, UserDefUnion

Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union

2014-09-12 Thread Michael Roth
Quoting Paolo Bonzini (2014-09-12 10:39:49) > Il 12/09/2014 17:34, Michael Roth ha scritto: > > > > { 'union': 'UserDefUnion', > > 'base': 'UserDefZero', > > 'data': { 'a' : 'int', 'b' : 'UserDefB' } } > > > > If UserDefUnion.a is 0, UserDefUnion.data will cast it to a NULL value and > > caus

Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union

2014-09-12 Thread Paolo Bonzini
Il 12/09/2014 17:34, Michael Roth ha scritto: > > { 'union': 'UserDefUnion', > 'base': 'UserDefZero', > 'data': { 'a' : 'int', 'b' : 'UserDefB' } } > > If UserDefUnion.a is 0, UserDefUnion.data will cast it to a NULL value and > cause the output visitor to bail, when really it should just be

Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union

2014-09-12 Thread Michael Roth
Quoting Paolo Bonzini (2014-09-12 05:17:12) > Il 12/09/2014 01:20, Michael Roth ha scritto: > > In some cases an input visitor might bail out on filling out a > > struct for various reasons, such as missing fields when running > > in strict mode. In the case of a QAPI Union type, this may lead > >

Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union

2014-09-12 Thread Michael Roth
Quoting Eric Blake (2014-09-11 21:29:24) > On 09/11/2014 05:20 PM, Michael Roth wrote: > > In some cases an input visitor might bail out on filling out a > > struct for various reasons, such as missing fields when running > > in strict mode. In the case of a QAPI Union type, this may lead > > to ca

Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union

2014-09-12 Thread Paolo Bonzini
Il 12/09/2014 01:20, Michael Roth ha scritto: > In some cases an input visitor might bail out on filling out a > struct for various reasons, such as missing fields when running > in strict mode. In the case of a QAPI Union type, this may lead > to cases where the .kind field which encodes the union

Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union

2014-09-11 Thread Eric Blake
On 09/11/2014 05:20 PM, Michael Roth wrote: > In some cases an input visitor might bail out on filling out a > struct for various reasons, such as missing fields when running > in strict mode. In the case of a QAPI Union type, this may lead > to cases where the .kind field which encodes the union t

[Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union

2014-09-11 Thread Michael Roth
In some cases an input visitor might bail out on filling out a struct for various reasons, such as missing fields when running in strict mode. In the case of a QAPI Union type, this may lead to cases where the .kind field which encodes the union type is uninitialized. Subsequently, other visitors,