LINT(1)
NAME
lint − a C program verifier
USAGE
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 with constant values. Moreover, lint looks for functions that 1) return values in some places and not in others, 2) are called with varying numbers of arguments, and 3) have unused values.
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 may use any number of the options listed below. Lint also recognizes the −D, −U, and −I options of cc(1) as separate arguments.
−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.
−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 out of a larger program.
−n Do not check compatibility against the standard library.
−z Do not complain about structures that are never defined (e.g., allow the use of a structure pointer without knowing its contents.).
C SOURCE COMMENTS
Certain conventional comments in the C source change the behavior of lint:
/*NOTREACHED*/
At appropriate points, stop comments about unreachable code.
/*VARARGSn*/
Suppress the usual checking for variable numbers of arguments in the following function declaration. Check the data types of the first n arguments. Take a missing n to be 0.
/*NOSTRICT*/
Suppress strict type checking in the next expression.
/*ARGSUSED*/
Activate the −v option for the next function.
/*LINTLIBRARY*/
Suppress complaints about unused functions in a file. This comment belongs at the beginning of the file.
FILES
/usr/lib/lint/lint[12]programs
/usr/lib/lint/llib-lc.lndeclarations for standard functions
/usr/lib/lint/llib-lchuman-readable version of the above declarations file
/usr/lib/lint/llib-port.lndeclarations for portable functions
/usr/lib/lint/llib-porthuman readable . . .
llib-l*.lnlibrary created with −C
CAUTIONS
Lint does not understand functions that do not return, e.g., exit(2).