qemu/audio
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 buildsys: Move audio libs to per object 2017-09-22 10:20:34 +08:00
alsaaudio.c audio: Clean up includes 2016-02-02 13:57:31 +01:00
audio.c audio: release capture buffers 2017-05-04 08:31:48 +02:00
audio.h replay: add record/replay for audio passthrough 2017-03-01 15:11:44 +01:00
audio_int.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
audio_pt_int.c audio: Clean up includes 2016-02-02 13:57:31 +01:00
audio_pt_int.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
audio_template.h audio: remove plive 2015-06-15 12:42:48 +02:00
audio_win_int.c audio: Clean up includes 2016-02-02 13:57:31 +01:00
audio_win_int.h Windows Waveform Audio driver (no ADC support yet) 2009-10-10 01:18:24 +04:00
coreaudio.c audio: clean up before monitor clean up 2016-08-08 14:17:00 +02:00
dsound_template.h dsoundaudio: remove *_retries kludges 2015-06-15 12:42:48 +02:00
dsoundaudio.c audio: Clean up includes 2016-02-02 13:57:31 +01:00
mixeng.c replay: add record/replay for audio passthrough 2017-03-01 15:11:44 +01:00
mixeng.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
mixeng_template.h audio/mixeng_template.h: fix inline declaration 2013-10-26 13:09:34 +04:00
noaudio.c qemu-common: stop including qemu/host-utils.h from qemu-common.h 2016-05-19 16:42:28 +02:00
ossaudio.c os-posix: include sys/mman.h 2016-06-16 18:39:03 +02:00
paaudio.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
rate_template.h audio: st_rate_flow exist a infinite loop 2017-07-17 11:08:59 +02:00
sdlaudio.c audio/sdlaudio: Allow audio playback with SDL2 2017-03-01 15:12:03 +01:00
spiceaudio.c qemu-common: stop including qemu/host-utils.h from qemu-common.h 2016-05-19 16:42:28 +02:00
trace-events trace-events: fix code style: %# -> 0x% 2017-08-01 12:13:07 +01:00
wavaudio.c qemu-common: stop including qemu/host-utils.h from qemu-common.h 2016-05-19 16:42:28 +02:00
wavcapture.c audio: fix WAVState leak 2017-05-04 09:15:45 +02:00