On 08/04/2015 03:17 AM, Markus Armbruster wrote: > The struct generated for a flat union is weird: the members of its > base are at the end, except for the union tag, which is at the > beginning. >
> Change to put all base members at the beginning, unadulterated. Not
> only is this easier to understand, it also permits casting the flat
> union to its base, if that should become useful.
And I already have a followup patch to your RFCv3 where it IS useful :)
>
> We now generate:
>
> struct UserDefFlatUnion
> {
> /* Members inherited from UserDefUnionBase: */
> char *string;
> EnumOne enum1;
> /* Own members: */
> union { /* union tag is @enum1 */
> void *data;
> UserDefA *value1;
> UserDefB *value2;
> UserDefB *value3;
> };
> };
>
> Signed-off-by: Markus Armbruster <[email protected]>
> ---
> scripts/qapi-types.py | 38 ++++++++++++++++++++++----------------
> 1 file changed, 22 insertions(+), 16 deletions(-)
>
Reviewed-by: Eric Blake <[email protected]>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
