qemu-patch-raspberry4/hw/input
Eric Blake 7fb1cf1606 qapi: Don't let implicit enum MAX member collide
Now that we guarantee the user doesn't have any enum values
beginning with a single underscore, we can use that for our
own purposes.  Renaming ENUM_MAX to ENUM__MAX makes it obvious
that the sentinel is generated.

This patch was mostly generated by applying a temporary patch:

|diff --git a/scripts/qapi.py b/scripts/qapi.py
|index e6d014b..b862ec9 100644
|--- a/scripts/qapi.py
|+++ b/scripts/qapi.py
|@@ -1570,6 +1570,7 @@ const char *const %(c_name)s_lookup[] = {
|     max_index = c_enum_const(name, 'MAX', prefix)
|     ret += mcgen('''
|     [%(max_index)s] = NULL,
|+// %(max_index)s
| };
| ''',
|                max_index=max_index)

then running:

$ cat qapi-{types,event}.c tests/test-qapi-types.c |
    sed -n 's,^// \(.*\)MAX,s|\1MAX|\1_MAX|g,p' > list
$ git grep -l _MAX | xargs sed -i -f list

The only things not generated are the changes in scripts/qapi.py.

Rejecting enum members named 'MAX' is now useless, and will be dropped
in the next patch.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1447836791-369-23-git-send-email-eblake@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
[Rebased to current master, commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-12-17 08:21:28 +01:00
..
adb.c adb: add to input category 2015-10-23 12:35:17 +11:00
hid.c qapi: Don't let implicit enum MAX member collide 2015-12-17 08:21:28 +01:00
lm832x.c vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* 2015-01-26 12:22:44 +01:00
Makefile.objs virtio-input: Fix device introspection on non-Linux hosts 2015-10-09 15:25:56 +02:00
milkymist-softusb.c Fix bad error handling after memory_region_init_ram() 2015-09-18 14:39:29 +02:00
pckbd.c migration: Use normal VMStateDescriptions for Subsections 2015-06-12 06:53:57 +02:00
pl050.c pl050: QOM'ify pl050_keyboard and pl050_mouse 2013-07-29 21:06:57 +02:00
ps2.c qapi: Don't let implicit enum MAX member collide 2015-12-17 08:21:28 +01:00
pxa2xx_keypad.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
stellaris_input.c typofixes - v4 2015-09-11 10:45:43 +03:00
tsc210x.c hw/input/tsc210x: Remove superfluous memset 2015-11-06 15:42:38 +03:00
tsc2005.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
virtio-input-hid.c qapi: Don't let implicit enum MAX member collide 2015-12-17 08:21:28 +01:00
virtio-input-host.c virtio-input: move sys/ioctl.h include 2015-07-16 17:34:41 +02:00
virtio-input.c virtio-input: ignore events until the guest driver is ready 2015-10-20 08:53:40 +02:00
vmmouse.c savevm: Remove all the unneeded version_minimum_id_old (x86) 2014-06-16 04:55:26 +02:00