From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zm5St-0004NC-Te for qemu-devel@nongnu.org; Tue, 13 Oct 2015 15:42:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zm5Sq-0003zC-IL for qemu-devel@nongnu.org; Tue, 13 Oct 2015 15:42:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zm5Sq-0003yv-Al for qemu-devel@nongnu.org; Tue, 13 Oct 2015 15:42:24 -0400 References: <1444710158-8723-1-git-send-email-eblake@redhat.com> <1444710158-8723-18-git-send-email-eblake@redhat.com> <87k2qqmwx3.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <561D5E9F.10407@redhat.com> Date: Tue, 13 Oct 2015 13:42:23 -0600 MIME-Version: 1.0 In-Reply-To: <87k2qqmwx3.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="h40kJRaxkAgrwJdKtOK4CqEEq04C82ATs" Subject: Re: [Qemu-devel] [PATCH v8 17/18] qapi: Add test for alternate branch 'kind' clash List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --h40kJRaxkAgrwJdKtOK4CqEEq04C82ATs Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/13/2015 12:43 PM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> Rename alternate-clash to alternate-clash-members, and add a >> new test alternate-clash-type. While similar to the earlier >> addition of union-clash-type, we have one major difference: a >> future patch will be simplifying alternates to not need an >> implict AlternateKind enum, but we still need to detect the >> collision with the resulting C 'qtype_code type;' tag. >=20 > You're alluding to a future change of the generated code from >=20 > struct BlockdevRef { > BlockdevRefKind kind; > union { /* union tag is @kind */ > void *data; > BlockdevOptions *definition; > char *reference; > }; > }; >=20 > to >=20 > struct BlockdevRef { > qtype_code type; > union { /* union tag is @type */ > void *data; > BlockdevOptions *definition; /* QTYPE_QDICT */ > char *reference; /* QTYPE_QSTRING */ > }; > }; >=20 > right? Yes. >=20 > I don't think that affects collision checking at all. Both before and > after, we have a tag member, and we need to check for collisions with > its name. I guess I wrote that at one point where I was using alternate.variants.tag_member =3D None for alternates; but in the meantime, I've reworked things to just use a special subclass of QAPISchemaObjectTypeMember instead, at which point normal collision checking still works. So yeah, I can probably simplify or drop wording here. >> +++ b/tests/qapi-schema/alternate-clash-type.json >> @@ -0,0 +1,10 @@ >> +# Alternate branch 'type' >> +# Reject this, because we would have a clash in generated C, between = the >> +# alternate's implicit tag member 'kind' and the branch name 'kind' >> +# within the alternate. >> +# TODO: Even if alternates are simplified in the future to use a simp= ler >> +# 'qtype_code type' tag, rather than a full QAPISchemaObjectTypeMembe= r, >> +# we must still flag the collision, or else munge the generated C bra= nch >> +# names to allow compilation. >=20 > I don't think there's a TODO here. Again, probably leftover text from my first implementation. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --h40kJRaxkAgrwJdKtOK4CqEEq04C82ATs 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/ iQEcBAEBCAAGBQJWHV6fAAoJEKeha0olJ0NqKEsIAJU32ju9uzkva/LUWRyyuA3v H0UIfohAzeGC+wwe1omIXTMJHgK4m1xq9cz5TZLaY3E9pPT/fikVCRGb5XBlzkXD QhHIBaZJK4v6BCx1kw6VaJ8CVCDdVYEsI7crenZp5KTKWskoKPa79RNPB4ro5+SF OGPFyBxr9o/+aR7lwfKSw2JlmDCuEs2V2XvFWK5A6WLaHdYEokUjMRyP5dmm29hC Rk/mQRFnqEqHb4miGQqWH1dElddl5xyxnudXW9rGpt0EM5wqphtmel7EliXZJlze fNrRogwl5BRn4sy6Qpy0nAWbkt7g+xlShonH7w4gBHi0IAnzEm+RrEWm4ha5puA= =6MiB -----END PGP SIGNATURE----- --h40kJRaxkAgrwJdKtOK4CqEEq04C82ATs--