From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoHTF-0003ni-4F for qemu-devel@nongnu.org; Fri, 01 May 2015 16:23:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YoHTB-00021U-02 for qemu-devel@nongnu.org; Fri, 01 May 2015 16:23:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoHTA-00021Q-OK for qemu-devel@nongnu.org; Fri, 01 May 2015 16:23:32 -0400 Message-ID: <5543E09B.6080101@redhat.com> Date: Fri, 01 May 2015 14:22:51 -0600 From: Eric Blake MIME-Version: 1.0 References: <1430312814-19706-1-git-send-email-eblake@redhat.com> <1430312814-19706-40-git-send-email-eblake@redhat.com> In-Reply-To: <1430312814-19706-40-git-send-email-eblake@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rb3lXGwRONGKO2ifDJbdJ0NmfsT6wXvxa" Subject: Re: [Qemu-devel] [PATCH v7 39/39] qapi: Check for member name conflicts with a base class List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, berto@igalia.com, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --rb3lXGwRONGKO2ifDJbdJ0NmfsT6wXvxa Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/29/2015 07:06 AM, Eric Blake wrote: > Our type inheritance for both 'struct' and for flat 'union' merges > key/value pairs from the base class with those from the type in > question. Although the C code currently boxes things so that there > is a distinction between which member is referred to, the QMP wire > format does not allow passing a key more than once in a single > object. Besides, if we ever change the generated C code to not be > quite so boxy, we'd want to avoid duplicate member names there, > too. >=20 > Fix a testsuite entry added in an earlier patch, as well as adding > a couple more tests to ensure we have appropriate coverage. >=20 > Signed-off-by: Eric Blake > Reviewed-by: Markus Armbruster >=20 > --- >=20 > +++ b/scripts/qapi.py > @@ -414,6 +414,18 @@ def check_type(expr_info, source, value, allow_arr= ay =3D False, > allow_metas=3D['built-in', 'union', 'alternate', 's= truct', > 'enum']) >=20 > +def check_member_clash(expr_info, base_name, data, source =3D ""): > + base =3D find_struct(base_name) > + assert base > + base_members =3D base['data'] > + for key in data.keys(): > + if key in base_members: Fails to consider what happens when one but not both of the dictionaries being compared marked the member as optional (that is, the key '*name' must be treated as conflicting with 'name'). Followup on the way; it's not a regression, so you can either squash into this or leave as standalone. Again, let me know if you'd rather me post a v8 with all my squashes folded in. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --rb3lXGwRONGKO2ifDJbdJ0NmfsT6wXvxa 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/ iQEbBAEBCAAGBQJVQ+CbAAoJEKeha0olJ0NqW7IH9RkfYmzFJSzwJRNWQbyTgJ0n 77/nctzEoym/BF8HAaXqwtUqEQ2qnPUmpExgK+u1zpG+C5++bfbqgkNJ4jVWMiUR pkPI4+/+nLrmHrpOvzhjaTeFO7d4scI4K+yyKhI+eirodvIjBJ/TLpZlsuvQ957c unAqmBQFdI55eM8X9aPej7qdb2e/iI6lPC4Cw4AG9ifUbLTepmrZuj/rc4h7bbA9 5JRkgQnubwK+dyCRwDA5rrRnFkQcBMYEDsl+AgNnsRDM1FReH8yCmDeX19ZjLfVq EDJsRQOCLD/YFHbAMPmORg6HspLaUnmwAVG93nW9f9h8tGglgl3gFZsQ8q3Xig== =C+eD -----END PGP SIGNATURE----- --rb3lXGwRONGKO2ifDJbdJ0NmfsT6wXvxa--