qemu-e2k/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
..
Kconfig virtio-iommu: Add skeleton 2020-02-27 03:46:10 -05:00
Makefile.objs virtio-iommu-pci: Add virtio iommu pci support 2020-02-27 03:46:10 -05:00
trace-events virtio-iommu: Implement fault reporting 2020-02-27 03:46:10 -05:00
vhost-backend.c Include qemu/main-loop.h less 2019-08-16 13:31:52 +02:00
vhost-scsi-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
vhost-stub.c
vhost-user-blk-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
vhost-user-fs-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
vhost-user-fs.c vhost-user-fs: convert to the new virtio_delete_queue function 2020-02-25 08:32:45 -05:00
vhost-user-input-pci.c
vhost-user-scsi-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
vhost-user.c Fixed assert in vhost_user_set_mem_table_postcopy 2020-02-27 03:46:10 -05:00
vhost-vsock-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
vhost-vsock.c vhost-vsock: fix error message output 2020-03-08 09:27:09 -04:00
vhost.c vhost: correctly turn on VIRTIO_F_IOMMU_PLATFORM 2020-03-08 09:27:09 -04:00
virtio-9p-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
virtio-balloon-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
virtio-balloon.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
virtio-blk-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
virtio-bus.c virtio: notify virtqueue via host notifier when available 2019-11-06 06:35:00 -05:00
virtio-crypto-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
virtio-crypto.c virtio-crypto: do delete ctrl_vq in virtio_crypto_device_unrealize 2020-02-25 08:32:45 -05:00
virtio-input-host-pci.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
virtio-input-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
virtio-iommu-pci.c virtio-iommu-pci: Add virtio iommu pci support 2020-02-27 03:46:10 -05:00
virtio-iommu.c virtio-iommu: Support migration 2020-02-27 03:46:10 -05:00
virtio-mmio.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
virtio-net-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
virtio-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
virtio-pci.h virtio-pci: Add Function Level Reset support 2019-09-04 06:33:10 -04:00
virtio-pmem-pci.c virtio pmem: remove transitional names 2019-07-12 10:57:27 -04:00
virtio-pmem-pci.h virtio-pci: Proxy for virtio-pmem 2019-07-04 17:00:32 -04:00
virtio-pmem.c virtio-pmem: do delete rq_vq in virtio_pmem_unrealize 2020-02-25 08:32:45 -05:00
virtio-rng-pci.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
virtio-rng.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
virtio-scsi-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
virtio-serial-pci.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
virtio.c misc: Replace zero-length arrays with flexible array member (automatic) 2020-03-16 22:07:42 +01:00