LCLint User's Guide

LCLint is a tool for statically checking C programs. With minimal effort, LCLint can be used as a better lint.
[1] If additional effort is invested adding annotations to programs, LCLint can perform stronger checks than can be done by any standard lint.

Some problems detected by LCLint include:

LCLint checking can be customized to select what classes of errors are reported using command line flags and stylized comments in the code.

This document is a guide to using LCLint. Section 1 is a brief overview of the design goals of LCLint. Section 2 explains how to run LCLint, interpret messages produce, and control checking. Sections 3-10 describe particular checks done by LCLint.

1. Overview

The main goals for LCLint are to:

LCLint does many of the traditional lint checks including unused declarations, type inconsistencies, use-before-definition, unreachable code, ignored return values, execution paths with no return, likely infinite loops, and fall-through cases. This document focuses on more powerful checks that are made possible by additional information given in source code annotations. [2] Annotations are stylized comments that document certain assumptions about functions, variables, parameters, and types. They may be used to indicate where the representation of a user-defined type is hidden, to limit where a global variable may be used or modified, to constrain what a function implementation may do to its parameters, and to express checked assumptions about variables, types, structure fields, function parameters, and function results. In addition to the checks specifically enabled by annotations, many of the traditional lint checks are improved by exploiting this additional information.

Next: Operation
Contents