xf86-video-nv: src/riva_hw.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 2 18:55:54 UTC 2024


 src/riva_hw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c8ab8f7868c1891a146e9f679278b990f1e23516
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Jan 26 09:27:20 2024 -0800

    riva_hw.c: Ensure ABS macro expands correctly
    
    Handles warning from Oracle Parfait static analyser:
    
    Error: Misleading macro
       Misleading macro [misleading-macro]:
          misleading evaluation of unary '-' operator in expansion of macro ABS due to missing parentheses
            at line 104 of src/riva_hw.c.
            binary '+' operator has lower precedence than unary '-' operator inside macro body at line 298
            if (ABS(ainfo->vburst_size) + (ABS(ainfo->wcvlwm + 32) & ~0xf)  - tmp> VFIFO_SIZE)
            low precedence binary '+' operator is hidden by expansion of macro argument a at line 104
            #define ABS(a)  (a>0?a:-a)
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/src/riva_hw.c b/src/riva_hw.c
index c178eac..9903625 100644
--- a/src/riva_hw.c
+++ b/src/riva_hw.c
@@ -101,7 +101,7 @@ static int ShowHideCursor
 #define GFIFO_SIZE_128	256
 #define MFIFO_SIZE	120
 #define VFIFO_SIZE	256
-#define	ABS(a)	(a>0?a:-a)
+#define	ABS(a)	((a) > 0 ? (a) : -(a))
 typedef struct {
   int gdrain_rate;
   int vdrain_rate;


More information about the xorg-commit mailing list