qemu-devel
[Top][All Lists]
Advanced

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

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


From: Michael Roth
Subject: Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union
Date: Fri, 12 Sep 2014 11:17:20 -0500
User-agent: alot/0.3.4

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
> > cause the output visitor to bail, when really it should just be left to
> > continue on serializing the integer.
> 
> In the case of dealloc, that'd be okay because the dealloc visit would
> do nothing for KIND_A, right?

Yup that should be fine for the dealloc visitor. With this series we never
actually visit the int in this case though due to this quirk. But that's
okay because it's not an allocated type and the dealloc visitor doesn't need
to do anything anyway. (It's a bit wonky, but since that reliance on
implementation details now lives in the visitor implementation of
visit_start_union it's reasonably contained at least)

But if we're looking at extending visit_start_union for use in something like
an output visitor, this would need to be addressed some other way, since
skipping scalar fields because they're 0 is a bug there.

> 
> Paolo




reply via email to

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