Avoid implicit initialization + minor refactoring.
[splint-patched.git] / doc / splint.1
blob70050bf3a4aa3989a1d339ac0cd90b7d93f45ed0
1 .TH "SPLINT" "1" "02/27/2017" "Release 3.1.2a" "Release 3.1.2a"
3 .SH NAME
4 splint \- A tool for statically checking C programs
6 .SH SYNOPSIS
7 .BR splint
8 [options]
10 .SH DESCRIPTION
11 .BR splint
12 is a tool for statically checking C programs for security
13 vulnerabilities and common programming mistakes. With minimal effort,
14 splint can be used as a better lint(1).If additional effort is invested
15 adding annotations to programs, splint can perform stronger checks than
16 can be done by any standard lint.  For full documentation, please see
17 http://www.splint.org.  This man page only covers a few of the available
18 options.
20 .SH OPTIONS
22 .TP 6
23 .B \-help
24 Shows help
26 .PP
27 .B Initialization
29 These flags control directories and files used by splint. They may be
30 used from the command line or in an options file, but may not be used as
31 control comments in the source code. Except where noted. they have the
32 same meaning preceded by \- or +.
34 .TP 6
35 .BI \-tmpdir " directory"
36 Set directory for writing temp files. Default is /tmp/.
38 .TP 6
39 .BI \-I " directory"
40 Add directory to path searched for C include files. Note there is no
41 space after the I, to be consistent with C preprocessor flags.
43 .TP 6
44 .BI \-S " directory"
45 Add directory to path search for .lcl specification files.
47 .TP 6
48 .BI \-f " file"
49 Load options file <file>. If this flag is used from the command line,
50 the default ~/.splintrc file is not loaded. This flag may be used in an
51 options file to load in another options file.
53 .TP 6
54 .B \-nof
55 Prevents the default options files (./.splintrc and ~/.splintrc) from
56 being loaded. (Setting \-nof overrides +nof, causing the options files
57 to be loaded normally.)
59 .TP 6
60 .BI \-system\-dirs " directories"
61 Set directories for system files (default is "/usr/include"). Separate
62 directories with colons (e.g., "/usr/include:/usr/local/lib"). Flag
63 settings propagate to files in a system directory. If
64 \-system\-dir\-errors is set, no errors are reported for files in system
65 directories.
67 .PP
68 .B Pre\-processor
70 These flags are used to define or undefine pre\-processor constants.
71 The \-I<directory> flag is also passed to the C pre\-processor.
73 .TP 6
74 .BI \-D " initializer"
75 Passed to the C pre\-processor.
77 .TP 6
78 .BI \-U " initializer"
79 Passed to the C pre\-processor.
81 .PP
82 .B Libraries
83 These flags control the creation and use of libraries.
85 .TP 6
86 .BI \-dump " file"
87 Save state in <file> for loading. The default extension .lcd is added if
88 <file> has no extension.
90 .TP 6
91 .BI \-load " file"
92 Load state from <file> (created by \-dump). The default extension .lcd
93 is added if <file> has no extension. Only one library file may be loaded.
95 By default, the standard library is loaded if the \-load flag is not
96 used to load a user library. If no user library is loaded, one of the
97 following flags may be used to select a different standard library.
98 Precede the flag by + to load the described library (or prevent a
99 library from being loaded using nolib). See Apppendix F for information
100 on the provided libraries.
102 .TP 6
103 .B \-nolib
104 Do not load any library. This prevents the standard library from being
105 loaded.
107 .TP 6
108 .B \-standard\-lib
109 Use the (ISO C99) standard library (selected by default).
111 .TP 6
112 .B \-standard\-strict\-lib
113 Use strict version of the (ISO C99) standard library.
115 .TP 6
116 .B \-posix\-lib
117 Use the POSIX standard library.
119 .TP 6
120 .B \-posix\-strict\-lib
121 Use the strict version of the POSIX standard library.
123 .TP 6
124 .B \-unix\-lib
125 Use UNIX version of standard library.
127 .TP 6
128 .B \-unix\-strict\-lib
129 Use the strict version of the UNIX standard library.
132 .B Output
134 These flags control what additional information is printed by splint.
135 Setting +<flag> causes the described information to be printed; setting
136 \-<flag> prevents it. By default, all these flags are off.
138 .TP 6
139 .B \-use\-stderr
140 Send error messages to standard error (instead of standard out).
142 .TP 6
143 .B \-show\-summary
144 Show a summary of all errors reported and suppressed. Counts of
145 suppressed errors are not necessarily correct since turning a flag off
146 may prevent some checking from being done to save computation, and
147 errors that are not reported may propagate differently from when they
148 are reported.
150 .TP 6
151 .B \-show\-scan
152 Show file names are they are processed.
154 .TP 6
155 .B \-show\-alluses
156 Show list of uses of all external identifiers sorted by number of uses.
158 .TP 6
159 .B \-stats
160 Display number of lines processed and checking time.
162 .TP 6
163 .B \-time\-dist
164 Display distribution of where checking time is spent.
166 .TP 6
167 .B \-quiet
168 Suppress herald and error count. (If quiet is not set, splint prints out
169 a herald with version information before checking begins, and a line
170 summarizing the total number of errors reported.)
172 .TP 6
173 .B \-which\-lib
174 Print out the standard library filename and creation information.
176 .TP 6
177 .BI \-limit " number"
178 At most <number> similar errors are reported consecutively. Further
179 errors are suppressed, and a message showing the number of suppressed
180 messages is printed.
183 .B Expected Errors
185 Normally, splint will expect to report no errors. The exit status will
186 be success (0) if no errors are reported, and failure if any errors are
187 reported. Flags can be used to set the expected number of reported errors.
188 Because of the provided error suppression mechanisms, these options
189 should probably not be used for final checking real programs but may be
190 useful in developing programs using make.
192 .TP 6
193 .BI \-expect " number"
194 Exactly <number> code errors are expected. splint will exit with failure
195 exit status unless <number> code errors are detected.
197 .TP 6
198 .B \-Message Format
199 These flags control how messages are printed. They may be set at the
200 command line, in options files, or locally in syntactic comments. The
201 linelen and limit flags may be preceded by + or \- with the same meaning;
202 for the other flags, + turns on the describe printing and \- turns it
203 off. The box to the left of each flag gives its default value.
205 .TP 6
206 .B \-show\-column
207 Show column number where error is found. Default: +
209 .TP 6
210 .B \-show\-func
211 Show name of function (or macro) definition containing error. The
212 function name is printed once before the first message detected in that
213 function. Default: +
215 .TP 6
216 .B \-show\-all\-conjs
217 Show all possible alternate types (see Section 8.2.2). Default: \-
219 .TP 6
220 .B \-paren\-file\-format
221 Use file(line) format in messages.
223 .TP 6
224 .B \-hints
225 Provide hints describing an error and how a message may be suppressed
226 for the first error reported in each error class. Default: +
228 .TP 6
229 .B \-force\-hints
230 Provide hints for all errors reported, even if the hint has already been
231 displayed for the same error class. Default: \-
233 .TP 6
234 .BI \-linelen " number"
235 Set length of maximum message line to <number> characters. splint will
236 split messages longer than <number> characters long into multiple lines.
237 Default: 80
240 .B Mode Selector Flags
242 Mode selects flags set the mode checking flags to predefined values.
243 They provide a quick coarse\-grain way of controlling what classes of
244 errors are reported. Specific checking flags may be set after a mode
245 flag to override the mode settings. Mode flags may be used locally,
246 however the mode settings will override specific command line flag
247 settings. A warning is produced if a mode flag is used after a mode
248 checking flag has been set.
250 These are brief descriptions to give a general idea of what each mode
251 does. To see the complete flag settings in each mode, use splint \-help
252 modes. A mode flag has the same effect when used with either + or \-.
254 .TP 6
255 .B \-weak
256 Weak checking, intended for typical unannotated C code. No modifies
257 checking, macro checking, rep exposure, or clean interface checking is
258 done. Return values of type int may be ignored. The types bool, int,
259 char and user\-defined enum types are all equivalent. Old style
260 declarations are unreported.
262 .TP 6
263 .B \-standard
264 The default mode. All checking done by weak, plus modifies checking,
265 global alias checking, use all parameters, using released storage,
266 ignored return values or any type, macro checking, unreachable code,
267 infinite loops, and fall\-through cases. The types bool, int and char
268 are distinct. Old style declarations are reported.
270 .TP 6
271 .B \-checks
272 Moderately strict checking. All checking done by standard, plus must
273 modification checking, rep exposure, return alias, memory management and
274 complete interfaces.
276 .TP 6
277 .B \-strict
278 Absurdly strict checking. All checking done by checks, plus
279 modifications and global variables used in unspecified functions, strict
280 standard library, and strict typing of C operators. A special reward
281 will be presented to the first person to produce a real program that
282 produces no errors with strict checking.
284 .SH AUTHOR
285 If you need to get in contact with the authors send email to
286 .UR mailto:info@splint.org
288 or visit
289 .UR http://www.splint.org
292 .SH "SEE ALSO"
293 lint(1)