BSD 4_3_Tahoe development
[unix-history] / usr / man / cat1 / lint.0
LINT(1) UNIX Programmer's Manual LINT(1)
N\bNA\bAM\bME\bE
lint - a C program verifier
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
l\bli\bin\bnt\bt [ -\b-a\bab\bbc\bch\bhn\bnp\bpu\buv\bvx\bx ] file ...
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
_\bL_\bi_\bn_\bt attempts to detect features of the C program _\bf_\bi_\bl_\be_\bs
which are likely to be bugs, or non-portable, or wasteful.
It also checks the type usage of the program more strictly
than the compilers. Among the things which are currently
found are unreachable statements, loops not entered at the
top, automatic variables declared and not used, and logical
expressions whose value is constant. Moreover, the usage of
functions is checked to find functions which return values
in some places and not in others, functions called with
varying numbers of arguments, and functions whose values are
not used.
By default, it is assumed that all the _\bf_\bi_\bl_\be_\bs are to be
loaded together; they are checked for mutual compatibility.
Function definitions for certain libraries are available to
_\bl_\bi_\bn_\bt; these libraries are referred to by a conventional
name, such as `-lm', in the style of _\bl_\bd(1). Arguments end-
ing in ._\bl_\bn are also treated as library files. To create
lint libraries, use the -\b-C\bC option:
lint -Cfoo files . . .
where _\bf_\bi_\bl_\be_\bs are the C sources of library _\bf_\bo_\bo. The result is
a file _\bl_\bl_\bi_\bb-_\bl_\bf_\bo_\bo._\bl_\bn in the correct library format suitable
for linting programs using _\bf_\bo_\bo.
Any number of the options in the following list may be used.
The -\b-D\bD, -\b-U\bU, and -\b-I\bI options of _\bc_\bc(1) are also recognized as
separate arguments.
p\bp Attempt to check portability to the _\bI_\bB_\bM and _\bG_\bC_\bO_\bS
dialects of C.
h\bh Apply a number of heuristic tests to attempt to intuit
bugs, improve style, and reduce waste.
b\bb Report _\bb_\br_\be_\ba_\bk statements that cannot be reached. (This
is not the default because, unfortunately, most _\bl_\be_\bx and
many _\by_\ba_\bc_\bc outputs produce dozens of such comments.)
v\bv Suppress complaints about unused arguments in func-
tions.
x\bx Report variables referred to by extern declarations,
but never used.
Printed 7/9/88 March 17, 1986 1
LINT(1) UNIX Programmer's Manual LINT(1)
a\ba Report assignments of long values to int variables.
c\bc Complain about casts which have questionable portabil-
ity.
u\bu Do not complain about functions and variables used and
not defined, or defined and not used (this is suitable
for running _\bl_\bi_\bn_\bt on a subset of files out of a larger
program).
n\bn Do not check compatibility against the standard
library.
z\bz Do not complain about structures that are never defined
(e.g. using a structure pointer without knowing its
contents.).
_\bE_\bx_\bi_\bt(2) and other functions which do not return are not
understood; this causes various lies.
Certain conventional comments in the C source will change
the behavior of _\bl_\bi_\bn_\bt:
/*NOTREACHED*/
at appropriate points stops comments about unreachable
code.
/*VARARGS_\bn*/
suppresses the usual checking for variable numbers of
arguments in the following function declaration. The
data types of the first _\bn arguments are checked; a
missing _\bn is taken to be 0.
/*NOSTRICT*/
shuts off strict type checking in the next expression.
/*ARGSUSED*/
turns on the -\b-v\bv option for the next function.
/*LINTLIBRARY*/
at the beginning of a file shuts off complaints about
unused functions in this file.
A\bAU\bUT\bTH\bHO\bOR\bR
S.C. Johnson. Lint library construction implemented by
Edward Wang.
F\bFI\bIL\bLE\bES\bS
/usr/lib/lint/lint[12] programs
/usr/lib/lint/llib-lc.ln declarations for standard func-
tions
/usr/lib/lint/llib-lc human readable version of above
Printed 7/9/88 March 17, 1986 2
LINT(1) UNIX Programmer's Manual LINT(1)
/usr/lib/lint/llib-port.ln declarations for portable func-
tions
/usr/lib/lint/llib-port human readable . . .
llib-l*.ln library created with -\b-C\bC
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
cc(1)
S. C. Johnson, _\bL_\bi_\bn_\bt, _\ba _\bC _\bP_\br_\bo_\bg_\br_\ba_\bm _\bC_\bh_\be_\bc_\bk_\be_\br
B\bBU\bUG\bGS\bS
There are some things you just c\bca\ban\bn'\b't\bt get lint to shut up
about.
/*NOSTRICT*/ is not implemented in the current version
(alas).
Printed 7/9/88 March 17, 1986 3