qemu-patch-raspberry4/hw/i386
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
..
kvm kvmclock: add a new function to update env->tsc. 2015-11-05 11:28:10 +01:00
xen xen-platform: Replace assert() with appropriate error reporting 2015-10-26 11:32:24 +00:00
acpi-build.c acpi: avoid potential uninitialized access to cpu_hp_io_base 2015-08-13 14:08:30 +03:00
acpi-build.h i386: ACPI table generation code from seabios 2013-10-14 17:48:57 +03:00
acpi-dsdt-cpu-hotplug.dsl pc: acpi-build: create CPU hotplug IO region dynamically 2015-02-26 13:04:17 +01:00
acpi-dsdt-dbug.dsl i386: add ACPI table files from seabios 2013-10-14 17:48:51 +03:00
acpi-dsdt-hpet.dsl ACPI: Remove commented-out code from HPET._CRS 2014-02-10 11:09:33 +02:00
acpi-dsdt-isa.dsl pc: acpi-build: drop template patching and create Device(SMC) dynamically 2015-03-01 12:33:22 +01:00
acpi-dsdt-mem-hotplug.dsl acpi: add hardware implementation for memory hot unplug 2015-04-27 21:09:07 +02:00
acpi-dsdt.dsl make: fix where dependency *.d are stored. 2015-08-13 14:08:24 +03:00
acpi-dsdt.hex.generated acpi: update generated files 2015-03-04 16:05:32 +01:00
intel_iommu.c intel_iommu: Add support for translation for devices behind bridges 2015-10-18 10:05:43 +03:00
intel_iommu_internal.h intel-iommu: add IOTLB using hash table 2014-08-28 23:10:22 +02:00
kvmvapic.c kvmvapic: patch_instruction fix 2014-10-31 11:29:02 +01:00
Makefile.objs hw/pci-assign: split pci-assign.c 2015-09-10 12:04:27 +00:00
multiboot.c i386: Rename ELF_MACHINE to be x86 specific 2015-09-25 12:04:44 +02:00
multiboot.h refer to FWCfgState explicitly 2013-06-02 18:14:02 +03:00
pc.c error: More error_setg() usage 2015-11-11 18:56:26 +01:00
pc_piix.c qapi: Don't let implicit enum MAX member collide 2015-12-17 08:21:28 +01:00
pc_q35.c qapi: Don't let implicit enum MAX member collide 2015-12-17 08:21:28 +01:00
pc_sysfw.c Fix bad error handling after memory_region_init_ram() 2015-09-18 14:39:29 +02:00
pci-assign-load-rom.c pci-assign: do not test path with access() before opening 2015-11-06 15:42:38 +03:00
q35-acpi-dsdt.dsl make: fix where dependency *.d are stored. 2015-08-13 14:08:24 +03:00
q35-acpi-dsdt.hex.generated acpi: update generated files 2015-03-04 16:05:32 +01:00