qemu-e2k/hw/char
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
..
bcm2835_aux.c char: add backend hotswap handler 2017-07-14 11:04:33 +02:00
cadence_uart.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
cmsdk-apb-uart.c hw/arm/mps2: Add UARTs 2017-07-17 13:36:08 +01:00
debugcon.c misc: drop old i386 dependency 2017-12-18 17:07:03 +03:00
digic-uart.c char: add backend hotswap handler 2017-07-14 11:04:33 +02:00
escc.c qapi: Mechanically convert FOO_lookup[...] to FOO_str(...) 2017-09-04 13:09:13 +02:00
etraxfs_ser.c char: add backend hotswap handler 2017-07-14 11:04:33 +02:00
exynos4210_uart.c char: avoid chardevice direct access 2017-07-14 11:04:33 +02:00
grlib_apbuart.c char: avoid chardevice direct access 2017-07-14 11:04:33 +02:00
imx_serial.c char: add backend hotswap handler 2017-07-14 11:04:33 +02:00
ipoctal232.c char: avoid chardevice direct access 2017-07-14 11:04:33 +02:00
lm32_juart.c char: add backend hotswap handler 2017-07-14 11:04:33 +02:00
lm32_uart.c char: add backend hotswap handler 2017-07-14 11:04:33 +02:00
Makefile.objs hw/char/cmsdk-apb-uart.c: Implement CMSDK APB UART 2017-07-17 13:36:08 +01:00
mcf_uart.c char: add backend hotswap handler 2017-07-14 11:04:33 +02:00
milkymist-uart.c char: add backend hotswap handler 2017-07-14 11:04:33 +02:00
omap_uart.c chardev: move headers to include/chardev 2017-06-02 11:33:52 +04:00
parallel.c chardev: fix parallel device can't be reconnect 2017-07-14 12:04:41 +02:00
pl011.c char: add backend hotswap handler 2017-07-14 11:04:33 +02:00
sclpconsole-lm.c char: avoid chardevice direct access 2017-07-14 11:04:33 +02:00
sclpconsole.c char: avoid chardevice direct access 2017-07-14 11:04:33 +02:00
serial-isa.c
serial-pci.c pci: Add INTERFACE_CONVENTIONAL_PCI_DEVICE to Conventional PCI devices 2017-10-15 05:54:43 +03:00
serial.c Enable 8-byte wide MMIO for 16550 serial devices 2017-11-06 17:15:14 +01:00
sh_serial.c char: avoid chardevice direct access 2017-07-14 11:04:33 +02:00
spapr_vty.c spapr: Implement bug in spapr-vty device to be compatible with PowerVM 2017-11-22 15:28:37 +11:00
stm32f2xx_usart.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
terminal3270.c chardev: introduce qemu_chr_timeout_add_ms() 2018-01-12 13:22:02 +01:00
trace-events trace-events: fix code style: print 0x before hex numbers 2017-08-01 12:13:07 +01:00
virtio-console.c virtio-serial: add enable_backend callback 2017-09-21 11:51:49 +02:00
virtio-serial-bus.c virtio-serial: add enable_backend callback 2017-09-21 11:51:49 +02:00
xen_console.c misc: remove duplicated includes 2017-12-18 17:07:02 +03:00
xilinx_uartlite.c char: add backend hotswap handler 2017-07-14 11:04:33 +02:00