Received: from eggs.gnu.org ([2001:4830:134:3::10]:60089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6kqn-0002zt-9h for qemu-devel@nongnu.org; Fri, 24 Jan 2014 12:47:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W6kqe-0007e5-SF for qemu-devel@nongnu.org; Fri, 24 Jan 2014 12:47:29 -0500 Received: from mail-qc0-x229.google.com ([2607:f8b0:400d:c01::229]:47285) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W6kqe-0007dz-NG for qemu-devel@nongnu.org; Fri, 24 Jan 2014 12:47:20 -0500 Received: by mail-qc0-f169.google.com with SMTP id w7so4846969qcr.28 for ; Fri, 24 Jan 2014 09:47:20 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 24 Jan 2014 18:47:11 +0100 Message-Id: <1390585631-20904-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH target-arm] display: avoid multi-statement macro List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org 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! Signed-off-by: Paolo Bonzini --- hw/display/blizzard_template.h | 10 +++++----- hw/display/pl110_template.h | 6 +++--- hw/display/pxa2xx_template.h | 8 ++++---- hw/display/tc6393xb_template.h | 8 ++++---- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/hw/display/blizzard_template.h b/hw/display/blizzard_template.h index a8a8899..b899a29 100644 --- a/hw/display/blizzard_template.h +++ b/hw/display/blizzard_template.h @@ -21,21 +21,21 @@ #define SKIP_PIXEL(to) to += deststep #if DEPTH == 8 # define PIXEL_TYPE uint8_t -# define COPY_PIXEL(to, from) *to = from; SKIP_PIXEL(to) +# define COPY_PIXEL(to, from) *to = from, SKIP_PIXEL(to) # define COPY_PIXEL1(to, from) *to ++ = from #elif DEPTH == 15 || DEPTH == 16 # define PIXEL_TYPE uint16_t -# define COPY_PIXEL(to, from) *to = from; SKIP_PIXEL(to) +# define COPY_PIXEL(to, from) *to = from, SKIP_PIXEL(to) # define COPY_PIXEL1(to, from) *to ++ = from #elif DEPTH == 24 # define PIXEL_TYPE uint8_t # define COPY_PIXEL(to, from) \ - to[0] = from; to[1] = (from) >> 8; to[2] = (from) >> 16; SKIP_PIXEL(to) + to[0] = from, to[1] = (from) >> 8, to[2] = (from) >> 16, SKIP_PIXEL(to) # define COPY_PIXEL1(to, from) \ - *to ++ = from; *to ++ = (from) >> 8; *to ++ = (from) >> 16 + *to ++ = from, *to ++ = (from) >> 8, *to ++ = (from) >> 16 #elif DEPTH == 32 # define PIXEL_TYPE uint32_t -# define COPY_PIXEL(to, from) *to = from; SKIP_PIXEL(to) +# define COPY_PIXEL(to, from) *to = from, SKIP_PIXEL(to) # define COPY_PIXEL1(to, from) *to ++ = from #else # error unknown bit depth diff --git a/hw/display/pl110_template.h b/hw/display/pl110_template.h index e738e4a..3ff42e0 100644 --- a/hw/display/pl110_template.h +++ b/hw/display/pl110_template.h @@ -14,12 +14,12 @@ #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) *(uint16_t *)to = from, to += 2 #elif BITS == 24 #define COPY_PIXEL(to, from) \ - *(to++) = from; *(to++) = (from) >> 8; *(to++) = (from) >> 16 + *(to++) = from, *(to++) = (from) >> 8, *(to++) = (from) >> 16 #elif BITS == 32 -#define COPY_PIXEL(to, from) *(uint32_t *)to = from; to += 4; +#define COPY_PIXEL(to, from) *(uint32_t *)to = from, to += 4 #else #error unknown bit depth #endif diff --git a/hw/display/pxa2xx_template.h b/hw/display/pxa2xx_template.h index 1cbe36c..806f573 100644 --- a/hw/display/pxa2xx_template.h +++ b/hw/display/pxa2xx_template.h @@ -11,14 +11,14 @@ # define SKIP_PIXEL(to) to += deststep #if BITS == 8 -# define COPY_PIXEL(to, from) *to = from; SKIP_PIXEL(to) +# define COPY_PIXEL(to, from) *to = from, SKIP_PIXEL(to) #elif BITS == 15 || BITS == 16 -# define COPY_PIXEL(to, from) *(uint16_t *) to = from; SKIP_PIXEL(to) +# define COPY_PIXEL(to, from) *(uint16_t *) to = from, SKIP_PIXEL(to) #elif BITS == 24 # define COPY_PIXEL(to, from) \ - *(uint16_t *) to = from; *(to + 2) = (from) >> 16; SKIP_PIXEL(to) + *(uint16_t *) to = from, *(to + 2) = (from) >> 16, SKIP_PIXEL(to) #elif BITS == 32 -# define COPY_PIXEL(to, from) *(uint32_t *) to = from; SKIP_PIXEL(to) +# define COPY_PIXEL(to, from) *(uint32_t *) to = from, SKIP_PIXEL(to) #else # error unknown bit depth #endif diff --git a/hw/display/tc6393xb_template.h b/hw/display/tc6393xb_template.h index 154aafd..8fbdd5c 100644 --- a/hw/display/tc6393xb_template.h +++ b/hw/display/tc6393xb_template.h @@ -22,14 +22,14 @@ */ #if BITS == 8 -# define SET_PIXEL(addr, color) *(uint8_t*)addr = color; +# define SET_PIXEL(addr, color) *(uint8_t*)addr = color #elif BITS == 15 || BITS == 16 -# define SET_PIXEL(addr, color) *(uint16_t*)addr = color; +# define SET_PIXEL(addr, color) *(uint16_t*)addr = color #elif BITS == 24 # define SET_PIXEL(addr, color) \ - addr[0] = color; addr[1] = (color) >> 8; addr[2] = (color) >> 16; + addr[0] = color, addr[1] = (color) >> 8, addr[2] = (color) >> 16 #elif BITS == 32 -# define SET_PIXEL(addr, color) *(uint32_t*)addr = color; +# define SET_PIXEL(addr, color) *(uint32_t*)addr = color #else # error unknown bit depth #endif -- 1.8.4.2