Hi,
I'm using cppcheck with misra.py and I get the misra rule 15.6 error while I think it's not supposed to be reported.
I also checked the same code in https://www.gimpel.com/demo.html and it doesn't report the MISRA 15.6 rule failure.
could it be an issue of the misra.py addon?
Here the tested code:
typedef int Std_ReturnType; typedef unsigned int uint32; #define E_OK 0 #define E_NOT_OK 1 #define STD_ON 1 #define SOME_DEF STD_ON extern uint32 func_value(void); extern void func2(void); extern void fancyFunc(void); int main(void) { uint32 some_condition = func_value(); Std_ReturnType retVal = E_OK; #if SOME_DEF == STD_ON if(some_condition > 2u){ func2(); retVal = E_NOT_OK; } if(retVal == E_OK) #endif { fancyFunc(); } return retVal; }
Hope it helps to improve quality of the tool!
Hello, Albert,
Thanks, I can confirm this false positive. I created this ticket (and here is a fix).
Thanks a lot for the fast feedback and the fix :)!
Log in to post a comment.
Hi,
I'm using cppcheck with misra.py and I get the misra rule 15.6 error while I think it's not supposed to be reported.
I also checked the same code in https://www.gimpel.com/demo.html and it doesn't report the MISRA 15.6 rule failure.
could it be an issue of the misra.py addon?
Here the tested code:
Hope it helps to improve quality of the tool!
Hello, Albert,
Thanks, I can confirm this false positive. I created this ticket (and here is a fix).
Last edit: Georgiy Komarov 2020-05-07
Thanks a lot for the fast feedback and the fix :)!