From 8c78881f481401ec3cfbdce2267101cf300cd4b1 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Wed, 13 Oct 2010 18:38:07 +0000 Subject: cirrus: avoid write only variables Compiling with GCC 4.6.0 20100925 produced a lot of warnings like: In file included from /src/qemu/hw/cirrus_vga_rop.h:174:0, from /src/qemu/hw/cirrus_vga.c:284: /src/qemu/hw/cirrus_vga_rop2.h: In function 'cirrus_patternfill_0_8': /src/qemu/hw/cirrus_vga_rop2.h:48:18: error: variable 'col' set but not used [-Werror=unused-but-set-variable] /src/qemu/hw/cirrus_vga_rop2.h: In function 'cirrus_colorexpand_transp_0_8': /src/qemu/hw/cirrus_vga_rop2.h:104:18: error: variable 'col' set but not used [-Werror=unused-but-set-variable] Fix the warnings by introducing an inline function, which avoids exposing write-only variables. Signed-off-by: Blue Swirl --- hw/cirrus_vga.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'hw/cirrus_vga.c') diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index bbd4b082d2..aadc56f692 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -280,63 +280,63 @@ static void cirrus_bitblt_fill_nop(CirrusVGAState *s, } #define ROP_NAME 0 -#define ROP_OP(d, s) d = 0 +#define ROP_FN(d, s) 0 #include "cirrus_vga_rop.h" #define ROP_NAME src_and_dst -#define ROP_OP(d, s) d = (s) & (d) +#define ROP_FN(d, s) (s) & (d) #include "cirrus_vga_rop.h" #define ROP_NAME src_and_notdst -#define ROP_OP(d, s) d = (s) & (~(d)) +#define ROP_FN(d, s) (s) & (~(d)) #include "cirrus_vga_rop.h" #define ROP_NAME notdst -#define ROP_OP(d, s) d = ~(d) +#define ROP_FN(d, s) ~(d) #include "cirrus_vga_rop.h" #define ROP_NAME src -#define ROP_OP(d, s) d = s +#define ROP_FN(d, s) s #include "cirrus_vga_rop.h" #define ROP_NAME 1 -#define ROP_OP(d, s) d = ~0 +#define ROP_FN(d, s) ~0 #include "cirrus_vga_rop.h" #define ROP_NAME notsrc_and_dst -#define ROP_OP(d, s) d = (~(s)) & (d) +#define ROP_FN(d, s) (~(s)) & (d) #include "cirrus_vga_rop.h" #define ROP_NAME src_xor_dst -#define ROP_OP(d, s) d = (s) ^ (d) +#define ROP_FN(d, s) (s) ^ (d) #include "cirrus_vga_rop.h" #define ROP_NAME src_or_dst -#define ROP_OP(d, s) d = (s) | (d) +#define ROP_FN(d, s) (s) | (d) #include "cirrus_vga_rop.h" #define ROP_NAME notsrc_or_notdst -#define ROP_OP(d, s) d = (~(s)) | (~(d)) +#define ROP_FN(d, s) (~(s)) | (~(d)) #include "cirrus_vga_rop.h" #define ROP_NAME src_notxor_dst -#define ROP_OP(d, s) d = ~((s) ^ (d)) +#define ROP_FN(d, s) ~((s) ^ (d)) #include "cirrus_vga_rop.h" #define ROP_NAME src_or_notdst -#define ROP_OP(d, s) d = (s) | (~(d)) +#define ROP_FN(d, s) (s) | (~(d)) #include "cirrus_vga_rop.h" #define ROP_NAME notsrc -#define ROP_OP(d, s) d = (~(s)) +#define ROP_FN(d, s) (~(s)) #include "cirrus_vga_rop.h" #define ROP_NAME notsrc_or_dst -#define ROP_OP(d, s) d = (~(s)) | (d) +#define ROP_FN(d, s) (~(s)) | (d) #include "cirrus_vga_rop.h" #define ROP_NAME notsrc_and_notdst -#define ROP_OP(d, s) d = (~(s)) & (~(d)) +#define ROP_FN(d, s) (~(s)) & (~(d)) #include "cirrus_vga_rop.h" static const cirrus_bitblt_rop_t cirrus_fwd_rop[16] = { -- cgit v1.2.3