CWARN.NOEFFECT.UCMP.LT.MACRO
Ineffective comparison of unsigned value in a macro is always false
The CWARN.NOEFFECT.UCMP.LT.MACRO checker flags code in macros, in which there is a comparison of an unsigned value to zero that is always false.
Vulnerability and risk
If 'a' is an unsigned value, the comparisons a < 0 and 0 > a are always false. These comparisons have no effect, so it's probable that design intent isn't being accomplished.
Vulnerable code example
Copy
#define RETURN_NEGATIVE(x) if (x < 0) return x
int foo(usigned int a) {
RETURN_NEGATIVE(a);
return 0;
}
Klocwork flags line 4, in which the macro RETURN_NEGATIVE contains a condition that is always false.