qemu-patch-raspberry4/hw/timer
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
..
a9gtimer.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
allwinner-a10-pit.c hw/ptimer: Introduce timer policy feature 2016-09-22 18:13:06 +01:00
altera_timer.c altera_timer: fix incorrect memset 2017-06-04 18:42:55 +03:00
arm_mptimer.c arm_mptimer: Convert to use ptimer 2016-10-24 16:26:53 +01:00
arm_timer.c hw/ptimer: Introduce timer policy feature 2016-09-22 18:13:06 +01:00
armv7m_systick.c armv7m: Split systick out from NVIC 2017-02-28 16:18:49 +00:00
aspeed_timer.c timer/aspeed: fix timer enablement when a reload is not set 2017-06-13 14:57:00 +01:00
cadence_ttc.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
cmsdk-apb-timer.c hw/char/cmsdk-apb-timer: Implement CMSDK APB timer device 2017-07-17 13:36:08 +01:00
digic-timer.c hw/ptimer: Introduce timer policy feature 2016-09-22 18:13:06 +01:00
ds1338.c i2c: Allow I2C devices to NAK start events 2017-01-09 11:40:20 +00:00
etraxfs_timer.c shutdown: Add source information to SHUTDOWN and RESET 2017-05-23 13:28:17 +02:00
exynos4210_mct.c hw/timer/exynos4210_mct: Remove unused defines 2017-06-13 14:56:57 +01:00
exynos4210_pwm.c hw/arm/exynos: Convert fprintf to qemu_log_mask/error_report 2017-04-20 17:39:17 +01:00
exynos4210_rtc.c hw/arm/exynos: Convert fprintf to qemu_log_mask/error_report 2017-04-20 17:39:17 +01:00
grlib_gptimer.c clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
hpet.c hpet: recover timer offset correctly 2018-01-12 13:22:02 +01:00
i8254.c hw/timer/i8254: rename pit_init() -> i8254_pit_init() 2017-12-18 17:07:02 +03:00
i8254_common.c hw/timer/i8254: rename pit_init() -> i8254_pit_init() 2017-12-18 17:07:02 +03:00
imx_epit.c imx: Use 'const char', not 'char const' 2016-09-22 18:13:09 +01:00
imx_gpt.c ARM i.MX timers: fix reset handling 2017-02-28 12:08:16 +00:00
lm32_timer.c hw/ptimer: Introduce timer policy feature 2016-09-22 18:13:06 +01:00
m48t59-internal.h Split ISA and sysbus versions of m48t59 device 2017-02-06 12:33:21 +11:00
m48t59-isa.c Split ISA and sysbus versions of m48t59 device 2017-02-06 12:33:21 +11:00
m48t59.c hw/timer: QOM'ify m48txx_sysbus 2017-06-02 05:54:43 +01:00
Makefile.objs msf2: Add Smartfusion2 System timer 2017-09-21 16:36:56 +01:00
mc146818rtc.c hw/timer/mc146818: rename rtc_init() -> mc146818_rtc_init() 2017-12-18 17:07:02 +03:00
milkymist-sysctl.c shutdown: Add source information to SHUTDOWN and RESET 2017-05-23 13:28:17 +02:00
mips_gictimer.c hw/mips_gictimer: provide API for retrieving frequency 2017-02-21 22:24:58 +00:00
mss-timer.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
omap_gptimer.c hw/timer/omap_gptimer: Don't use old_mmio 2017-09-21 16:34:27 +01:00
omap_synctimer.c hw/timer/omap_synctimer.c: Don't use old_mmio 2017-09-21 16:34:27 +01:00
pl031.c migration: pre_save return int 2017-09-27 11:35:59 +01:00
puv3_ost.c hw/ptimer: Introduce timer policy feature 2016-09-22 18:13:06 +01:00
pxa2xx_timer.c hw/timer/pxa2xx_timer: replace hw_error() -> qemu_log_mask() 2018-01-11 13:25:38 +00:00
sh_timer.c hw/ptimer: Introduce timer policy feature 2016-09-22 18:13:06 +01:00
slavio_timer.c sun4m: remove include/hw/sparc/sun4m.h and all references to it 2018-01-09 21:48:20 +00:00
stm32f2xx_timer.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
sun4v-rtc.c target-sparc: move common cpu initialisation routines to sparc64.c 2017-01-18 22:03:44 +01:00
trace-events trace-events: fix code style: print 0x before hex numbers 2017-08-01 12:13:07 +01:00
twl92230.c migration: pre_save return int 2017-09-27 11:35:59 +01:00
xilinx_timer.c hw/ptimer: Introduce timer policy feature 2016-09-22 18:13:06 +01:00