LCLint

LCLint is a lint-like tool for ANSI C. It can be used like a traditional lint to detect certain classes of C errors statically; if formal specifications are also supplied, it can do more powerful checking to detect inconsistencies between specifications and code.

Without specifications, LCLint does many of the checks done by a traditional lint. It reports unused declarations, type inconsistencies, use-before-definition, unreachable code, ignored return values, execution paths with no return, likely infinite loops, and fall-through cases. It provides options for stricter type-checking than standard C (e.g., char and bool types can be treated as distinct from ints.). It does not do much of the portability checking (e.g., pointer alignment) done by typical lints.

With partial specifications, written in the Larch interface language, LCL, LCLint does stronger checking. For example, a one-line specification file can declare a type as abstract; LCLint checks that the data abstraction barrier is maintained in clients of the type. This provides the advantages of data encapsulation, making programs easier to understand and maintain.

Adding more specifications enables further checking, including the detection of:

LCLint can be customized to a particular coding style using command line flags. Stylized comments may be used to suppress messages and control checking at a local level.

Available Documentation:

Click here for information on installing LCLint.