diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2014-01-31 14:47:33 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2014-01-31 14:47:33 +0000 |
| commit | 2cdaca90ddf3291f308a10623c1a802ef760bac1 (patch) | |
| tree | e5b7734441cf70ebeee56b9d20d09afe362f0aac /hw/display/pl110_template.h | |
| parent | b48adc0d301464d627d6d0f83dee911a2138187f (diff) | |
| download | focaccia-qemu-2cdaca90ddf3291f308a10623c1a802ef760bac1.tar.gz focaccia-qemu-2cdaca90ddf3291f308a10623c1a802ef760bac1.zip | |
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>
Diffstat (limited to 'hw/display/pl110_template.h')
| -rw-r--r-- | hw/display/pl110_template.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/hw/display/pl110_template.h b/hw/display/pl110_template.h index e738e4a241..36ba791c6f 100644 --- a/hw/display/pl110_template.h +++ b/hw/display/pl110_template.h @@ -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 |