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