From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXhSw-0001w7-19 for qemu-devel@nongnu.org; Thu, 03 Sep 2015 23:15:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXhSs-0000Aq-SG for qemu-devel@nongnu.org; Thu, 03 Sep 2015 23:15:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33078) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXhSs-0000Al-Ke for qemu-devel@nongnu.org; Thu, 03 Sep 2015 23:14:58 -0400 References: <1441290623-13631-1-git-send-email-armbru@redhat.com> <1441290623-13631-12-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55E90CB1.9040907@redhat.com> Date: Thu, 3 Sep 2015 21:14:57 -0600 MIME-Version: 1.0 In-Reply-To: <1441290623-13631-12-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WnjrtvDbUCvp7PBoP11g5QEfN2PVqDxt5" Subject: Re: [Qemu-devel] [PATCH RFC v4 11/32] qapi-visit: Convert to QAPISchemaVisitor, fixing bugs 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) --WnjrtvDbUCvp7PBoP11g5QEfN2PVqDxt5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/03/2015 08:30 AM, Markus Armbruster wrote: > Fixes flat unions to visit the base's base members (the previous > commit merely added them to the struct). Same test case. >=20 >=20 > Signed-off-by: Markus Armbruster > Reviewed-by: Eric Blake > --- > scripts/qapi-visit.py | 260 +++++++++++++-----------= -------- > tests/qapi-schema/qapi-schema-test.json | 3 - > tests/test-qmp-input-strict.c | 4 +- > tests/test-qmp-input-visitor.c | 4 +- > 4 files changed, 107 insertions(+), 164 deletions(-) >=20 > +def gen_visit_union(name, base, variants): > + ret =3D '' > =20 > if base: > + disc_key =3D variants.tag_member.name > + if not variants.tag_name: > + # we pointlessly use a different key for simple unions > + disc_key =3D 'type' > ret +=3D mcgen(''' > - visit_type_%(disc_type)s(m, &(*obj)->%(c_tag)s, "%(disc_key)s"= , &err); > + visit_type_%(disc_type)s(m, &(*obj)->%(c_name)s, "%(disc_key)s= ", &err); > if (err) { > goto out_obj; > } > if (!visit_start_union(m, !!(*obj)->data, &err) || err) { > goto out_obj; > } > - switch ((*obj)->%(c_tag)s) { > + switch ((*obj)->%(c_name)s) { > ''', > - disc_type =3D disc_type, > - c_tag=3Dc_name(tag), > + disc_type=3Dvariants.tag_member.type.c_name(), > + c_name=3Dc_name(variants.tag_member.name), > disc_key =3D disc_key) See my comments on 30/32, and patches in 2 and 10. This is the final place that cannot refer to tag_member.name until after we unify the C and wire spelling. diff --git i/scripts/qapi-visit.py w/scripts/qapi-visit.py index 6819866..468080e 100644 --- i/scripts/qapi-visit.py +++ w/scripts/qapi-visit.py @@ -284,7 +284,7 @@ void visit_type_%(c_name)s(Visitor *m, %(c_name)s **obj, const char *name, Error switch ((*obj)->%(c_name)s) { ''', c_type=3Dvariants.tag_member.type.c_name(), - c_name=3Dc_name(variants.tag_member.name), + c_name=3Dc_name(variants.tag_name or 'kind'), name=3Dtag_key) for var in variants.variants: --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --WnjrtvDbUCvp7PBoP11g5QEfN2PVqDxt5 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/ iQEcBAEBCAAGBQJV6QyxAAoJEKeha0olJ0NqxM8H/0wO2SWtuEyFBG4Ty3aCzNrO uK7ChIg95sea9wPdqJ/FoWHsceo06+KUpSKY1pQEYl5FcqRrRaQWGRG2Lixj402z OsVg80ZPQtHP1R3yW2dL8mUxjmqfbpTRd4/H4yV90rixUbQlRMjqXjF95KtsBD2F 8VwBGCoo6KvfZvsdNipKy4oJ8Z8v9mtDJZUR7CsQDFpDj+VDcV52WhVl6fIA2zN0 tLMgfGmn9DDHVxpfvgPOgCTfO+WCnJP885LkGqvUEVKl3/okHAeeaaOFS586qhjB imTEdiunUpmTBl/6i+2L+A1hTnrBbENi4FmNzZsXYx+gRoBlplRpvUUJLvzd5jE= =oDnK -----END PGP SIGNATURE----- --WnjrtvDbUCvp7PBoP11g5QEfN2PVqDxt5--