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