mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
display: avoid multi-statement macro
For blizzard, pl110 and tc6393xb this is harmless, but for pxa2xx Coverity noticed that it is used inside an "if" statement. Fix it because it's the file with the highest number of defects in the whole QEMU tree! Use "do...while (0)", or just remove the semicolon if there's a single statement in the macro. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
b48adc0d30
commit
2cdaca90dd
4 changed files with 59 additions and 29 deletions
|
@ -14,12 +14,16 @@
|
|||
#if BITS == 8
|
||||
#define COPY_PIXEL(to, from) *(to++) = from
|
||||
#elif BITS == 15 || BITS == 16
|
||||
#define COPY_PIXEL(to, from) *(uint16_t *)to = from; to += 2;
|
||||
#define COPY_PIXEL(to, from) do { *(uint16_t *)to = from; to += 2; } while (0)
|
||||
#elif BITS == 24
|
||||
#define COPY_PIXEL(to, from) \
|
||||
*(to++) = from; *(to++) = (from) >> 8; *(to++) = (from) >> 16
|
||||
#define COPY_PIXEL(to, from) \
|
||||
do { \
|
||||
*(to++) = from; \
|
||||
*(to++) = (from) >> 8; \
|
||||
*(to++) = (from) >> 16; \
|
||||
} while (0)
|
||||
#elif BITS == 32
|
||||
#define COPY_PIXEL(to, from) *(uint32_t *)to = from; to += 4;
|
||||
#define COPY_PIXEL(to, from) do { *(uint32_t *)to = from; to += 4; } while (0)
|
||||
#else
|
||||
#error unknown bit depth
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue