Static analysis with preprocessor directives

User5678User5678 Posts: 1
edited March 2 in C/C++test

I am running static analysis tool on C code and getting a MISRA2012 Rule 5.5b violation: The names of macros that exist prior to preprocessing should be distinct from the identifiers that exist after preprocessing (c99) [MISRAC2012-RULE_5_5-b]. It appears the cpptestcli is processing both the #ifdef clause and the #else clause of the preprocessor directive. Is there something I need to configure so the tool will understand the preprocessor directives and only analyze one part of the if/else preprocessor directive?

Code fragment:

#ifdef UseLIBa

#define KPH_Sec T_KPH_SEC_07

#else

#define Fixed_07 KPH_Sec

#endif

Sign In or Register to comment.