1 .\" (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
2 .\" See the copyright notice in the ACK home directory, in the file "Copyright".
4 .\" $Id: lint.1,v 1.7 1994/06/24 12:25:45 ceriel Exp $
5 .TH LINT 1 "$Revision: 1.7 $"
7 lint \- a C program checker
10 [ \-abhuvx \-KR -ansi ] [file | libname | \-l\fIxxx\fP ] ...
13 \-L\fIlibname\fP [ file | libname2 | \-l\fIxxx\fP ] ...
17 does an extensive consistency and plausibility check on a set of C
19 When it detects a doubtful construction
20 (which need not be an error) it gives a warning.
22 It does a full flow-of-control check, except that
24 are not followed and that the fact that a function never returns
28 are used, each call of a non-returning function is followed by
29 /*NOTREACHED*/ and each switch has a default clause (possibly consisting
30 of /*NOTREACHED*/), the initialization state of all local variables will
34 checks the types of the arguments implied by the format in a call of
37 and family, if the format string is a direct argument in the call.
38 Formats of user functions can be indicated using a FORMAT pseudo-comment; see
43 The second command (using the
45 is used to maintain lint libraries; these are ASCII files
46 that contain the output of the first pass.
47 A library name ends in
49 A lint user library can be created and updated by using the
57 again as a normal argument.
59 Standard libraries are searched by default or by explicitly giving the
61 option; their format is identical to that of the user library files.
72 not to use the standard C library.
73 The standard libraries are searched for in the standard lint directory or
74 in the directory given in the environment variable LINTLIB, if present.
83 options are recognized as separate arguments and conform to those of
89 to check strictly according to Kernighan & Ritchie; since
91 is trying to be helpful rather than obnoxious, this is not the default.
94 option tells lint to check according to ANSI C.
97 understands the following additional options:
100 Warn about conversions that may cause a loss of precision.
103 Do not report not-reachable
106 This flag may be useful when
108 is run on a generated source file.
111 Apply several heuristics:
112 signal "null effects", possible pointer alignment problems and odd
113 constructs; report definitions of variables that have a scope wider than
114 necessary: extern variables that are used in one file only, automatic
115 variables that could be more local.
118 Do not complain about unused and undefined functions and global variables.
121 Do not warn about unused arguments of functions.
124 Complain about unused external variables.
128 The following pseudo-comments can be used to influence the behaviour of
132 Do not warn about arguments not used in the next function
133 (see also the \-\fBv\fR option).
138 that the flow of control "cannot reach" this comment.
139 This is a way to tell
141 that a statement never "returns".
144 The definitions following this pseudo-comment are assumed to be part of a
146 It suppresses complaints about unused functions and variables
147 and is used in the creation of lint libraries.
148 It implies /*\ ARGSUSED\ */.
150 /*\ VARARGS\fIn\fR\ */
151 The next function can be called with a variable number of
153 Only check the types of the first \fIn\fR arguments.
154 The \fIn\fR must follow the word VARARGS immediately.
155 /*\ VARARGS0\ */ may be abbreviated to /*\ VARARGS\ */.
157 /*\ FORMAT\fIn\fR $ ... $\ */
158 The \fIn\fP-th argument (counting from 0) of the next function declaration
161 format string. Details about the format are given between the $$; see below.
162 A missing $$ repeats the latest format.
163 The \fIn\fR must follow the word FORMAT immediately.
164 /*\ FORMAT\fIn\fR $ ... $\ */ implies /*\ VARARGS\fIn+1\fP\ */; if the format
165 is followed by more required arguments, a separate /*\ VARARGS\fIm\fP\ */
166 must be given after the FORMAT pseudo-comment.
168 If the printf-like heading also has to conform to some varargs.h convention,
169 error messages may result; these can be suppressed by appending the letter v
170 to the word FORMAT\fIn\fR without intervening space.
174 The $$-part of the FORMAT pseudo-comment consists of a list of format
175 specifications, each of the form
179 is an arbitrary (short) string and
181 is the expected type in "C normal form" (like in a cast, with no superfluous
182 parentheses and without the use of typedefs). E.g., %ld=long indicates that
183 the format string ld corresponds to a parameter of type long. For a shorter
184 notation see the example below.
186 recognizes conversion specifications of the form %[N|*|][.[N|*]]T where N is
187 a number, the * is itself and T is a string as defined above. For the above
188 example this would include %ld, %5.2ld, %.*ld, etc.
190 Example: the FORMAT pseudo-comment for
196 %[dox] = int %l[dox] = long %[DOX] = long
198 %u = unsigned int %lu = unsigned long %U = unsigned long
208 Some users feel it is a good idea to pipe the output of
212 sort \-t' ' +0d \-1 +2n \-3
214 where the character between the apostrophes is a space.
215 .SH "ENVIRONMENT VARIABLES"
216 LINTFLAGS additional flag arguments (e.g. LINTFLAGS=\-h)
218 LINTLIB directory in which the standard libraries are looked up
222 .IP ???/lpass2/lpass2
230 .I Lint, a C Program Checker
232 Conflicting options in the command line are not detected.
234 After a label, all automatic variables are assumed initialized.
236 Frans Kunst, Vrije Universiteit, Amsterdam.
238 Dick Grune, Vrije Universiteit, Amsterdam.