qemu-e2k/hw/dma
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
..
Makefile.objs sun4m: move sun4m_iommu.c from hw/dma to hw/sparc 2018-01-09 21:48:19 +00:00
bcm2835_dma.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
etraxfs_dma.c etraxfs_dma: Dont forward zero-length payload to clients 2016-02-20 00:17:48 +01:00
i8257.c qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
i82374.c i8257: pass ISA bus to DMA_init() function 2016-02-03 11:28:55 -05:00
omap_dma.c dma: omap: check dma channel data_type 2017-01-27 15:29:08 +00:00
pl080.c hw/dma/pl080: Fix bad bit mask (PL080_CONF_M1 | PL080_CONF_M1) 2016-10-17 19:22:17 +01:00
pl330.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
puv3_dma.c unicore: Clean up includes 2016-01-29 15:07:22 +00:00
pxa2xx_dma.c hw/dma: QOM'ify pxa2xx_dma.c 2016-06-14 15:59:14 +01:00
rc4030.c memory/iommu: introduce IOMMUMemoryRegionClass 2017-07-14 12:04:41 +02:00
soc_dma.c hw: Clean up includes 2016-01-29 15:07:25 +00:00
sparc32_dma.c sun4m: remove include/hw/sparc/sun4m.h and all references to it 2018-01-09 21:48:20 +00:00
trace-events sun4m: move sun4m_iommu.c from hw/dma to hw/sparc 2018-01-09 21:48:19 +00:00
xilinx_axidma.c xilinx_axidma: Convert to DEFINE_PROP_LINK 2017-09-07 13:54:51 +01:00
xlnx-zynq-devcfg.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
xlnx_dpdma.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00