From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkCiG-0004oK-6E for qemu-devel@nongnu.org; Thu, 08 Oct 2015 11:02:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkCiF-0006C1-2o for qemu-devel@nongnu.org; Thu, 08 Oct 2015 11:02:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45284) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkCiE-0006Bm-Sr for qemu-devel@nongnu.org; Thu, 08 Oct 2015 11:02:31 -0400 References: <1443930073-19359-1-git-send-email-eblake@redhat.com> <1443930073-19359-8-git-send-email-eblake@redhat.com> <878u7dk0mr.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <56168585.7070503@redhat.com> Date: Thu, 8 Oct 2015 09:02:29 -0600 MIME-Version: 1.0 In-Reply-To: <878u7dk0mr.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rBVlN37hI0kjgtJKIwXEP3dDMGAfB7OSo" Subject: Re: [Qemu-devel] [PATCH v7 07/14] qapi: Move union tag quirks into subclass List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: marcandre.lureau@redhat.com, qemu-devel@nongnu.org, ehabkost@redhat.com, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --rBVlN37hI0kjgtJKIwXEP3dDMGAfB7OSo Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/08/2015 06:25 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> Right now, simple unions have a quirk of using 'kind' in the C >> struct to match the QMP wire name 'type'. This has resulted in >> messy clients each doing special cases. While we plan to >> eventually rename things to match, it is better in the meantime >> to consolidate the quirks into a special subclass, by adding a >> new member.c_name() function. This will also make it easier >> for reworking how alternate types are laid out in a future >> patch. Use the new c_name() function where possible. >> >> No change to generated code. >> >> Signed-off-by: Eric Blake >> >> --- >> v7: new patch, but borrows idea of subclass from v6 10/12, as >> well as c_name() from 7/12 >> --- >> scripts/qapi-commands.py | 8 ++++---- >> scripts/qapi-types.py | 12 +++++------- >> scripts/qapi-visit.py | 17 +++++------------ >> scripts/qapi.py | 15 +++++++++++++-- >> 4 files changed, 27 insertions(+), 25 deletions(-) >=20 > My immediate reaction to the subclass idea was "instead of encapsulatin= g > the flaw more nicely, why not fix it?" So gave that a try, see my othe= r > reply. I had already done the same sort of fix, but it was just sitting later in my series where you hadn't reached reviewing yet. >=20 > That said, the diffstat shows the subclass idea doesn't take much code.= > May make sense if we feel we shouldn't fix the flaw now. I also like the subclass idea because it makes simplifying alternates easier (see my just-posted subset C). But it sounds like getting rid of the 'type'/'kind' mismatch sooner rather than later seems like the direction we should be heading. If I need to spin a v8 of this series, I'll certainly include that conversion (whether from mine, yours, or a combination of the two). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --rBVlN37hI0kjgtJKIwXEP3dDMGAfB7OSo 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/ iQEcBAEBCAAGBQJWFoWFAAoJEKeha0olJ0NqSJYH/1aY0cY2ofk7fcwRh5irtm7s 632G0TS0MSd874l986wfDu0zIlfGPmQsArnDO7qFgGYq+tepVqFSXabP3/Hywti2 LhKJdgJe6MeNdYe6hBN7BoYQ83PWUL0A6lX04ghrGumNI0MF2tOt58E6Bg7WUklN xJlxyxRgB2yN3Jp8FiiIxVvRodMCpcr1Ijm17cg3ZlpttSEVw2oZsmJRkiGTzXxP PAmD2Nzbdxv5XZwTyNl2V6sKPPNA066PbXJKT/iuU/ZY2nV2tCWmHZu4M6BkSwpV keqp0jQvAHao1zfymsIATZC9vMjFfn0w2MHtW4cevVOvfjAUnMJL6DBiEBYX5AY= =Z0h9 -----END PGP SIGNATURE----- --rBVlN37hI0kjgtJKIwXEP3dDMGAfB7OSo--