|
|
1.1 root 1: .\" Copyright (c) 1980, 1990 Regents of the University of California.
2: .\" All rights reserved. The Berkeley Software License Agreement
3: .\" specifies the terms and conditions for redistribution.
4: .\"
5: .\" @(#)lint.1 6.5 (Berkeley) 7/24/90
6: .\"
7: .Dd July 24, 1990
8: .Dt LINT 1
9: .Os BSD 4
10: .Sh NAME
11: .Nm lint
12: .Nd a C program verifier
13: .Sh SYNOPSIS
14: .Nm lint
15: .Op Fl abchnpuvx
16: .Ar file ...
17: .Sh DESCRIPTION
18: .Nm Lint
19: attempts to detect features of the C program
20: .Ar files
21: which are
22: likely to be bugs, or non-portable, or wasteful.
23: It also checks the type usage of the program more strictly
24: than the compilers.
25: Among the things which are currently found are
26: unreachable statements,
27: loops not entered at the top,
28: automatic variables declared and not used,
29: and logical expressions whose value is constant.
30: Moreover, the usage of functions is checked to find
31: functions which return values in some places and not in others,
32: functions called with varying numbers of arguments,
33: and functions whose values are not used.
34: .Pp
35: By default, it is assumed that all the
36: .Ar files
37: are to be loaded together; they are checked for
38: mutual compatibility.
39: Function definitions for certain libraries are available to
40: .Nm lint ;
41: these libraries are referred to by a
42: conventional name,
43: such as `\-lm', in the style of
44: .Xr ld 1 .
45: Arguments ending in
46: .Va .ln
47: are also treated as library files. To create lint libraries,
48: use the
49: .Fl C
50: option:
51: .Pp
52: .Dl lint \-Cfoo files . . .
53: .Pp
54: where
55: .Ar files
56: are the C sources of library
57: .Ar foo .
58: The result is a file
59: .Em llib-lfoo .ln
60: in the correct library format suitable for linting programs
61: using
62: .Ar foo .
63: .Pp
64: Any number of the options in the following list
65: may be used.
66: The
67: .Fl D
68: .Fl U
69: and
70: .Fl I
71: options of
72: .Xr cc 1
73: are also recognized as separate arguments.
74: .Tp Fl p
75: Attempt to check portability to the
76: .Em IBM
77: and
78: .Em GCOS
79: dialects of C.
80: .Tp Fl h
81: Apply a number of heuristic tests to attempt to
82: intuit bugs, improve style, and reduce waste.
83: .Tp Fl b
84: Report
85: .Ar break
86: statements that cannot be reached.
87: (This is not the default because, unfortunately,
88: most
89: .Xr lex 1
90: and many
91: .Xr yacc 1
92: outputs produce dozens of such comments.)
93: .Tp Fl v
94: Suppress complaints about unused arguments in functions.
95: .Tp Fl x
96: Report variables referred to by extern declarations,
97: but never used.
98: .Tp Fl a
99: Report assignments of long values to int variables.
100: .Tp Fl c
101: Complain about casts which have questionable portability.
102: .Tp Fl u
103: Do not complain about functions and variables used and not
104: defined, or defined and not used (this is suitable for running
105: .Nm lint
106: on a subset of files out of a larger program).
107: .Tp Fl n
108: Do not check compatibility against the standard library.
109: .Tp Fl z
110: Do not complain about structures that are never defined (e.g.
111: using a structure pointer without knowing its contents.).
112: .Tp
113: .Pp
114: .Xr Exit 2
115: and other functions which do not return
116: are not understood; this causes various lies.
117: .Pp
118: Certain conventional comments in the C source
119: will change the behavior of
120: .Nm lint :
121: .Tw Ds
122: .Tp Li /*NOTREACHED*/
123: at appropriate points
124: stops comments about unreachable code.
125: .Tp Li /*VARARGS n */
126: suppresses
127: the usual checking for variable numbers of arguments
128: in the following function declaration.
129: The data types of the first
130: .Ar n
131: arguments are checked;
132: a missing
133: .Ar n
134: is taken to be 0.
135: .Tp Li /*NOSTRICT*/
136: shuts off strict type checking in the next expression.
137: .Tp Li /*ARGSUSED*/
138: turns on the
139: .Fl v
140: option for the next function.
141: .Tp Li /*LINTLIBRARY*/
142: at the beginning of a file shuts off complaints about
143: unused functions in this file.
144: .Yp
145: .Sh AUTHOR
146: S.C. Johnson. Lint library construction implemented by Edward Wang.
147: .Sh FILES
148: .Dw /usr/libdata/lint/llib-port.ln
149: .Di L
150: .Dp Pa /usr/libdata/lint/llib-lc.ln
151: declarations for standard functions
152: .Dp Pa /usr/libdata/lint/llib-lc
153: human readable version of above
154: .Dp Pa /usr/lib/lintdata/llib-port.ln
155: declarations for portable functions
156: .Dp Pa /usr/lib/lintdata/llib-port
157: human readable . . .
158: .Dp Pa llib-l*.ln
159: library created with
160: .Fl C
161: .Dp
162: .Sh SEE ALSO
163: .Xr cc 1
164: .br
165: S. C. Johnson,
166: .Em Lint ,
167: a C Program Checker
168: .Sh HISTORY
169: .Nm Lint
170: appeared in Version 7 AT&T Unix.
171: .Sh BUGS
172: There are some things you just
173: can't
174: get lint to shut up about.
175: .Pp
176: /*NOSTRICT*/
177: is not implemented in the current version (alas).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.