tiny-lint-c
tiny-lint-c copied to clipboard
A small and simple static analysis tool for C in C
tiny-lint-c
A small and simple static analysis tool for C implemented in C
Description
A small "linter" for C written in C99, demonstrating shallow static analysis at the lexical level of abstraction.
There are currently five checks implemented:
-
A check for nullary function prototypes declared incorrectly, e.g. in the form of
f()
instead off(void)
. -
A check for variable names that have a misleading prefix, e.g.
uint32_t u8var
instead ofuint32_t u32var
. -
A check for seemingly misplaced semi-colons after control statements (if, for, while), e.g.
if (x); { ... }
. -
A check for assignments in expressions deciding control-flow (if, for, while), e.g.
if (v = 0) { ... }
. -
A check for too many
return
-statements in a function (configurable limits on 'too many'), warning if a function canreturn
from more than e.g. 3 places.
NOTE: This is very much a work in progress still. It should be fairly easy to hack on though.