I have this part of code, in the codebase, and while running coverity I have come up with an MISRA issue 14.3.
typedef uint8_t INSTANCE;
#define INSTANCE_1 (0U)
#define INSTANCE_2 (1U)
...
#define INSTANCE_11 (11U)
int fun(INSTANCE x)
{
// I am getting the MISRA issue Controlling expression "0U <= x" is invariant.
if (INSTANCE_1 <= x && x <= INSTANCE_11) {
do_something()
}
}
Not sure how to fix this MISRA issue 14.3.