mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 12:09:58 +00:00
2562755ee7
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> |
||
---|---|---|
.. | ||
alpha | ||
cris | ||
lm32 | ||
mips | ||
openrisc | ||
xtensa | ||
hello-arm.c | ||
hello-i386.c | ||
hello-mips.c | ||
linux-test.c | ||
Makefile | ||
pi_10.com | ||
README | ||
runcom.c | ||
sha1.c | ||
test_path.c | ||
test-arm-iwmmxt.s | ||
test-i386-code16.S | ||
test-i386-fprem.c | ||
test-i386-muldiv.h | ||
test-i386-shift.h | ||
test-i386-ssse3.c | ||
test-i386-vm86.S | ||
test-i386.c | ||
test-i386.h | ||
test-mmap.c | ||
testthread.c |
This directory contains various interesting programs for regression testing. The target "make test" runs the programs and, if applicable, runs "diff" to detect mismatches between output on the host and output on QEMU. i386 ==== test-i386 --------- This program executes most of the 16 bit and 32 bit x86 instructions and generates a text output, for comparison with the output obtained with a real CPU or another emulator. The Linux system call modify_ldt() is used to create x86 selectors to test some 16 bit addressing and 32 bit with segmentation cases. The Linux system call vm86() is used to test vm86 emulation. Various exceptions are raised to test most of the x86 user space exception reporting. linux-test ---------- This program tests various Linux system calls. It is used to verify that the system call parameters are correctly converted between target and host CPUs. test-i386-fprem --------------- runcom ------ test-mmap --------- sha1 ---- hello-i386 ---------- ARM === hello-arm --------- test-arm-iwmmxt --------------- MIPS ==== hello-mips ---------- hello-mipsel ------------ CRIS ==== The testsuite for CRIS is in tests/tcg/cris. You can run it with "make test-cris". LM32 ==== The testsuite for LM32 is in tests/tcg/cris. You can run it with "make test-lm32".