summaryrefslogtreecommitdiff
path: root/static/unix-v10/man1/lint.1
blob: 4c9d3ee1325748f9f3db487668d0e6b21462b46d (plain)
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
.TH LINT 1
.CT 1 prog_c
.SH NAME
lint, cyntax, cem \- C program verifiers
.SH SYNOPSIS
.B lint
[
.B -abchnpuvx
] [
.I option ...
]
.I file ...
.PP
.B cyntax
[
.I option ...
]
.I file ...
.PP
.B /usr/lib/cyntax/cem
[
.I option ...
]
.I file ...
.SH DESCRIPTION
.I Lint
checks, more thoroughly than
.IR cc (1),
the syntactic validity and semantic consistency of
one or more C program
.I files.
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
.LR -lm ,
in the style of
.IR ld (1).
.PP
Any number of the option letters in the following list
may be used.
The
.BR -D ,
.BR -U ,
and
.B -I
options of
.IR cc (1)
are also recognized as separate arguments.
.TP
.B p
Attempt to check portability to some other
dialects of C.
.PD 0
.TP
.B h
Apply heuristics to
intuit bugs, improve style, and reduce waste.
.TP
.B b
Report
.I break
statements that cannot be reached.
.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.
.PD
.PP
Certain conventional comments in the C source
will change the behavior of
.IR lint :
.TP
.B /*NOTREACHED*/
at appropriate points.
Stop comments about unreachable code.
.PD 0
.TP
.BI /*VARARGS n */
Suppress
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
.BI /*PRINTFLIKE n */
The data types of the first
.I n\^
arguments are checked as usual.
The remaining arguments are
checked
against the
.IR n th
argument, which is interpreted as a
.IR printf (3)
format string.
.TP
.BI /*SCANFLIKE n */
Similarly for
.IR scanf (3).
.TP
.B /*NOSTRICT*/
Shut off strict type checking in the next expression.
.TP
.B /*ARGSUSED*/
Turn on the
.B -v
option for the next function.
.TP
.B /*LINTLIBRARY*/
at the beginning of a file.  Shut off complaints about
unused functions in this file.
.PD
.PP
.I Cyntax
makes checks similar to those of
.I lint,
more stringent about syntax, less observant of portability issues.
It keeps type information gleaned from source files,
whose names end with
.LR .c ,
in `object files' with corresponding names ending in
.LR .O .
If all goes well it will cross check among all the 
.L .c
and
.L .O
input
.I files.
.PP
Options
.BR -D ,
.BR -I ,
.BR -U ,
.BR -o ,
.BR -l
are as in
.IR cc (1),
option
.B -n
is as in 
.IR lint .
Options
.BR -O ,
.BR -P ,
.BR -g ,
.BR -p ,
and
.BR -s
are ignored.
Other options are:
.TP
.B -c
Suppress cross checking.
.PD 0
.TP
.B -d
Passed to
.IR cem .
.TP
.B -h
Base object files on the basename of the source file
rather than the full pathname.
.TP
.B -G
Change default directory of include files to
.FR /usr/2include ,
pass 
.B -lg
to
.I cem
instead of
.BR -lc .
.TP
.B -j
Change default directory of include files to
.FR /usr/jerq/include ,
pass 
.B -lj
to
.I cem
instead of
.BR -lc .
.TP
.B -k
Change default directory of include files to
.FR /usr/ninclude ,
pass 
.B -lk
to
.I cem
instead of
.BR -lc .
.TP
.B -w
Enable pedantic warning diagnostics.
.TP
.B -m
equivalent to
.LR "-j -DMUX" .
.TP
.B -v
Report what
.I cyntax
is actually doing.
.TP
.BI -V func : n
Declare function
.I func
to have a variable number of arguments, the first
.I n
of which are to be type checked.
.PD
.PP
.I Cem
(cemantics), the cross-checker, is normally invoked only by
.IR cyntax .
It also has options, some of which
.I cyntax
can't be coerced into providing.
Besides
.B -o
and
.BR -l ,
they are:
.TP
.B -m
Don't believe file modification times.
These are normally used to avert redundant type checking.
.PD0
.TP
.B -d
``Debug'': print ascii version of 
.L .O
files on standard output.
.TP
.B -p
Be pedantic about type checking.
.TP
.B -t
Unconditionally include file modification times in diagnostics.
.TP
.B -v
Use a verbose format for type names.
.PD
.SH FILES
.TF /usr/lib/lint/llib-port
.TP
.F /usr/lib/lint/lint[12]
programs
.TP
.F /usr/lib/lint/llib-lc
declarations for standard functions
.TP
.F /usr/lib/lint/llib-port
declarations for portable functions
.TP
.F /usr/include/*
.TP
.F /usr/lib/cyntax/ccom
cyntax proper
.TP
.F /usr/lib/cyntax/libc
type library
.TP
.F /usr/lib/cyntax/libj
.SH SEE ALSO
.IR cc (1),
.IR ld (1)
.br
S. C. Johnson
`Lint, a C Program Checker', in
Bell Laboratories,
.I Unix Programmer's Manual,
Holt, Rinehart and Winston, 1983, Vol. 2
.RI ( "Seventh Edition" )
.SH BUGS
.IR Exit (2)
and other functions which do not return
are not understood by
.IR lint ;
this causes various lies.
.br
The unnatural default setting of
.I lint
option
.B -b
is intended to hide the ugliness of
C code produced by
.IR yacc (1)
and
.IR lex (1).