qemu-e2k/hw
Eric Blake 2562755ee7 maint: Fix macros with broken 'do/while(0); ' usage
The point of writing a macro embedded in a 'do { ... } while (0)'
loop (particularly if the macro has multiple statements or would
otherwise end with an 'if' statement) is so that the macro can be
used as a drop-in statement with the caller supplying the
trailing ';'.  Although our coding style frowns on brace-less 'if':
  if (cond)
    statement;
  else
    something else;
that is the classic case where failure to use do/while(0) wrapping
would cause the 'else' to pair with any embedded 'if' in the macro
rather than the intended outer 'if'.  But conversely, if the macro
includes an embedded ';', then the same brace-less coding style
would now have two statements, making the 'else' a syntax error
rather than pairing with the outer 'if'.  Thus, even though our
coding style with required braces is not impacted, ending a macro
with ';' makes our code harder to port to projects that use
brace-less styles.

The change should have no semantic impact.  I was not able to
fully compile-test all of the changes (as some of them are
examples of the ugly bit-rotting debug print statements that are
completely elided by default, and I didn't want to recompile
with the necessary -D witnesses - cleaning those up is left as a
bite-sized task for another day); I did, however, audit that for
all files touched, all callers of the changed macros DID supply
a trailing ';' at the callsite, and did not appear to be used
as part of a brace-less conditional.

Found mechanically via: $ git grep -B1 'while (0);' | grep -A1 \\\\

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20171201232433.25193-7-eblake@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-01-16 14:54:52 +01:00
..
9pfs 9pfs: deprecate handle backend 2018-01-08 11:18:23 +01:00
acpi
adc maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
alpha
arm imx_fec: Do not link to netdev 2018-01-11 13:25:34 +00:00
audio
block maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
bt
char maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
core
cpu
cris
display maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
dma maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
gpio
i2c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
i386 pc: fail memory hot-plug/unplug with -no-acpi and Q35 machine type 2018-01-12 09:54:13 +01:00
ide hw/ide: Emulate SiI3112 SATA controller 2018-01-10 12:53:00 +11:00
input Split adb.c into adb.c, adb-mouse.c and adb-kbd.c 2017-12-21 20:11:28 +01:00
intc hw/intc/arm_gic: reserved register addresses are RAZ/WI 2018-01-11 13:25:40 +00:00
ipack
ipmi
isa
lm32
m68k
mem
microblaze
mips hw/mips/boston: Remove workaround for writes to ROM aborting 2017-12-21 09:30:32 +01:00
misc maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
moxie hw/moxie/moxiesim: Add support for loading a BIOS on moxiesim 2017-12-21 09:30:31 +01:00
net maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
nios2
nvram mips: fix potential fopen(NULL,...) 2018-01-16 14:54:50 +01:00
openrisc
pci
pci-bridge
pci-host sun4u: split IOMMU device out from apb.c to sun4u_iommu.c 2018-01-09 21:48:20 +00:00
pcmcia
ppc spapr: Correct compatibility mode setting for hotplugged CPUs 2018-01-10 12:53:00 +11:00
s390x
scsi scsi-disk: release AioContext in unaligned WRITE SAME case 2018-01-16 14:54:50 +01:00
sd hw/sd/pxa2xx_mmci: add read/write() trace events 2018-01-11 13:25:39 +00:00
sh4
smbios
sparc sun4m: remove include/hw/sparc/sun4m.h and all references to it 2018-01-09 21:48:20 +00:00
sparc64 sun4u_iommu: add trace event for IOMMU translations 2018-01-09 21:48:20 +00:00
ssi maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
timer maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
tpm maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
tricore
unicore32
usb
vfio
virtio
watchdog
xen
xenpv
xtensa
Makefile.objs