qemu-e2k/target
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
..
alpha tcg: Remove TCGV_UNUSED* and TCGV_IS_UNUSED* 2017-12-29 12:43:39 -08:00
arm maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
cris tcg: Dynamically allocate TCGOps 2017-12-29 12:43:39 -08:00
hppa tcg: Remove TCGV_UNUSED* and TCGV_IS_UNUSED* 2017-12-29 12:43:39 -08:00
i386 irq: fix memory leak 2018-01-16 14:54:51 +01:00
lm32 tcg: Dynamically allocate TCGOps 2017-12-29 12:43:39 -08:00
m68k -----BEGIN PGP SIGNATURE----- 2018-01-08 21:39:44 +00:00
microblaze tcg: Dynamically allocate TCGOps 2017-12-29 12:43:39 -08:00
mips mips: Tweak location of ';' in macros 2018-01-16 14:54:51 +01:00
moxie target/moxie: Fix tlb_fill 2017-12-27 17:20:44 -08:00
nios2 tcg: Remove TCGV_UNUSED* and TCGV_IS_UNUSED* 2017-12-29 12:43:39 -08:00
openrisc target/*helper: don't check retaddr before calling cpu_restore_state 2017-12-27 17:20:44 -08:00
ppc target/ppc: more use of the PPC_*() macros 2018-01-10 12:53:00 +11:00
s390x maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
sh4 tcg: Remove TCGV_UNUSED* and TCGV_IS_UNUSED* 2017-12-29 12:43:39 -08:00
sparc target/sparc: remove MemoryRegionSection check code from sparc_cpu_get_phys_page_debug() 2018-01-09 21:31:31 +00:00
tilegx tcg: Remove TCGV_UNUSED* and TCGV_IS_UNUSED* 2017-12-29 12:43:39 -08:00
tricore target/*helper: don't check retaddr before calling cpu_restore_state 2017-12-27 17:20:44 -08:00
unicore32 tcg: Remove TCGV_UNUSED* and TCGV_IS_UNUSED* 2017-12-29 12:43:39 -08:00
xtensa target/xtensa: implement disassembler 2018-01-09 09:55:39 -08:00