From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWRo2-0002kL-OZ for qemu-devel@nongnu.org; Thu, 18 Feb 2016 11:51:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWRo0-0007ly-V5 for qemu-devel@nongnu.org; Thu, 18 Feb 2016 11:51:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48761) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWRo0-0007ld-Nd for qemu-devel@nongnu.org; Thu, 18 Feb 2016 11:51:52 -0500 References: <1455582057-27565-1-git-send-email-eblake@redhat.com> <1455582057-27565-12-git-send-email-eblake@redhat.com> <877fi3s03p.fsf@blackfin.pond.sub.org> <56C4DDDC.5070408@redhat.com> <87h9h6l7uz.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <56C5F6A7.5050102@redhat.com> Date: Thu, 18 Feb 2016 09:51:51 -0700 MIME-Version: 1.0 In-Reply-To: <87h9h6l7uz.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VkNmAU2bmgH1pxwqqtbL73BJ5VIpIj8ai" Subject: Re: [Qemu-devel] [PATCH v10 11/13] qapi: Don't box branches of flat unions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Peter Crosthwaite , qemu-devel@nongnu.org, Michael Roth , Luiz Capitulino , Paolo Bonzini , Richard Henderson This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --VkNmAU2bmgH1pxwqqtbL73BJ5VIpIj8ai Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/18/2016 01:51 AM, Markus Armbruster wrote: >> It gets renamed to is_unboxed after the review on 10/13. But even aft= er >> my patch to convert simple unions, this code will still be >> c_type=3Dtyp.c_type(is_unboxed=3DTrue), unless I figure out a way to r= ework >> .c_type() to not need two separate boolean flags for the three differe= nt >> contexts in which we use a type name (declaring an unboxed member to a= >> struct, declaring a local variable, and declaring a const parameter). >=20 > A possible alternative to a single c_type() with flags for context woul= d > be separate c_CONTEXT_type(). >=20 > In QAPISchemaType: >=20 > def c_type(self): > pass >=20 > def c_param_type(self): > return self.c_type() and def c_unboxed_type(self): return self.c_type() so that c_unboxed_type() is callable on all types, not just objects. >=20 > QAPISchemaBuiltinType overrides: >=20 > def c_type(self): > return self._c_type_name >=20 > def c_param_type(self): > if self.name =3D=3D 'str': > return 'const ' + self._c_type_name > return self._c_type_name =2E.. >=20 > Lots of trivial code, as so often with OO. But I'm liking it a bit better than the two flags. Your suggestion came after my v11; at this point, if you want me to pursue the idea, I'm glad to do it as a followup, and include it in my next series where I finish the conversion of simple unions. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --VkNmAU2bmgH1pxwqqtbL73BJ5VIpIj8ai 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/ iQEcBAEBCAAGBQJWxfanAAoJEKeha0olJ0NqODIH/2e/31W+yFN68K3zVqbTF0Fj 1Pj+ymowSgmpmzXl9AXfGXIkf84fjLvCs/03weH2gh9WEmYTYQkSfe+dBDl9V10W xMiMQXAdBMc1yeutCgD3EOxgkDCEgq7qgWPdQBEIzECwItQVjGZAi4HWVWzQYLAe eEqZY1r82DgFUSR57gwtyWSbqh9YeWCzJznZW9gyWp4sGhsrEnrEkoNRwP08midL QWt5LlfPqcckyf5ri0xqGtJkEiy0stYsD/x801W2iR57XRe4puPaXplSBUo46jWZ T1eZbjlLoslD23toL8LQVeZEIOc/8nEKU9VlR1rMhKR/DCITftq+k2sHzjtPGeQ= =ebnO -----END PGP SIGNATURE----- --VkNmAU2bmgH1pxwqqtbL73BJ5VIpIj8ai--