qemu/docs/interop
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
..
bitmaps.rst docs/bitmaps: use QMP lexer instead of json 2019-07-10 15:08:07 -04:00
conf.py docs: Move tools documentation to tools manual 2020-02-25 10:48:06 +00:00
dbus-vmstate.rst Add dbus-vmstate object 2020-01-06 18:41:32 +04:00
dbus.rst Add dbus-vmstate object 2020-01-06 18:41:32 +04:00
firmware.json hw/ppc/prep: Remove the deprecated "prep" machine and the OpenHackware BIOS 2020-02-02 14:07:57 +11:00
index.rst docs: Move tools documentation to tools manual 2020-02-25 10:48:06 +00:00
live-block-operations.rst Remove the deprecated -nodefconfig option 2018-08-31 09:52:46 +02:00
nbd.txt nbd: Prepare for NBD_CMD_FLAG_FAST_ZERO 2019-09-05 16:03:13 -05:00
parallels.txt docs: create interop/ subdirectory 2017-06-15 11:18:39 +02:00
pr-helper.rst global: Squash 'the the' 2019-11-06 17:19:40 +01:00
prl-xml.txt docs/interop/prl-xml: description of Parallels Disk format 2018-01-22 14:02:33 +00:00
qcow2.txt docs: qcow2: introduce compression type feature 2020-02-20 16:42:52 +01:00
qed_spec.txt docs: create interop/ subdirectory 2017-06-15 11:18:39 +02:00
qemu-ga-ref.texi docs: create interop/ subdirectory 2017-06-15 11:18:39 +02:00
qemu-ga.rst qemu-ga: Convert invocation documentation to rST 2019-09-13 16:05:01 +01:00
qemu-qmp-ref.texi docs: create interop/ subdirectory 2017-06-15 11:18:39 +02:00
qmp-intro.txt docs/interop/qmp: Improve OOB documentation 2018-07-03 23:09:31 +02:00
qmp-spec.txt docs: Update references to JSON RFC 2018-12-13 19:10:06 +01:00
vhost-user-gpu.rst vhost-user: add vhost_user_gpu_set_socket() 2019-05-29 06:29:07 +02:00
vhost-user.json virtiofsd: add --print-capabilities option 2020-01-23 16:41:36 +00:00
vhost-user.rst misc: Replace zero-length arrays with flexible array member (manual) 2020-03-16 22:07:42 +01:00
vnc-ledstate-Pseudo-encoding.txt docs: create interop/ subdirectory 2017-06-15 11:18:39 +02:00