Free static checker for C99 code

Posted by detly on Stack Overflow See other posts from Stack Overflow or by detly
Published on 2010-04-27T03:51:20Z Indexed on 2010/04/27 3:53 UTC
Read the original article Hit count: 453

Filed under:
|
|
|
|

I am looking for a free static checker for C99 code (including GCC extensions) with the ability to explicitly say "these preprocessor macros are always defined."

I need that last part because I am compiling embedded code for a single target processor. The compiler (Microchip's C32, GCC based) sets a macro based on the selected processor, which is then used in the PIC32 header files to select a processor-specific header file to include. cppcheck therefore fails because it detects the 30 different #ifdefs used to select one of the many possible PIC32 processors, tries to analyse all possible combinations of these plus all other #defines, and fails.

For example, if splint could process C99 code, I would use

splint -D__PIC32_FEATURE_SET__=460 -D__32MX460F512L__ \
-D__LANGUAGE_C__ -I/path/to/my/includes source.c

© Stack Overflow or respective owner

Related posts about c

    Related posts about static-analysis