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