From e538601128c1a8bb4247a817da2bbb3f671811b3 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 1 Nov 2020 15:52:48 -0800 Subject: [PATCH] int10: wrap entire V_ADDR_R* macros in parens for safer expansion Resolves warnings from Oracle Parfait static analyser: Error: Misleading macro Misleading macro [misleading-macro]: misleading evaluation of ternary '?:' operator in expansion of macro V_ADDR_RB due to missing parentheses at line 392 of hw/xfree86/int10/generic.c. '|' operator has higher precedence than ternary '?:' operator inside macro body at line 431 low precedence ternary '?:' operator is hidden by expansion of macro V_ADDR_RB at line 431 Misleading macro [misleading-macro]: misleading evaluation of ternary '?:' operator in expansion of macro V_ADDR_RB due to missing parentheses at line 392 of hw/xfree86/int10/generic.c. '<<' operator has higher precedence than ternary '?:' operator inside macro body at line 431 low precedence ternary '?:' operator is hidden by expansion of macro V_ADDR_RB at line 431 Misleading macro [misleading-macro]: misleading evaluation of ternary '?:' operator in expansion of macro V_ADDR_RB due to missing parentheses at line 392 of hw/xfree86/int10/generic.c. '<<' operator has higher precedence than ternary '?:' operator inside macro body at line 442 low precedence ternary '?:' operator is hidden by expansion of macro V_ADDR_RB at line 442 Misleading macro [misleading-macro]: misleading evaluation of ternary '?:' operator in expansion of macro V_ADDR_RB due to missing parentheses at line 392 of hw/xfree86/int10/generic.c. '<<' operator has higher precedence than ternary '?:' operator inside macro body at line 443 low precedence ternary '?:' operator is hidden by expansion of macro V_ADDR_RB at line 443 Misleading macro [misleading-macro]: misleading evaluation of ternary '?:' operator in expansion of macro V_ADDR_RB due to missing parentheses at line 392 of hw/xfree86/int10/generic.c. '|' operator has higher precedence than ternary '?:' operator inside macro body at line 443 low precedence ternary '?:' operator is hidden by expansion of macro V_ADDR_RB at line 441 Misleading macro [misleading-macro]: misleading evaluation of ternary '?:' operator in expansion of macro V_ADDR_RB due to missing parentheses at line 392 of hw/xfree86/int10/generic.c. '<<' operator has higher precedence than ternary '?:' operator inside macro body at line 443 low precedence ternary '?:' operator is hidden by expansion of macro V_ADDR_RB at line 443 Signed-off-by: Alan Coopersmith --- hw/xfree86/int10/generic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c index 1811efb14..191571192 100644 --- a/hw/xfree86/int10/generic.c +++ b/hw/xfree86/int10/generic.c @@ -389,14 +389,14 @@ xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) #define VRAM(addr) ((addr >= V_RAM) && (addr < (V_RAM + VRAM_SIZE))) #define V_ADDR_RB(addr) \ - (VRAM(addr)) ? MMIO_IN8((uint8_t*)VRAM_BASE,VRAM_ADDR(addr)) \ - : *(uint8_t*) V_ADDR(addr) + ((VRAM(addr)) ? MMIO_IN8((uint8_t*)VRAM_BASE,VRAM_ADDR(addr)) \ + : *(uint8_t*) V_ADDR(addr)) #define V_ADDR_RW(addr) \ - (VRAM(addr)) ? MMIO_IN16((uint16_t*)VRAM_BASE,VRAM_ADDR(addr)) \ - : ldw_u((void *)V_ADDR(addr)) + ((VRAM(addr)) ? MMIO_IN16((uint16_t*)VRAM_BASE,VRAM_ADDR(addr)) \ + : ldw_u((void *)V_ADDR(addr))) #define V_ADDR_RL(addr) \ - (VRAM(addr)) ? MMIO_IN32((uint32_t*)VRAM_BASE,VRAM_ADDR(addr)) \ - : ldl_u((void *)V_ADDR(addr)) + ((VRAM(addr)) ? MMIO_IN32((uint32_t*)VRAM_BASE,VRAM_ADDR(addr)) \ + : ldl_u((void *)V_ADDR(addr))) #define V_ADDR_WB(addr,val) \ if(VRAM(addr)) \