From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcGKI-00087I-5A for qemu-devel@nongnu.org; Wed, 16 Sep 2015 13:16:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZcGKD-0007BB-Qy for qemu-devel@nongnu.org; Wed, 16 Sep 2015 13:16:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53403) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcGKD-0007B2-G7 for qemu-devel@nongnu.org; Wed, 16 Sep 2015 13:16:53 -0400 References: <1442401589-24189-1-git-send-email-armbru@redhat.com> <1442401589-24189-10-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55F9A403.7030008@redhat.com> Date: Wed, 16 Sep 2015 11:16:51 -0600 MIME-Version: 1.0 In-Reply-To: <1442401589-24189-10-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="a4FdEjRR73PUIk39NLwGtx5Nj3CcUDrlo" Subject: Re: [Qemu-devel] [PATCH v8 09/26] qapi: De-duplicate enum code generation 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) --a4FdEjRR73PUIk39NLwGtx5Nj3CcUDrlo Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/16/2015 05:06 AM, Markus Armbruster wrote: > Duplicated in commit 21cd70d. Yes, we can't import qapi-types, but > that's no excuse. Move the helpers from qapi-types.py to qapi.py, and > replace the duplicates in qapi-event.py. >=20 > The generated event enumeration type's lookup table becomes > const-correct (see commit 2e4450f), and uses explicit indexes instead > of relying on order (see commit 912ae9c). >=20 > Signed-off-by: Markus Armbruster > --- > docs/qapi-code-gen.txt | 9 ++++--- > scripts/qapi-event.py | 67 +++---------------------------------------= -------- > scripts/qapi-types.py | 55 ----------------------------------------- > scripts/qapi.py | 55 +++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 64 insertions(+), 122 deletions(-) >=20 > +++ b/scripts/qapi.py > @@ -1497,6 +1497,61 @@ def guardend(name): > ''', > name=3Dguardname(name)) > =20 > +def generate_enum_lookup(name, values, prefix=3DNone): To keep pep8 happier, you could use two blank lines before def here... > + return ret > + > +def generate_enum(name, values, prefix=3DNone): and here. Then again, 13/26 does more of these sorts of cleanups, and v7 had the same use of 1 blank line. Up to you if it is worth avoiding the churn; but it is whitespace either way so it doesn't affect review. Also, do you still need prefix=3DNone, or can we rely on the fact that no= w all callers supply prefix by virtue of the visitor callback, and make the parameter non-optional? Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --a4FdEjRR73PUIk39NLwGtx5Nj3CcUDrlo 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/ iQEcBAEBCAAGBQJV+aQDAAoJEKeha0olJ0NqBXwH/2FPHJxFjvC5VsUwsBFiK7N1 V+62ZzDyqlmkonpuJL6V1jcsRwfhFLPUc4zjnwUXq51m55qHNS0LiKgRFukg1NBS czIEY5SkprORUSe3QU9gKtZkNEM03D5Yph6DGj6YPR8co2rjmW8GzJGDumCXQFwN fY8MlBhtI9B854ZoFpGr+VurJ2AqfBgd57ER62GdsQ1MLN8V0M820ypCr8Kxn6TE 6FYSmNbRaLiF0ig4fxRMJfyBJHD0I9fL0bG64gBzUzB42dMnKezsq7a1wpIk6Qf/ u4Kgo8Ini8EoeKr+l7A2kg7W5nHRe/K8TgDVGooTseL85G3LPxt97wRSENF/VoQ= =ea2H -----END PGP SIGNATURE----- --a4FdEjRR73PUIk39NLwGtx5Nj3CcUDrlo--