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