qemu/include/hw/virtio
Philippe Mathieu-Daudé f7795e4096 misc: Replace zero-length arrays with flexible array member (automatic)
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 Coccinelle script:

  @@
  identifier s, m, a;
  type t, T;
  @@
   struct s {
      ...
      t m;
  -   T a[0];
  +   T a[];
  };
  @@
  identifier s, m, a;
  type t, T;
  @@
   struct s {
      ...
      t m;
  -   T a[0];
  +   T a[];
   } QEMU_PACKED;

[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
..
vhost-backend.h vhost-user: add vhost_user_gpu_set_socket() 2019-05-29 06:29:07 +02:00
vhost-scsi-common.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
vhost-scsi.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
vhost-user-blk.h vhost-user-blk: convert to new virtio_delete_queue 2020-02-25 08:32:56 -05:00
vhost-user-fs.h vhost-user-fs: convert to the new virtio_delete_queue function 2020-02-25 08:32:45 -05:00
vhost-user-scsi.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
vhost-user.h vhost-user: simplify vhost_user_init/vhost_user_cleanup 2019-03-12 21:22:31 -04:00
vhost-vsock.h vhost-vsock: delete vqs in vhost_vsock_unrealize to avoid memleaks 2020-01-22 00:23:07 -05:00
vhost.h Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
virtio-access.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
virtio-balloon.h virtio-balloon: Use temporary PBP only 2019-07-25 07:58:03 -04:00
virtio-blk.h virtio: make seg_max virtqueue size dependent 2020-01-06 12:04:43 -05:00
virtio-bus.h Clean up inclusion of sysemu/sysemu.h 2019-08-16 13:31:53 +02:00
virtio-crypto.h Clean up ill-advised or unusual header guards 2019-05-13 08:58:55 +02:00
virtio-gpu-bswap.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
virtio-gpu-pci.h hw/display: add vhost-user-vga & gpu-pci 2019-05-29 06:30:45 +02:00
virtio-gpu-pixman.h virtio-gpu: add a pixman helper header 2019-05-29 06:29:07 +02:00
virtio-gpu.h edid: flip the default to enabled 2019-06-13 09:34:50 +02:00
virtio-input.h Add vhost-user-input-pci 2019-05-10 14:52:47 +02:00
virtio-iommu.h misc: Replace zero-length arrays with flexible array member (automatic) 2020-03-16 22:07:42 +01:00
virtio-mmio.h hw/virtio: Factorize virtio-mmio headers 2019-10-22 09:38:42 +02:00
virtio-net.h net/virtio: add failover support 2019-10-29 18:55:26 -04:00
virtio-pmem.h Include sysemu/hostmem.h less 2019-08-16 13:31:53 +02:00
virtio-rng.h virtio-rng: Keep the default backend out of VirtIORNGConf 2019-09-04 06:32:51 -04:00
virtio-scsi.h virtio: make seg_max virtqueue size dependent 2020-01-06 12:04:43 -05:00
virtio-serial.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
virtio.h virtio: don't enable notifications during polling 2020-01-05 07:03:03 -05:00