BSD 3 development
[unix-history] / usr / man / man1 / lint.1
CommitLineData
e6817382
BJ
1.TH LINT 1
2.SH NAME
3lint \- a C program verifier
4.SH SYNOPSIS
5.B lint
6[
7.B \-abchnpuvx
8]
9file ...
10.SH DESCRIPTION
11.I Lint
12attempts to detect features of the C program
13.I files
14which are
15likely to be bugs, or non-portable, or wasteful.
16It also checks the type usage of the program more strictly
17than the compilers.
18Among the things which are currently found are
19unreachable statements,
20loops not entered at the top,
21automatic variables declared and not used,
22and logical expressions whose value is constant.
23Moreover, the usage of functions is checked to find
24functions which return values in some places and not in others,
25functions called with varying numbers of arguments,
26and functions whose values are not used.
27.PP
28By default, it is assumed that all the
29.I files
30are to be loaded together; they are checked for
31mutual compatibility.
32Function definitions for certain libraries are available to
33.IR lint ;
34these libraries are referred to by a
35conventional name,
36such as `-lm', in the style of
37.IR ld (1).
38.PP
39Any number of the options in the following list
40may be used.
41The
42.SM
43.BR \-D "\*S,"
44.SM
45.BR \-U "\*S,"
46and
47.SM
48.B \-I
49options of
50.IR cc (1)
51are also recognized as separate arguments.
52.TP
53.B p
54Attempt to check portability to the
55.I IBM
56and
57.I GCOS
58dialects of C.
59.TP
60.B h
61Apply a number of heuristic tests to attempt to
62intuit bugs, improve style, and reduce waste.
63.TP
64.B b
65Report
66.I break
67statements that cannot be reached.
68(This is not the default because, unfortunately,
69most
70.I lex
71and many
72.I yacc
73outputs produce dozens of such comments.)
74.TP
75.B v
76Suppress complaints about unused arguments in functions.
77.TP
78.B x
79Report variables referred to by extern declarations,
80but never used.
81.TP
82.B a
83Report assignments of long values to int variables.
84.TP
85.B c
86Complain about casts which have questionable portability.
87.TP
88.B u
89Do not complain about functions and variables used and not
90defined, or defined and not used (this is suitable for running
91.I lint
92on a subset of files out of a larger program).
93.TP
94.B n
95Do not check compatibility against the standard library.
96.PP
97.IR Exit (2)
98and other functions which do not return
99are not understood; this causes various lies.
100.PP
101Certain conventional comments in the C source
102will change the behavior of
103.IR lint :
104.TP
105/*NOTREACHED*/
106at appropriate points
107stops comments about unreachable code.
108.TP
109.RI /*VARARGS n */
110suppresses
111the usual checking for variable numbers of arguments
112in the following function declaration.
113The data types of the first
114.I n
115arguments are checked;
116a missing
117.I n
118is taken to be 0.
119.TP
120/*NOSTRICT*/
121shuts off strict type checking in the next expression.
122.TP
123/*ARGSUSED*/
124turns on the
125.B \-v
126option for the next function.
127.TP
128/*LINTLIBRARY*/
129at the beginning of a file shuts off complaints about
130unused functions in this file.
131.SH FILES
132.ta \w'/usr/lib/llib-port 'u
133/usr/lib/lint[12] programs
134.br
135/usr/lib/llib-lc declarations for standard functions
136.br
137/usr/lib/llib-port declarations for portable functions
138.SH SEE ALSO
139cc(1)
140.br
141S. C. Johnson,
142.I Lint, a C Program Checker