From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a49By-0000sP-83 for qemu-devel@nongnu.org; Wed, 02 Dec 2015 10:19:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a49Bt-0000kk-Uw for qemu-devel@nongnu.org; Wed, 02 Dec 2015 10:19:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35213) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a49Bt-0000kg-NH for qemu-devel@nongnu.org; Wed, 02 Dec 2015 10:19:33 -0500 References: <1449033659-25497-1-git-send-email-eblake@redhat.com> <1449033659-25497-14-git-send-email-eblake@redhat.com> <87lh9dukyw.fsf@blackfin.pond.sub.org> <565EF521.5030307@redhat.com> From: Eric Blake Message-ID: <565F0C00.8050805@redhat.com> Date: Wed, 2 Dec 2015 08:19:28 -0700 MIME-Version: 1.0 In-Reply-To: <565EF521.5030307@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hponqjS6OHgBaXXWqd0VnQ8oRaPXLRCe0" Subject: Re: [Qemu-devel] [PATCH v14 13/15] qapi: Enforce (or whitelist) case conventions on qapi members 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) --hponqjS6OHgBaXXWqd0VnQ8oRaPXLRCe0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/02/2015 06:41 AM, Eric Blake wrote: > On 12/02/2015 04:51 AM, Markus Armbruster wrote: >> This is the fixup I mentioned in the v13 thread. The "Unreachable and= >> not implemented" hunk should probably be its own patch. >=20 > In fact, that hunk... >=20 >> >> diff --git a/scripts/qapi.py b/scripts/qapi.py >> index 6d38d7c..870e476 100644 >> --- a/scripts/qapi.py >> +++ b/scripts/qapi.py >=20 >> @@ -1073,7 +1071,8 @@ class QAPISchemaMember(object): >> return '(parameter of %s)' % owner[:-4] >> else: >> assert owner.endswith('-wrapper') >> - return '(branch of %s)' % owner[:-8] >> + # Unreachable and not implemented >> + assert False >> if owner.endswith('Kind'): >> # See QAPISchema._make_implicit_enum_type() >> return '(branch of %s)' % owner[:-4] >=20 > ...should probably just be squashed directly into commit 8f3a05b on you= r > current qapi-next branch, since it hasn't landed upstream yet. >=20 > Your fixup looks sane, and eliminates the need for 12/15. So I'm fine > if you'd like to make that change when updating qapi-next. > Reviewed-by: Eric Blake Scratch that. With your patch, the positive tests no longer work in isolation. You were getting lucky that things sorted such that 'Foo' was checked for correctness prior to 'UuidInfo'; but if you comment out the 'Foo' declaration, or rename from 'Foo' to something else that hashes after 'UuidInfo', then args-member-case and union-branch-case start reporting failures about UuidInfo (and only enum-member-case honors the whitelist). That's because your change to qapi.py would require the whitelist to contain ':obj-UuidInfo-args' and 'UuidInfoKind', respectively (with my approach of info['name'], the whitelist containing 'UuidInfo' was sufficient). Maybe we need to modify qapi.py as follows: diff --git i/scripts/qapi.py w/scripts/qapi.py index 04c4c8d..1325da1 100644 --- i/scripts/qapi.py +++ w/scripts/qapi.py @@ -71,6 +71,10 @@ case_whitelist =3D [ 'QapiErrorClass', # all members, visible through errors 'UuidInfo', # UUID, visible through query-uuid 'X86CPURegister32', # all members, visible indirectly through qom-get + + # For use in the testsuite + ':obj-x-UuidInfo-arg', # args-member-case + 'x-UuidInfoList', # union-branch-case ] enum_types =3D [] index 1bc823a..193eb66 100644 --- i/tests/qapi-schema/args-member-case.json +++ w/tests/qapi-schema/args-member-case.json @@ -1,3 +1,3 @@ # Member names should be 'lower-case' unless the struct/command is whitelisted -{ 'command': 'UuidInfo', 'data': { 'Arg': 'int' } } +{ 'command': 'x-UuidInfo', 'data': { 'Arg': 'int' } } { 'command': 'Foo', 'data': { 'Arg': 'int' } } index a5951f1..4f0988a 100644 --- i/tests/qapi-schema/union-branch-case.json +++ w/tests/qapi-schema/union-branch-case.json @@ -1,3 +1,3 @@ # Branch names should be 'lower-case' unless the union is whitelisted -{ 'union': 'UuidInfo', 'data': { 'Branch': 'int' } } +{ 'union': 'x-UuidInfo', 'data': { 'Branch': 'int' } } { 'union': 'Foo', 'data': { 'Branch': 'int' } } --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --hponqjS6OHgBaXXWqd0VnQ8oRaPXLRCe0 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/ iQEcBAEBCAAGBQJWXwwAAAoJEKeha0olJ0NqveYH/05K534EZcv4rTejeTCnXoyO 7Ej6OabnOlK1fMebzWVX+2T2Vjm1tc4If9UAhDgddwJjei5ZcY1IGpwoBmX9CBa/ dWBbGv2XCJlykqb2iWkHr25bwl08uXDfb2onZ9YLdp5OM9QM0Cl64wKUiUcb6tE4 HaO0fZhh5GDY2IkIQrPw2OkWP2yh1eV5fKiWpLqc7+FnPuUPx6wgL++SD/vT9Cap j+ql1yZUTZvVZEQX1/rDuZ/zv16LxtmCzpgMDUXGxEgyvjszsGul/H05B65ojamB 8cJM9VS/FWvCoBDz0ekYJVtTActPnISgU5zdQ6U38ppCY0wZ1vXGjAx5YCE5fQI= =72qG -----END PGP SIGNATURE----- --hponqjS6OHgBaXXWqd0VnQ8oRaPXLRCe0--