qemu-patch-raspberry4/include
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
..
block blkdebug: Merge hand-rolled and qapi BlkdebugEvent enum 2015-12-17 08:21:27 +01:00
crypto crypto: introduce new module for handling TLS sessions 2015-09-15 15:07:43 +01:00
disas disas: Add print_insn to disassemble info 2015-07-09 15:20:40 +02:00
exec translate-all: ensure host page mask is always extended with 1's 2015-12-02 13:12:30 +01:00
fpu softfloat: expand out STATUS macro 2015-02-06 16:11:38 +00:00
hw sdhci: Sanitize "sdhci-pci" properties for future qomification 2015-12-07 17:13:10 +00:00
libdecnumber Fix new typos in comments (found by codespell) 2014-07-18 17:45:36 +04:00
migration qapi: Don't let implicit enum MAX member collide 2015-12-17 08:21:28 +01:00
monitor monitor/target-ppc: Define target_get_monitor_def 2015-11-12 14:53:36 +11:00
net vhost user: add rarp sending after live migration for legacy guest 2015-10-22 14:34:49 +03:00
qapi qapi: Remove dead visitor code 2015-12-17 08:21:27 +01:00
qemu typedefs: Put them back into alphabetical order 2015-12-04 09:39:55 +03:00
qom qom: Update documentation comment of struct Object 2015-12-03 20:10:22 +01:00
standard-headers linux-headers: update from kvm/next 2015-10-12 18:29:26 +02:00
sysemu oslib-win32: Change return type of function getpagesize 2015-11-30 06:47:02 +01:00
ui replay: recording of the user input 2015-11-06 10:16:03 +01:00
config.h janitor: move remaining public headers to include/ 2012-12-19 08:32:46 +01:00
elf.h elf: Update EM_MOXIE definition 2015-09-25 12:04:43 +02:00
glib-compat.h glib: add compatibility interface for g_hash_table_add() 2015-10-30 09:01:03 +01:00
qemu-common.h Move page_size_init earlier 2015-11-10 14:51:48 +01:00
qemu-io.h qemu-io: Use BlockBackend 2015-02-16 15:07:19 +00:00
qjson.h QJSON: Add JSON writer 2015-02-05 17:16:14 +01:00
trace-tcg.h trace: [tcg] Generate TCG tracing routines 2014-08-12 14:26:12 +01:00
trace.h trace: [tcg] Include event definitions in "trace.h" 2014-08-12 14:26:12 +01:00