LINT(1) BSD LINT(1)
NAME
lint - a C program verifier
SYNOPSIS
lint [ -abchnpuvx ] file ...
DESCRIPTION
lint attempts to detect features of C program files that are likely to be
erroneous, non-portable, or wasteful. It also checks the type usage of
the program more strictly than the compilers, searching for unreachable
statements, loops not entered at the top, automatic variables declared
and not used, and logical expressions whose value is constant. Moreover,
lint looks for functions that return values in some places and not in
others, functions that are called with varying numbers of arguments, and
functions whose values are not used.
By default, lint assumes that all the files are to be loaded together.
It checks them for mutual compatibility. Function definitions for
certain libraries are available to lint. These libraries are referenced
by a conventional name, such as -lm, in the style of ld(1). Arguments
ending in .ln are also treated as library files.
OPTIONS
You can use any number of the options listed below. lint also recognizes
the -D, -U, and -I options of cc(1) as separate arguments.
-p Attempt to check portability to the IBM and GCOS dialects of C.
-h Apply a number of heuristic tests to attempt to intuit bugs,
improve style, and reduce waste.
-b Report break statements that cannot be reached. This is not
the default, because most lex(1) and many yacc(1) outputs
produce dozens of such comments.
-v Suppress complaints about unused arguments in functions.
-x Report variables referred to by external declarations, but
never used.
-a Report assignments of long values to integer variables.
-c Complain about casts that have questionable portability.
-u Do not complain about functions and variables used and not
defined, or defined and not used. This is suitable for running
lint on a subset of files from a larger program.
-n Do not check compatibility against the standard library.
-z Do not complain about structures that are never defined (for
example, allow the use of a structure pointer without knowing
its contents).
-C Create lint libraries, as in lint -Cfoo files . . . where
files are the C sources of library foo. The result is a file
llib-lfoo.ln in the correct library format suitable for linting
programs using foo.
C SOURCE COMMENTS
Certain conventional comments in the C source change the behavior of
lint:
/*NOTREACHED*/
At appropriate points, stops comments about unreachable code.
/*VARARGSn*/
Suppresses the usual checking for variable numbers of arguments in
the following function declaration. Checks the data types of the
first n arguments. Takes a missing n to be 0.
/*NOSTRICT*/
Shuts off strict type checking in the next expression.
/*ARGSUSED*/
Turns on the -v option for the next function.
/*LINTLIBRARY*/
At the beginning of a file, shuts off complaints about unused
functions in the file.
FILES
/usr/lib/lint/lint[12] Programs
/usr/lib/lint/llib-lc.ln Declarations for standard functions
/usr/lib/lint/llib-lc Human-readable version of the above declarations file
/usr/lib/lint/llib-port.ln Declarations for portable functions
/usr/lib/lint/llib-port Human readable . . .
llib-l*.ln Library created with -C
BUGS
lint does not understand functions that do not return, for example,
exit(2).
There are some things you just can't get lint to shut up about.
/*NOSTRICT*/ is not implemented in the current version.
SEE ALSO
cc(1), ld(1)