From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIFtc-0002eG-6F for qemu-devel@nongnu.org; Thu, 23 Jul 2015 08:46:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIFtX-0001LY-Qm for qemu-devel@nongnu.org; Thu, 23 Jul 2015 08:46:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIFtX-0001LR-Ix for qemu-devel@nongnu.org; Thu, 23 Jul 2015 08:46:39 -0400 References: <1435782155-31412-1-git-send-email-armbru@redhat.com> <1435782155-31412-31-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55B0E226.4050001@redhat.com> Date: Thu, 23 Jul 2015 06:46:30 -0600 MIME-Version: 1.0 In-Reply-To: <1435782155-31412-31-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hiX6NIX5IUvE5bUERUBgCXBaCvFgshRjw" Subject: Re: [Qemu-devel] [PATCH RFC v2 30/47] 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: kwolf@redhat.com, berto@igalia.com, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hiX6NIX5IUvE5bUERUBgCXBaCvFgshRjw Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/01/2015 02:22 PM, 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 gains a _MAX member, Not quite; the _MAX member was already there, but done by hand [1] instead of by common code. > and its > lookup table becomes const-correct (see commit 2e4450f). Maybe what you meant instead of gaining _MAX was that it also gains C99 initializers: -const char *QAPIEvent_lookup[] =3D { - "ACPI_DEVICE_OST", - "BALLOON_CHANGE", =2E.. - "WATCHDOG", - NULL, +const char *const QAPIEvent_lookup[] =3D { + [QAPI_EVENT_ACPI_DEVICE_OST] =3D "ACPI_DEVICE_OST", + [QAPI_EVENT_BALLOON_CHANGE] =3D "BALLOON_CHANGE", Overall, a good change. >=20 > Signed-off-by: Markus Armbruster > --- > scripts/qapi-event.py | 67 +++----------------------------------------= -------- > scripts/qapi-types.py | 55 ------------------------------------------ > scripts/qapi.py | 55 ++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 59 insertions(+), 118 deletions(-) Since only the commit message needs tweaking, Reviewed-by: Eric Blake >=20 > diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py > index aec2d32..aed45d6 100644 > --- a/scripts/qapi-event.py > +++ b/scripts/qapi-event.py > @@ -153,63 +153,6 @@ def generate_event_implement(api_name, event_name,= params): > - # append automatically generated _MAX value > - enum_max_value =3D c_enum_const(event_enum_name, "MAX") > - enum_values =3D event_enum_values + [ enum_max_value ] [1] --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --hiX6NIX5IUvE5bUERUBgCXBaCvFgshRjw 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/ iQEcBAEBCAAGBQJVsOImAAoJEKeha0olJ0NqBhgH/jlByenZvWcPZT7AtGu1m15K fRfq3i2xCBqqDEEw2sd85JzVX2JNUKEPkdmua82b+sN+NDXSIFHN4QFnbCieCq0N KtmZzNfhgVKdYIonpx+KwrYbrFMenGd697qIZvfmTNwe0IW3a0rlbss0MFjfSZfy 5R4ijAPKS+kZ9NRzckmD763aB76iqB/iqJSK1eyXObU22+Nn8ZzS+8fkzUgtHWd2 lennojPjYA6dqRNq6Dvb6DIq/gQ+ZWbs2hJRHtM1IVYsDmUwPVEb0wnWDvY0RWfM z/NPeVBl+W3/LNzVsBllPNEW+BQdkI6ndGfpmGRSY2j13NhZYAJoGxGe2PEP1qk= =MFOW -----END PGP SIGNATURE----- --hiX6NIX5IUvE5bUERUBgCXBaCvFgshRjw--