From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMfew-0000DM-KY for qemu-devel@nongnu.org; Tue, 04 Aug 2015 13:05:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZMfet-0005PS-Ct for qemu-devel@nongnu.org; Tue, 04 Aug 2015 13:05:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46295) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMfet-0005PI-6k for qemu-devel@nongnu.org; Tue, 04 Aug 2015 13:05:47 -0400 References: <1438679896-5077-1-git-send-email-armbru@redhat.com> <1438679896-5077-9-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55C0EFA5.7080605@redhat.com> Date: Tue, 4 Aug 2015 11:00:21 -0600 MIME-Version: 1.0 In-Reply-To: <1438679896-5077-9-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qtxlRSKJWqHnMFOeOiJP8rL9UiwjxnT6K" Subject: Re: [Qemu-devel] [PATCH 08/26] qapi: Generate a nicer struct for flat unions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --qtxlRSKJWqHnMFOeOiJP8rL9UiwjxnT6K Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > 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 :) >=20 > We now generate: >=20 > 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; > }; > }; >=20 > Signed-off-by: Markus Armbruster > --- > scripts/qapi-types.py | 38 ++++++++++++++++++++++---------------- > 1 file changed, 22 insertions(+), 16 deletions(-) >=20 Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --qtxlRSKJWqHnMFOeOiJP8rL9UiwjxnT6K Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVwO+lAAoJEKeha0olJ0Nq/vkH/1uXnOnOHOYKoUM4BTifqzpf d9PDyDY8cZnXc/OGLD9bMefK2vOeSytYV0vPZoqq+nypUp0I6S2eW2DxHYt1tOlo qk1CQ/buK9mTAirk1qmOUQ7uU7WcNUazkI33izN2EPR9gdqfrRq14rKjPAenAJKo yaL+uo1c6AMiIyfDv93unRSYRWgcgf3c6cMMR9gqlPF1InwQYo5XvCDgsUUqOPFx DlLNHWDdXYQ6szK0SMJWdDutW/ZzGRUin2QuT3o0cpO3ZBqPhGDTaJGGNpQ/tpQd /gTXScmuCnw/X8h1m19HV5pUIQa02KSuL0FD+SwuA7av9pajmjXZ2WlvP074HeI= =8EHt -----END PGP SIGNATURE----- --qtxlRSKJWqHnMFOeOiJP8rL9UiwjxnT6K--