From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adKJQ-0005a9-Pd for qemu-devel@nongnu.org; Tue, 08 Mar 2016 11:16:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adKJP-0004dH-ME for qemu-devel@nongnu.org; Tue, 08 Mar 2016 11:16:44 -0500 References: <1457194595-16189-1-git-send-email-eblake@redhat.com> <1457194595-16189-8-git-send-email-eblake@redhat.com> <87y49t55ae.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <56DEFAE3.7040704@redhat.com> Date: Tue, 8 Mar 2016 09:16:35 -0700 MIME-Version: 1.0 In-Reply-To: <87y49t55ae.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rtK5QtDLTb9wFXovT06MItt3m3nN3Q1j2" Subject: Re: [Qemu-devel] [PATCH v4 07/10] qapi: Don't special-case simple union wrappers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Kevin Wolf , Fam Zheng , Eduardo Habkost , "open list:Block layer core" , "Michael S. Tsirkin" , Michael Roth , Jan Kiszka , Jason Wang , qemu-devel@nongnu.org, Vincenzo Maffione , Luiz Capitulino , Gerd Hoffmann , Paolo Bonzini , Igor Mammedov , Giuseppe Lettieri , Luigi Rizzo , Samuel Thibault This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --rtK5QtDLTb9wFXovT06MItt3m3nN3Q1j2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/08/2016 08:59 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> Simple unions were carrying a special case that hid their 'data' >> QMP member from the resulting C struct, via the hack method >> QAPISchemaObjectTypeVariant.simple_union_type(). But by using >> the work we started by unboxing flat union and alternate >> branches, coupled with the ability to visit the members of an >> implicit type, we can now expose the simple union's implicit >> type in qapi-types.h: >> >> +++ b/scripts/qapi.py >> @@ -1006,7 +1006,6 @@ class QAPISchemaObjectType(QAPISchemaType): >> return c_name(self.name) + pointer_suffix >> >> def c_unboxed_type(self): >> - assert not self.is_implicit() >=20 > Doesn't this belong into PATCH 04? >=20 >> return c_name(self.name) Maybe. Patch 3 kept the assertion out of straight code refactoring, and patch 4 didn't use c_unboxed_type(), so this was the first place where I had to weaken the assertion. But moving it into patch 4 doesn't seem like it would hurt, as it is still semantically related to the fact that we are planning on allowing an unboxed implicit type. >> - visit_type_%(c_type)s_members(v, &obj->u.%(c_name)s, &err); >> -''', >> - c_type=3Dvar.type.c_name(), >> - c_name=3Dc_name(var.name)) >> - ret +=3D mcgen(''' >> - break; >> -''') >> + variants.tag_member.type.p= refix), >> + c_type=3Dvar.type.c_name(), c_name=3Dc_name(= var.name)) >> >> ret +=3D mcgen(''' >> default: >=20 > This stupid special case has given us enough trouble, good to see it > gone! Yeah, it was a nice feeling to get to this point! --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --rtK5QtDLTb9wFXovT06MItt3m3nN3Q1j2 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/ iQEcBAEBCAAGBQJW3vrkAAoJEKeha0olJ0NqGzgH/3lPqpsywynJBd+amLM0wre+ EN3Pnl8bJsRmLdwuI+XcHt80dz86xWlYY7Eio/91XCvVB5yHziyZZi4qv/3aC/N/ TmKFqiqecis0g3rMXRj5v+PoZSo7T/JpMQaIlb08c/QFjalCiAq3QDgSR00qShlH hcnXpQA6aLVAkc6OVOcZAyeqQwp/FiKc8aQbkszgySJW+aHbP2t+N8pjB/c5jMRp xNMOWvrh2fBRt3z/lg6W+/JQfRpFyzI/AEOsdjcgwyqg/ScLj68jQ990U9G6/E9U HcpF5aa/eKTK+DpXiTaZDCioEDhcxMal2oJ8eBoJDV9dIF+9YiIXe9ZVblGTG/U= =D5hC -----END PGP SIGNATURE----- --rtK5QtDLTb9wFXovT06MItt3m3nN3Q1j2--