qemu-e2k/include/hw/s390x
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
..
3270-ccw.h s390x/3270: IDA support for 3270 via CcwDataStream 2017-10-06 10:53:02 +02:00
adapter.h s390x/virtio-ccw: wire up irq routing and irqfds 2014-05-20 13:05:58 +02:00
ap-bridge.h s390x/ap: base Adjunct Processor (AP) object model 2018-10-12 11:32:18 +02:00
ap-device.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
css-bridge.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
css.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
ebcdic.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
event-facility.h misc: Replace zero-length arrays with flexible array member (manual) 2020-03-16 22:07:42 +01:00
ioinst.h hw/s390x/ioinst: Fix alignment problem in struct SubchDev 2018-10-04 10:32:38 +02:00
s390_flic.h s390x/flic: cache the common flic class in a central function 2018-02-09 09:37:13 +01:00
s390-ccw.h vfio-ccw: support async command subregion 2019-06-24 17:27:57 +02:00
s390-virtio-ccw.h s390x: Fence huge pages prior to 3.1 2018-10-04 10:32:39 +02:00
sclp.h misc: Replace zero-length arrays with flexible array member (manual) 2020-03-16 22:07:42 +01:00
storage-attributes.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
storage-keys.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
tod.h Include hw/qdev-properties.h less 2019-08-16 13:31:53 +02:00
vfio-ccw.h s390 vfio-ccw: Add bootindex property and IPLB data 2019-04-12 12:39:52 +02:00