From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK8Xv-0006Ed-Lu for qemu-devel@nongnu.org; Tue, 28 Jul 2015 13:20:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZK8Xr-0000Wt-PK for qemu-devel@nongnu.org; Tue, 28 Jul 2015 13:20:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK8Xr-0000Vc-Kr for qemu-devel@nongnu.org; Tue, 28 Jul 2015 13:20:03 -0400 From: Markus Armbruster References: <1435782155-31412-1-git-send-email-armbru@redhat.com> <1435782155-31412-31-git-send-email-armbru@redhat.com> <55B0E226.4050001@redhat.com> Date: Tue, 28 Jul 2015 10:13:15 +0200 In-Reply-To: <55B0E226.4050001@redhat.com> (Eric Blake's message of "Thu, 23 Jul 2015 06:46:30 -0600") Message-ID: <87d1zcog2s.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain 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: Eric Blake Cc: kwolf@redhat.com, berto@igalia.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com Eric Blake writes: > 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. >> >> 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. You're right; I was confused. >> 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[] = { > - "ACPI_DEVICE_OST", > - "BALLOON_CHANGE", > ... > - "WATCHDOG", > - NULL, > +const char *const QAPIEvent_lookup[] = { > + [QAPI_EVENT_ACPI_DEVICE_OST] = "ACPI_DEVICE_OST", > + [QAPI_EVENT_BALLOON_CHANGE] = "BALLOON_CHANGE", That's not what I had in mind when I wrote the sentence about _MAX. but mentioning the change in the commit message won't hurt. Note to self: comes from commit 912ae9c. > Overall, a good change. > >> >> 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 Thanks! [...]