qemu/include/hw/acpi
Philippe Mathieu-Daudé 880a7817c1 misc: Replace zero-length arrays with flexible array member (manual)
Description copied from Linux kernel commit from Gustavo A. R. Silva
(see [3]):

--v-- description start --v--

  The current codebase makes use of the zero-length array language
  extension to the C90 standard, but the preferred mechanism to
  declare variable-length types such as these ones is a flexible
  array member [1], introduced in C99:

  struct foo {
      int stuff;
      struct boo array[];
  };

  By making use of the mechanism above, we will get a compiler
  warning in case the flexible array does not occur last in the
  structure, which will help us prevent some kind of undefined
  behavior bugs from being unadvertenly introduced [2] to the
  Linux codebase from now on.

--^-- description end --^--

Do the similar housekeeping in the QEMU codebase (which uses
C99 since commit 7be41675f7).

All these instances of code were found with the help of the
following command (then manual analysis, without modifying
structures only having a single flexible array member, such
QEDTable in block/qed.h):

  git grep -F '[0];'

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=76497732932f
[3] https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=17642a2fbd2c1

Inspired-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-03-16 22:07:42 +01:00
..
acpi_dev_interface.h hw/arm: Use GED for system_powerdown event 2019-10-05 17:12:09 -04:00
acpi-defs.h misc: Replace zero-length arrays with flexible array member (manual) 2020-03-16 22:07:42 +01:00
acpi.h Include hw/irq.h a lot less 2019-08-16 13:31:52 +02:00
aml-build.h acpi: Add i2c serial bus CRS handling 2019-09-20 14:08:10 -05:00
bios-linker-loader.h vmgenid: replace x-write-pointer-available hack 2017-09-08 16:15:17 +03:00
cpu_hotplug.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
cpu.h typo: apci->acpi 2019-01-30 10:16:58 +01:00
generic_event_device.h hw/arm: Use GED for system_powerdown event 2019-10-05 17:12:09 -04:00
ich9.h i386, acpi: check acpi_memory_hotplug capacity in pre_plug 2019-03-12 22:31:21 -04:00
ipmi.h ipmi: Fix SSIF ACPI handling to use the right CRS 2019-09-20 14:08:10 -05:00
memory_hotplug.h hw/acpi: Make ACPI IO address space configurable 2019-10-05 17:12:08 -04:00
pc-hotplug.h memhp: don't generate memory hotplug AML if it's not enabled/supported 2017-01-10 07:03:24 +02:00
pci.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
pcihp.h pci/pcihp: perform unplug via the hotplug handler 2018-12-20 11:19:12 -05:00
tco.h Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
tpm.h acpi: build TPM Physical Presence interface 2019-01-17 21:10:57 -05:00
utils.h hw/acpi: extract acpi_add_rom_blob() 2019-06-16 16:16:52 -04:00
vmgenid.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00