]> andersk Git - splint.git/blame - src/flags.def
Modified the doc/Makefile.am so that the man page is install under make install.
[splint.git] / src / flags.def
CommitLineData
885824d3 1/*;-*-C-*-;
2**
3** flags.def
4**
5** This file is used to generate the flag header files.
a0a162cd 6**
7** Don't forget to regenerate flag_codes.gen. (lost the Makefile...bleech!)
885824d3 8*/
885824d3 9 /* spec idem global mode args */
10/*@-namechecks@*/
11/*@notfunction@*/
12# define modeFlag FALSE, FALSE, FALSE, TRUE, ARG_NONE
13/*@notfunction@*/
14# define plainFlag FALSE, FALSE, FALSE, FALSE, ARG_NONE
15/*@notfunction@*/
16# define specialFlag TRUE, FALSE, FALSE, FALSE, ARG_NONE
17/*@notfunction@*/
18# define plainSpecialFlag TRUE, FALSE, FALSE, FALSE, ARG_NONE
19/*@notfunction@*/
20# define idemSpecialFlag TRUE, TRUE, FALSE, FALSE, ARG_NONE
21/*@notfunction@*/
4f43223c 22# define valueFlag FALSE, FALSE, FALSE, FALSE, ARG_NUMBER
23
24/*@notfunction@*/
25# define charFlag FALSE, FALSE, FALSE, FALSE, ARG_CHAR
26
885824d3 27/*@notfunction@*/
4f43223c 28# define modeValueFlag FALSE, FALSE, FALSE, TRUE, ARG_NUMBER
885824d3 29/*@notfunction@*/
4f43223c 30# define specialValueFlag TRUE, FALSE, FALSE, FALSE, ARG_NUMBER
885824d3 31/*@notfunction@*/
32# define debugFlag FALSE, TRUE, FALSE, FALSE, ARG_NONE
33/*@notfunction@*/
4f43223c 34# define debugValueFlag FALSE, TRUE, FALSE, FALSE, ARG_NUMBER
28bf4b0b 35/*@notfunction@*/
885824d3 36# define specialDebugFlag TRUE, TRUE, FALSE, FALSE, ARG_NONE
37/*@notfunction@*/
38# define globalFlag FALSE, FALSE, TRUE, FALSE, ARG_NONE
39/*@notfunction@*/
40# define idemGlobalFlag FALSE, TRUE, TRUE, FALSE, ARG_NONE
41/*@notfunction@*/
4f43223c 42# define globalValueFlag FALSE, FALSE, TRUE, FALSE, ARG_NUMBER
43
44/* Note: type argument missing */
885824d3 45/*@notfunction@*/
4f43223c 46# define regStringFlag FALSE, FALSE, FALSE, FALSE
885824d3 47/*@notfunction@*/
4f43223c 48# define idemStringFlag FALSE, TRUE, FALSE, FALSE
885824d3 49/*@notfunction@*/
4f43223c 50# define globalStringFlag FALSE, FALSE, TRUE, FALSE
51
885824d3 52/*@notfunction@*/
53# define extraArgFlag FALSE, FALSE, FALSE, FALSE, ARG_SPECIAL
54/*@notfunction@*/
55# define globalExtraArgFlag FALSE, FALSE, TRUE, FALSE, ARG_SPECIAL
4f43223c 56/*@notfunction@*/
57# define globalFileFlag FALSE, FALSE, TRUE, FALSE, ARG_FILE
885824d3 58/*@=namechecks@*/
59
60/*
61** Note: the flag code must be on a separate line, since I'm
62** too stupid to write an awk/sed/whatever script that can separate
63** the lines.
64*/
65
28bf4b0b 66static flaglist flags =
885824d3 67{
bb7c2085 68 /*
69 ** Null Dereferences (Manual Section 2)
70 */
71
28bf4b0b 72 {
bb7c2085 73 FK_NULL, FK_MEMORY, specialFlag,
74 "null",
75 FLG_NULL,
76 "misuses of null pointer",
77 "A possibly null pointer is misused (sets nullderef, nullpass, "
78 "nullref, nullassign, and nullstate).",
28bf4b0b 79 0, 0
885824d3 80 },
28bf4b0b 81 {
bb7c2085 82 FK_NULL, FK_MEMORY, modeFlag,
83 "nullderef",
84 FLG_NULLDEREF,
85 "possible dereferencce of null pointer",
86 "A possibly null pointer is dereferenced. Value is "
87 "either the result of a function which may return null "
88 "(in which case, code should check it is not null), or a "
89 "global, parameter or structure field declared with the "
90 "null qualifier.",
28bf4b0b 91 0, 0
92 },
93 {
bb7c2085 94 FK_NULL, FK_MEMORY, modeFlag,
95 "nullpass",
96 FLG_NULLPASS,
97 "possibly null pointer passed as formal with no null annotation",
98 "A possibly null pointer is passed as a parameter corresponding to "
99 "a formal parameter with no /*@null@*/ annotation. If NULL "
100 "may be used for this parameter, add a /*@null@*/ annotation "
101 "to the function parameter declaration.",
28bf4b0b 102 0, 0
103 },
104 {
bb7c2085 105 FK_NULL, FK_MEMORY, modeFlag,
106 "nullret",
107 FLG_NULLRET,
108 "possibly null pointer returned as result with no null annotation",
109 "Function returns a possibly null pointer, but is not declared "
110 "using /*@null@*/ annotation of result. If function may "
111 "return NULL, add /*@null@*/ annotation to the return "
112 "value declaration.",
28bf4b0b 113 0, 0
114 },
115 {
bb7c2085 116 FK_NULL, FK_MEMORY, modeFlag,
117 "nullstate",
118 FLG_NULLSTATE,
119 "possibly null pointer reachable from a reference with no null annotation",
120 "A possibly null pointer is reachable from a parameter or global "
121 "variable that is not declared using a /*@null@*/ annotation.",
28bf4b0b 122 0, 0
123 },
124 {
bb7c2085 125 FK_NULL, FK_MEMORY, modeFlag,
126 "nullassign",
127 FLG_NULLASSIGN,
128 "inconsistent assignment or initialization involving null pointer",
129 "A reference with no null annotation is assigned or initialized "
130 "to NULL. Use /*@null@*/ to declare the reference as "
131 "a possibly null pointer.",
28bf4b0b 132 0, 0
133 },
bb7c2085 134
135 /*
136 ** Undefined Values (Section 3)
137 */
138
28bf4b0b 139 {
bb7c2085 140 FK_DEF, FK_NONE, modeFlag,
141 "usedef",
142 FLG_USEDEF,
143 "use before definition",
144 "An rvalue is used that may not be initialized to a value on some execution path.",
28bf4b0b 145 0, 0
146 },
147 {
bb7c2085 148 FK_MEMORY, FK_DEF, modeFlag,
149 "mustdefine",
150 FLG_MUSTDEFINE,
151 "out storage not defined before return or scope exit",
152 "An out parameter or global is not defined before control is transferred.",
28bf4b0b 153 0, 0
154 },
155 {
bb7c2085 156 FK_MEMORY, FK_DEF, modeFlag,
157 "uniondef",
158 FLG_UNIONDEF,
159 "at least one field of a union must be defined",
160 "No field of a union is defined. Generally, one field of a union is "
161 "expected to be defined.",
28bf4b0b 162 0, 0
163 },
164 {
bb7c2085 165 FK_MEMORY, FK_DEF, modeFlag,
166 "compdef",
167 FLG_COMPDEF,
168 "parameter, return value or global completely defined",
169 "Storage derivable from a parameter, return value or global is "
170 "not defined. Use /*@out@*/ to denote passed or returned "
171 "storage which need not be defined.",
28bf4b0b 172 0, 0
173 },
45569d72 174 {
175 FK_DEF, FK_NONE, plainFlag,
176 "fullinitblock",
177 FLG_FULLINITBLOCK,
178 "initializer sets all fields",
179 "Initializer does not set every field in the structure.",
180 0, 0
181 },
182 {
183 FK_DEF, FK_NONE, plainFlag,
184 "initallelements",
185 FLG_INITALLELEMENTS,
186 "initializer defines all array elements",
187 "Initializer does not define all elements of a declared array.",
188 0, 0
189 },
190 {
191 FK_DEF, FK_NONE, plainFlag,
192 "initsize",
193 FLG_INITSIZE,
194 "initializer defines extra array elements",
195 "Initializer block contains more elements than the size of a declared array.",
196 0, 0
197 },
bb7c2085 198
28bf4b0b 199 {
bb7c2085 200 FK_DEF, FK_IMPLICIT, modeFlag,
201 "impouts",
202 FLG_IMPOUTS,
203 "pointer parameters to unspecified functions may be implicit out parameters",
204 NULL, 0, 0
28bf4b0b 205 },
bb7c2085 206
207 /*
208 ** Types (Section 4)
209 */
210
28bf4b0b 211 {
bb7c2085 212 FK_DECL, FK_TYPE, modeFlag,
213 "incondefs",
214 FLG_INCONDEFS,
215 "function, variable or constant redefined with inconsistent type",
216 "A function, variable or constant is redefined with a different type.",
28bf4b0b 217 0, 0
218 },
219 {
bb7c2085 220 FK_DECL, FK_TYPE, modeFlag,
221 "matchfields",
222 FLG_MATCHFIELDS,
223 "struct or enum type redefined with inconsistent fields or members",
224 "A struct, union or enum type is redefined with inconsistent fields or members.",
28bf4b0b 225 0, 0
226 },
227 {
bb7c2085 228 FK_TYPE, FK_NONE, modeFlag,
229 "fcnderef",
230 FLG_FCNDEREF,
231 "dereferencce of a function type",
232 "A function type is dereferenced. The ANSI standard allows this "
233 "because of implicit conversion of function designators, however the "
234 "dereference is unnecessary.",
28bf4b0b 235 0, 0
236 },
237 {
bb7c2085 238 FK_OPS, FK_NONE, modeFlag,
239 "realcompare",
240 FLG_REALCOMPARE,
241 "dangerous comparison between reals (dangerous because of inexact "
242 "floating point representations)",
243 "Two real (float, double, or long double) values are compared "
244 "directly using a C primitive. "
245 "This may produce unexpected results since floating point "
246 "representations are inexact. Instead, compare the difference to "
247 "FLT_EPSILON or DBL_EPSILON.",
248 0, 0,
28bf4b0b 249 },
250 {
bb7c2085 251 FK_OPS, FK_NONE, modeFlag,
252 "unsignedcompare",
253 FLG_UNSIGNEDCOMPARE,
254 "comparison using <, <=, >= between an unsigned integral and zero constant",
255 "An unsigned value is used in a comparison with zero in a way that is either a bug or confusing.",
256 0, 0,
28bf4b0b 257 },
258 {
bb7c2085 259 FK_OPS, FK_POINTER, modeFlag,
260 "ptrarith",
261 FLG_POINTERARITH,
262 "arithmetic involving pointer and integer",
263 "Pointer arithmetic using pointer and integer.", 0, 0
28bf4b0b 264 },
265 {
bb7c2085 266 FK_OPS, FK_POINTER, modeFlag,
267 "nullptrarith",
268 FLG_NULLPOINTERARITH,
269 "arithmetic involving possibly null pointer and integer",
270 "Pointer arithmetic using a possibly null pointer and integer.", 0, 0
28bf4b0b 271 },
272 {
bb7c2085 273 FK_OPS, FK_POINTER, modeFlag,
274 "ptrcompare",
275 FLG_PTRNUMCOMPARE,
276 "comparison between pointer and number",
277 "A pointer is compared to a number.", 0, 0
28bf4b0b 278 },
279 {
bb7c2085 280 FK_OPS, FK_TYPE, modeFlag,
281 "strictops",
282 FLG_STRICTOPS,
283 "primitive operation does not type check strictly",
284 "A primitive operation does not type check strictly.", 0, 0
28bf4b0b 285 },
286 {
bb7c2085 287 FK_OPS, FK_TYPE, modeFlag,
288 "bitwisesigned",
289 FLG_BITWISEOPS,
290 "a bitwise logical operator does not have unsigned operands",
291 "An operand to a bitwise operator is not an unsigned values. This "
292 "may have unexpected results depending on the signed "
293 "representations.", 0, 0
28bf4b0b 294 },
295 {
bb7c2085 296 FK_OPS, FK_TYPE, modeFlag,
297 "shiftnegative",
298 FLG_SHIFTNEGATIVE,
299 "a shift right operand may be negative",
300 "The right operand to a shift operator may be negative (behavior undefined).",
301 0, 0
28bf4b0b 302 },
303 {
bb7c2085 304 FK_OPS, FK_TYPE, modeFlag,
305 "shiftimplementation",
306 FLG_SHIFTIMPLEMENTATION,
307 "a shift left operand may be negative",
308 "The left operand to a shift operator may be negative (behavior is implementation-defined).",
28bf4b0b 309 0, 0
310 },
311 {
bb7c2085 312 FK_OPS, FK_TYPE, modeFlag,
313 "sizeoftype",
314 FLG_SIZEOFTYPE,
315 "sizeof operator has a type argument",
316 "Operand of sizeof operator is a type. (Safer to use expression, "
317 "int *x = sizeof (*x); instead of sizeof (int).)",
28bf4b0b 318 0, 0
319 },
320 {
bb7c2085 321 FK_OPS, FK_TYPE, plainFlag,
322 "sizeofformalarray",
323 FLG_SIZEOFFORMALARRAY,
324 "sizeof operator has an array formal parameter argument",
325 "Operand of a sizeof operator is a function parameter declared as "
326 "an array. The value of sizeof will be the size of a pointer to the "
327 "element type, not the number of elements in the array.",
28bf4b0b 328 0, 0
329 },
330 {
bb7c2085 331 FK_DECL, FK_TYPE, plainFlag,
332 "fixedformalarray",
333 FLG_FIXEDFORMALARRAY,
334 "formal parameter of type array is declared with size",
335 "A formal parameter is declared as an array with size. The size of the array "
336 "is ignored in this context, since the array formal parameter is treated "
337 "as a pointer.",
28bf4b0b 338 0, 0
339 },
340 {
bb7c2085 341 FK_DECL, FK_TYPE, plainFlag,
342 "incompletetype",
343 FLG_INCOMPLETETYPE,
344 "formal parameter has an incomplete type",
345 "A formal parameter is declared with an incomplete type.",
28bf4b0b 346 0, 0
347 },
348 {
bb7c2085 349 FK_DECL, FK_TYPE, plainFlag,
350 "formalarray",
351 FLG_FORMALARRAY,
352 "formal parameter is an array",
353 "A formal parameter is declared as an array. This can be confusing, since "
354 "a formal array parameter is treated as a pointer.",
355 0, 0
28bf4b0b 356 },
bb7c2085 357
358
359 /*
360 ** Booleans (4.2)
361 */
362
28bf4b0b 363 {
4f43223c 364 FK_BOOL, FK_NONE, regStringFlag, ARG_STRING,
28bf4b0b 365 "booltype",
366 FLG_BOOLTYPE,
367 "set name of boolean type (default bool)",
368 NULL, 0, 0
369 },
bb7c2085 370 {
371 FK_BOOL, FK_NONE, regStringFlag, ARG_STRING,
372 "boolfalse",
373 FLG_BOOLFALSE,
374 "set name of boolean false (default FALSE)",
375 NULL, 0, 0
376 },
28bf4b0b 377 {
4f43223c 378 FK_BOOL, FK_NONE, regStringFlag, ARG_STRING,
28bf4b0b 379 "booltrue",
380 FLG_BOOLTRUE,
381 "set name of boolean true (default TRUE)",
382 NULL, 0, 0
383 },
384 {
bb7c2085 385 FK_BOOL, FK_HELP, plainFlag,
386 "likelybool",
387 FLG_LIKELYBOOL,
388 "type name is probably a boolean type but does not match default "
389 "boolean type name, \"bool\", and alternate name is not set",
390 "Use the -booltype, -boolfalse and -booltrue flags to change the "
391 "name of the default boolean type.",
392 0, 0
28bf4b0b 393 },
bb7c2085 394
28bf4b0b 395 {
bb7c2085 396 FK_BOOL, FK_OPS, modeFlag,
397 "boolcompare",
398 FLG_BOOLCOMPARE,
399 "comparison between bools (dangerous because of multiple TRUE values)",
400 "Two bool values are compared directly using a C primitive. This "
401 "may produce unexpected results since all non-zero values are "
402 "considered TRUE, so different TRUE values may not be equal. "
403 "The file bool.h (included in splint/lib) provides bool_equal "
404 "for safe bool comparisons.", 0, 0
28bf4b0b 405 },
406 {
bb7c2085 407 FK_BOOL, FK_OPS, modeFlag,
408 "boolops",
409 FLG_BOOLOPS,
410 "primitive operation (!, && or ||) does not has a boolean argument",
411 "The operand of a boolean operator is not a boolean. Use +ptrnegate "
412 "to allow ! to be used on pointers.",
28bf4b0b 413 0, 0
414 },
990ec868 415 {
bb7c2085 416 FK_BOOL, FK_POINTER, modeFlag,
417 "ptrnegate",
418 FLG_PTRNEGATE,
419 "allow ! to be used on pointer operand",
420 "The operand of ! operator is a pointer.", 0, 0
990ec868 421 },
28bf4b0b 422 {
bb7c2085 423 FK_BOOL, FK_PRED,plainFlag,
424 "predassign",
425 FLG_PREDASSIGN,
426 "condition test (if, while or for) is an assignment",
427 "The condition test is an assignment expression. Probably, you mean "
428 "to use == instead of =. If an assignment is intended, add an "
429 "extra parentheses nesting (e.g., if ((a = b)) ...) to suppress "
430 "this message.",
28bf4b0b 431 0, 0
432 },
e5f31c00 433 {
bb7c2085 434 FK_BOOL, FK_PRED, specialFlag,
435 "predbool",
436 FLG_PREDBOOL,
437 "type of condition test (if, while or for) not bool (sets predboolint, "
438 "predboolptr and predboolothers)",
439 "Test expression type is not boolean.", 0, 0
e5f31c00 440 },
28bf4b0b 441 {
bb7c2085 442 FK_PRED, FK_BOOL, modeFlag,
443 "predboolint",
444 FLG_PREDBOOLINT,
445 "type of condition test (if, while or for) is an integral type",
446 "Test expression type is not boolean or int.", 0, 0
28bf4b0b 447 },
448 {
bb7c2085 449 FK_BOOL, FK_PRED, modeFlag,
450 "predboolptr",
451 FLG_PREDBOOLPTR,
452 "type of condition test (if, while or for) is a pointer",
453 "Test expression type is not boolean.", 0, 0
28bf4b0b 454 },
455 {
bb7c2085 456 FK_BOOL, FK_PRED, modeFlag,
457 "predboolothers",
458 FLG_PREDBOOLOTHERS,
459 "type of condition test (if, while or for) not bool, int or pointer",
460 "Test expression type is not boolean.", 0, 0
28bf4b0b 461 },
bb7c2085 462
463 /*
464 ** 4.3 Abstract types
465 */
466
28bf4b0b 467 {
bb7c2085 468 FK_ABSTRACT, FK_NONE, plainFlag,
469 "abstract",
470 FLG_ABSTRACT,
471 "data abstraction barriers",
472 "An abstraction barrier is broken. If necessary, use /*@access <type>@*/ to allow access to an abstract type.",
28bf4b0b 473 0, 0
474 },
475 {
bb7c2085 476 FK_ABSTRACT, FK_IMPLICIT, plainFlag,
477 "impabstract",
478 FLG_IMPABSTRACT,
479 "assume user type definitions are abstract (unless /*@concrete@*/ is used)",
480 NULL,
28bf4b0b 481 0, 0
482 },
bb7c2085 483
484 /* 4.3.1 Access */
485
28bf4b0b 486 {
bb7c2085 487 FK_ABSTRACT, FK_NAMES, plainFlag,
488 "accessmodule",
489 FLG_ACCESSMODULE,
490 "allow access to abstract types in definition module",
491 "The representation of an abstract type defined in <M>.<x> is "
492 "accessible anywhere in a file named <M>.<y>.",
28bf4b0b 493 0, 0
494 },
495 {
bb7c2085 496 FK_ABSTRACT, FK_NAMES, plainFlag,
497 "accessfile",
498 FLG_ACCESSFILE,
499 "allow access to abstract types by file name convention",
500 "The representation of an abstract type named <t> is "
501 "accessible anywhere in a file named <t>.<x>.",
28bf4b0b 502 0, 0
503 },
504 {
bb7c2085 505 FK_ABSTRACT, FK_NAMES, plainFlag,
506 "accessczech",
507 FLG_ACCESSCZECH,
508 "allow access to abstract types by czech naming convention",
509 "The representation of an abstract type named <t> is accessible "
510 "in the definition of a function or constant named <t>_<name>",
511 0, 0
3e3ec469 512 },
513 {
bb7c2085 514 FK_ABSTRACT, FK_NAMES, plainFlag,
515 "accessslovak",
516 FLG_ACCESSSLOVAK,
517 "allow access to abstract types by slovak naming convention",
518 "The representation of an abstract type named <t> is accessible "
519 "in the definition of a function or constant named <t><Name>",
520 0, 0
3e3ec469 521 },
522 {
bb7c2085 523 FK_ABSTRACT, FK_NAMES, plainFlag,
524 "accessczechoslovak",
525 FLG_ACCESSCZECHOSLOVAK,
526 "allow access to abstract types by czechoslovak naming convention",
527 "The representation of an abstract type named <t> is accessible "
528 "in the definition of a function or constant named <t>_<name> or <t><Name>",
529 0, 0
3e3ec469 530 },
531 {
bb7c2085 532 FK_ABSTRACT, FK_NAMES, specialFlag,
533 "accessall",
534 FLG_ACCESSALL,
535 "set accessmodule, accessfile and accessczech",
536 "Sets accessmodule, accessfile and accessczech",
537 0, 0
28bf4b0b 538 },
bb7c2085 539
540 /* 4.3.2 Mutability */
28bf4b0b 541 {
bb7c2085 542 FK_ABSTRACT, FK_NONE, modeFlag,
543 "mutrep",
544 FLG_MUTREP,
545 "representation of mutable type has sharing semantics",
546 "LCL semantics requires that a mutable type exhibits sharing semantics. "
547 "In order for objects to be shared a indirection is necessary in the representation. "
548 "A mutable type may be represented by a pointer or an abstract mutable type. Handles "
549 "into static data are fine, too, but will generate this error message unless it is suppressed.",
28bf4b0b 550 0, 0
551 },
bb7c2085 552
553
554 /*
555 ** Memory Management (5)
556 */
557
558 /* Deallocation Errors */
28bf4b0b 559 {
bb7c2085 560 FK_MEMORY, FK_LEAK, modeFlag,
561 "mustfreefresh",
562 FLG_MUSTFREEFRESH,
563 "freshly allocated storage not released before return or scope exit",
564 "A memory leak has been detected. Storage allocated locally "
565 "is not released before the last reference to it is lost.",
28bf4b0b 566 0, 0
567 },
568 {
bb7c2085 569 FK_MEMORY, FK_LEAK, modeFlag,
570 "mustfreeonly",
571 FLG_MUSTFREEONLY,
572 "only storage not released before return or scope exit",
573 "A memory leak has been detected. Only-qualified storage is not released before the last "
574 "reference to it is lost.",
28bf4b0b 575 0, 0
576 },
577 {
bb7c2085 578 FK_MEMORY, FK_LEAK, specialFlag,
579 "mustfree",
580 FLG_MUSTFREE,
581 "fresh or only storage not released before return or scope exit (sets mustfreefresh and mustfreeonly)",
582 "A memory leak has been detected.",
28bf4b0b 583 0, 0
584 },
585 {
bb7c2085 586 FK_MEMORY, FK_DEAD, modeFlag,
587 "usereleased",
588 FLG_USERELEASED,
589 "storage used after release",
590 "Memory is used after it has been released (either by passing "
591 "as an only param or assigning to an only global).",
28bf4b0b 592 0, 0
593 },
594 {
bb7c2085 595 FK_MEMORY, FK_DEAD, modeFlag,
596 "strictusereleased",
597 FLG_STRICTUSERELEASED,
598 "element used after it may have been released",
599 "Memory (through fetch) is used after it may have been released "
600 "(either by passing as an only param or assigning to an only global).",
28bf4b0b 601 0, 0
602 },
603 {
bb7c2085 604 FK_MEMORY, FK_LEAK, modeFlag,
605 "compdestroy",
606 FLG_COMPDESTROY,
607 "all only references derivable from void pointer out only parameter are released",
608 "A storage leak due to incomplete deallocation of a structure or deep "
609 "pointer is suspected. Unshared storage that is reachable from "
610 "a reference that is being deallocated has not yet been deallocated. "
611 "Splint assumes when an object is passed "
612 "as an out only void pointer that the outer object will be "
613 "deallocated, but the inner objects will not.",
28bf4b0b 614 0, 0
615 },
616 {
bb7c2085 617 FK_MEMORY, FK_LEAK, modeFlag,
618 "strictdestroy",
619 FLG_STRICTDESTROY,
620 "report complete destruction errors for array elements that "
621 "may have been released",
622 NULL,
623 0, 0
624 },
625 {
626 FK_MEMORY, FK_ARRAY, modeFlag,
627 "deparrays",
628 FLG_DEPARRAYS,
629 "array elements are dependent storage",
630 "When an element is fetched from an array, Splint analysis is "
631 "not able to determine if the same element is reused. "
632 "If +deparrays, Splint will mark local storage assigned from "
633 "array fetches as dependent.",
28bf4b0b 634 0, 0
635 },
636 {
bb7c2085 637 FK_MEMORY, FK_NONE, modeFlag,
638 "branchstate",
639 FLG_BRANCHSTATE,
640 "storage has inconsistent states of alternate paths through a branch",
641 "The state of a variable is different depending on which branch "
642 "is taken. This means no annotation can sensibly be applied "
643 "to the storage.",
28bf4b0b 644 0, 0
645 },
646 {
bb7c2085 647 FK_MEMORY, FK_NONE, modeFlag,
648 "strictbranchstate",
649 FLG_STRICTBRANCHSTATE,
650 "storage through array fetch has inconsistent states of alternate "
651 "paths through a branch",
652 "The state of a variable through an array fetch is different depending "
653 "on which branch is taken. This means no annotation can sensibly be applied "
654 "to the storage.",
28bf4b0b 655 0, 0
656 },
657 {
bb7c2085 658 FK_MEMORY, FK_NONE, specialFlag,
659 "memchecks",
660 FLG_MEMCHECKS,
661 "sets all dynamic memory checking flags (memimplicit, mustfree, mustdefine, "
662 "mustnotalias, null, memtrans)",
663 NULL, 0, 0
28bf4b0b 664 },
665 {
bb7c2085 666 FK_MEMORY, FK_DEF, modeFlag,
667 "compmempass",
668 FLG_COMPMEMPASS,
669 "actual parameter matches alias kind of formal parameter completely ",
670 "Storage derivable from a parameter does not match the alias kind "
671 "expected for the formal parameter.",
28bf4b0b 672 0, 0
673 },
674 {
bb7c2085 675 FK_MEMORY, FK_DEAD, modeFlag,
676 "stackref",
677 FLG_RETSTACK,
678 "external reference to stack-allocated storage is created",
679 "A stack reference is pointed to by an external reference when the "
680 "function returns. The stack-allocated storage is destroyed "
681 "after the call, leaving a dangling reference.",
28bf4b0b 682 0, 0
683 },
bb7c2085 684
28bf4b0b 685 {
bb7c2085 686 FK_MEMORY, FK_NONE, specialFlag,
687 "memtrans",
688 FLG_MEMTRANS,
689 "memory transfer errors (sets all *trans flags)",
690 "Memory is transferred in a way that violates annotations.",
28bf4b0b 691 0, 0
692 },
693 {
bb7c2085 694 FK_MEMORY, FK_NONE, modeFlag,
695 "dependenttrans",
696 FLG_DEPENDENTTRANS,
697 "dependent transfer errors",
698 "Dependent storage is transferred to a non-dependent reference.",
28bf4b0b 699 0, 0
700 },
701 {
bb7c2085 702 FK_MEMORY, FK_NONE, modeFlag,
703 "newreftrans",
704 FLG_NEWREFTRANS,
705 "new reference transfer to reference counted reference",
706 "A new reference is transferred to a reference counted reference.",
28bf4b0b 707 0, 0
708 },
709 {
bb7c2085 710 FK_MEMORY, FK_NONE, modeFlag,
711 "onlytrans",
712 FLG_ONLYTRANS,
713 "only storage transferred to non-only reference (memory leak)",
714 "The only reference to this storage is transferred to another "
715 "reference (e.g., by returning it) that does not have the "
716 "only annotation. This may lead to a memory leak, since the "
717 "new reference is not necessarily released.",
28bf4b0b 718 0, 0
719 },
720 {
bb7c2085 721 FK_MEMORY, FK_NONE, modeFlag,
722 "onlyunqglobaltrans",
723 FLG_ONLYUNQGLOBALTRANS,
724 "only storage transferred to an unqualified global or "
725 "static reference (memory leak)",
726 "The only reference to this storage is transferred to another "
727 "reference that does not have an aliasing annotation. "
728 "This may lead to a memory leak, since the "
729 "new reference is not necessarily released.",
28bf4b0b 730 0, 0
731 },
732 {
bb7c2085 733 FK_MEMORY, FK_NONE, modeFlag,
734 "ownedtrans",
735 FLG_OWNEDTRANS,
736 "owned storage transferred to non-owned reference (memory leak)",
737 "The owned reference to this storage is transferred to another "
738 "reference (e.g., by returning it) that does not have the "
739 "owned annotation. This may lead to a memory leak, since the "
740 "new reference is not necessarily released.",
28bf4b0b 741 0, 0
742 },
743 {
bb7c2085 744 FK_MEMORY, FK_NONE, modeFlag,
745 "freshtrans",
746 FLG_FRESHTRANS,
747 "fresh storage transferred to non-only reference (memory leak)",
748 "Fresh storage (newly allocated in this function) is transferred "
749 "in a way that the obligation to release storage is not "
750 "propagated. Use the /*@only@*/ annotation to indicate "
751 "the a return value is the only reference to the returned "
752 "storage.",
28bf4b0b 753 0, 0
754 },
755 {
bb7c2085 756 FK_MEMORY, FK_NONE, modeFlag,
757 "sharedtrans",
758 FLG_SHAREDTRANS,
759 "shared storage transferred to non-shared reference",
760 "Shared storage is transferred to a non-shared reference. The other "
761 "reference may release storage needed by this reference.",
28bf4b0b 762 0, 0
763 },
764 {
bb7c2085 765 FK_MEMORY, FK_NONE, modeFlag,
766 "temptrans",
767 FLG_TEMPTRANS,
768 "temp storage transferred to non-temporary reference",
769 "Temp storage (associated with a formal parameter) is transferred "
770 "to a non-temporary reference. The storage may be released "
771 "or new aliases created.",
28bf4b0b 772 0, 0
773 },
774 {
bb7c2085 775 FK_MEMORY, FK_NONE, modeFlag,
776 "kepttrans",
777 FLG_KEPTTRANS,
778 "kept storage transferred to non-temporary reference",
45569d72 779 "storage is transferred "
780 "to a non-temporary reference after being passed as keep parameter. The storage may be released "
bb7c2085 781 "or new aliases created.",
28bf4b0b 782 0, 0
783 },
784 {
bb7c2085 785 FK_MEMORY, FK_NONE, modeFlag,
786 "keeptrans",
787 FLG_KEEPTRANS,
788 "keep storage transferred inconsistently",
789 "Keep storage is transferred inconsistently --- either in a way "
790 "that may add a new alias to it, or release it.",
28bf4b0b 791 0, 0
792 },
793 {
bb7c2085 794 FK_MEMORY, FK_NONE, modeFlag,
795 "immediatetrans",
796 FLG_IMMEDIATETRANS,
797 "an immediate address (result of &) is transferred inconsistently",
798 "An immediate address (result of & operator) is transferred "
799 "inconsistently.",
28bf4b0b 800 0, 0
801 },
802 {
bb7c2085 803 FK_MEMORY, FK_NONE, modeFlag,
804 "refcounttrans",
805 FLG_REFCOUNTTRANS,
806 "reference counted storage is transferred in an inconsistent way",
807 "Reference counted storage is transferred in a way that may not "
808 "be consistent with the reference count.",
28bf4b0b 809 0, 0
810 },
811 {
bb7c2085 812 FK_MEMORY, FK_NONE, modeFlag,
813 "statictrans",
814 FLG_STATICTRANS,
815 "static storage is transferred in an inconsistent way",
816 "Static storage is transferred in an inconsistent way.",
28bf4b0b 817 0, 0
818 },
819 {
bb7c2085 820 FK_MEMORY, FK_NONE, modeFlag,
821 "unqualifiedtrans",
822 FLG_UNKNOWNTRANS,
823 "unqualified storage is transferred in an inconsistent way",
824 "Unqualified storage is transferred in an inconsistent way.",
28bf4b0b 825 0, 0
bb7c2085 826 },
28bf4b0b 827 {
bb7c2085 828 FK_MEMORY, FK_NONE, modeFlag,
829 "staticinittrans",
830 FLG_STATICINITTRANS,
831 "static storage is used as an initial value in an inconsistent way",
832 "Static storage is used as an initial value in an inconsistent way.",
28bf4b0b 833 0, 0
834 },
835 {
bb7c2085 836 FK_MEMORY, FK_NONE, modeFlag,
837 "unqualifiedinittrans",
838 FLG_UNKNOWNINITTRANS,
839 "unqualified storage is used as an initial value in an inconsistent way",
840 "Unqualified storage is used as an initial value in an inconsistent way.",
28bf4b0b 841 0, 0
842 },
843 {
bb7c2085 844 FK_MEMORY, FK_NONE, modeFlag,
845 "readonlytrans",
846 FLG_READONLYTRANS,
847 "report memory transfer errors for initializations to read-only string literals",
848 "A read-only string literal is assigned to a non-observer reference.",
28bf4b0b 849 0, 0
850 },
851 {
bb7c2085 852 FK_MEMORY, FK_PARAMS, modeFlag,
853 "passunknown",
854 FLG_PASSUNKNOWN,
855 "passing a value as an un-annotated parameter clears its annotation",
856 NULL, 0, 0
28bf4b0b 857 },
bb7c2085 858
859 /* 5.3 Implicit Memory Annotations */
860
28bf4b0b 861 {
bb7c2085 862 FK_MEMORY, FK_NONE, modeFlag,
863 "readonlystrings",
864 FLG_READONLYSTRINGS,
865 "string literals are read-only (error if one is modified or released)",
866 "String literals are read-only. An error is reported "
867 "if a string literal may be modified or released.",
28bf4b0b 868 0, 0
869 },
870 {
bb7c2085 871 FK_MEMORY, FK_IMPLICIT, modeFlag,
872 "memimp",
873 FLG_MEMIMPLICIT,
874 "memory errors for unqualified storage",
28bf4b0b 875 NULL, 0, 0
876 },
877 {
bb7c2085 878 FK_MEMORY, FK_IMPLICIT, plainFlag,
879 "paramimptemp",
880 FLG_PARAMIMPTEMP,
881 "assume unannotated parameter is temp",
28bf4b0b 882 NULL, 0, 0
883 },
884 {
bb7c2085 885 FK_MEMORY, FK_IMPLICIT, specialFlag,
886 "allimponly",
887 FLG_ALLIMPONLY,
888 "sets globimponly, retimponly, structimponly, specglobimponly, "
889 "specretimponly and specstructimponly",
28bf4b0b 890 NULL, 0, 0
bb7c2085 891 },
28bf4b0b 892 {
bb7c2085 893 FK_MEMORY, FK_IMPLICIT, specialFlag,
894 "codeimponly",
895 FLG_CODEIMPONLY,
896 "sets globimponly, retimponly and structimponly",
28bf4b0b 897 NULL, 0, 0
bb7c2085 898 },
28bf4b0b 899 {
bb7c2085 900 FK_MEMORY, FK_IMPLICIT, specialFlag,
901 "specimponly",
902 FLG_SPECALLIMPONLY,
903 "sets specglobimponly, specretimponly and specstructimponly",
28bf4b0b 904 NULL, 0, 0
bb7c2085 905 },
28bf4b0b 906 {
bb7c2085 907 FK_MEMORY, FK_IMPLICIT, plainFlag,
908 "globimponly",
909 FLG_GLOBIMPONLY,
910 "assume unannotated global storage is only",
28bf4b0b 911 NULL, 0, 0
885824d3 912 },
28bf4b0b 913 {
bb7c2085 914 FK_MEMORY, FK_IMPLICIT, plainFlag,
915 "retimponly",
916 FLG_RETIMPONLY,
917 "assume unannotated returned storage is only",
28bf4b0b 918 NULL, 0, 0
919 },
920 {
bb7c2085 921 FK_MEMORY, FK_IMPLICIT, plainFlag,
922 "structimponly",
923 FLG_STRUCTIMPONLY,
924 "assume unannotated structure field is only",
28bf4b0b 925 NULL, 0, 0
926 },
927 {
bb7c2085 928 FK_MEMORY, FK_IMPLICIT, plainFlag,
929 "specglobimponly",
930 FLG_SPECGLOBIMPONLY,
931 "assume unannotated global storage is only",
28bf4b0b 932 NULL, 0, 0
933 },
934 {
bb7c2085 935 FK_MEMORY, FK_IMPLICIT, plainFlag,
936 "specretimponly",
937 FLG_SPECRETIMPONLY,
938 "assume unannotated returned storage is only",
28bf4b0b 939 NULL, 0, 0
940 },
941 {
bb7c2085 942 FK_MEMORY, FK_IMPLICIT, plainFlag,
943 "specstructimponly",
944 FLG_SPECSTRUCTIMPONLY,
945 "assume unannotated structure field is only",
28bf4b0b 946 NULL, 0, 0
947 },
bb7c2085 948
949 /* Reference Counting */
950
951
952
953 /*
954 ** 6. Sharing
955 */
956
957 /* 6.1 Aliasing warnings */
958
28bf4b0b 959 {
bb7c2085 960 FK_ALIAS, FK_MEMORY, modeFlag,
961 "aliasunique",
962 FLG_ALIASUNIQUE,
963 "unique parameter is aliased",
964 "A unique or only parameter is aliased by some other parameter or visible global.",
965 0, 0
28bf4b0b 966 },
967 {
bb7c2085 968 FK_ALIAS, FK_MEMORY, modeFlag,
969 "mayaliasunique",
970 FLG_MAYALIASUNIQUE,
971 "unique parameter may be aliased",
972 "A unique or only parameter may be aliased by some other parameter or visible global.",
973 0, 0
28bf4b0b 974 },
975 {
bb7c2085 976 FK_ALIAS, FK_MEMORY, modeFlag,
977 "mustnotalias",
978 FLG_MUSTNOTALIAS,
979 "temp storage aliased at return point or scope exit",
980 "An alias has been added to a temp-qualifier parameter or global that is visible externally when the function returns. If the aliasing is needed, use the /*@shared@*/ annotation to indicate that new aliases to the parameter may be created.",
981 0, 0
28bf4b0b 982 },
983 {
bb7c2085 984 FK_ALIAS, FK_NONE, modeFlag,
985 "retalias",
986 FLG_RETALIAS,
987 "function returns alias to parameter or global",
988 "The returned value shares storage with a parameter or global. If a parameter is to be returned, use the returned qualifier. If the result is not modified, use the observer qualifier on the result type. Otherwise, exposed can be used, but limited checking is done.", 0, 0
28bf4b0b 989 },
bb7c2085 990
991 /* Global aliasing */
28bf4b0b 992 {
bb7c2085 993 FK_ALIAS, FK_GLOBALS, specialFlag,
994 "globalias",
995 FLG_GLOBALIAS,
996 "function returns with global aliasing external state (sets "
997 "checkstrictglobalias, checkedglobalias, checkmodglobalias and "
998 "uncheckedglobalias)",
999 "A global variable aliases externally-visible state when the function returns.",
28bf4b0b 1000 0, 0
1001 },
1002 {
bb7c2085 1003 FK_ALIAS, FK_GLOBALS, modeFlag,
1004 "checkstrictglobalias",
1005 FLG_CHECKSTRICTGLOBALIAS,
1006 "function returns with a checkstrict global aliasing external state",
1007 "A global variable aliases externally-visible state when the function returns.",
28bf4b0b 1008 0, 0
1009 },
1010 {
bb7c2085 1011 FK_ALIAS, FK_GLOBALS, modeFlag,
1012 "checkedglobalias",
1013 FLG_CHECKEDGLOBALIAS,
1014 "function returns with a checked global aliasing external state",
1015 "A global variable aliases externally-visible state when the function returns.",
28bf4b0b 1016 0, 0
1017 },
1018 {
bb7c2085 1019 FK_ALIAS, FK_GLOBALS, modeFlag,
1020 "checkmodglobalias",
1021 FLG_CHECKMODGLOBALIAS,
1022 "function returns with a checkmod global aliasing external state",
1023 "A global variable aliases externally-visible state when the function returns.",
1024 0, 0
28bf4b0b 1025 },
1026 {
bb7c2085 1027 FK_ALIAS, FK_GLOBALS, modeFlag,
1028 "uncheckedglobalias",
1029 FLG_UNCHECKEDGLOBALIAS,
1030 "function returns with an unchecked global aliasing external state",
1031 "A global variable aliases externally-visible state when the function returns.",
1032 0, 0
28bf4b0b 1033 },
bb7c2085 1034
1035 /* 6.2 Exposure */
1036
28bf4b0b 1037 {
bb7c2085 1038 FK_MEMORY, FK_NONE, modeFlag,
1039 "exposetrans",
1040 FLG_EXPOSETRANS,
1041 "exposure transfer errors",
1042 "Exposed storage is transferred to a non-exposed, non-observer reference.",
1043 0, 0
28bf4b0b 1044 },
1045 {
bb7c2085 1046 FK_MEMORY, FK_NONE, modeFlag,
1047 "observertrans",
1048 FLG_OBSERVERTRANS,
1049 "observer transfer errors",
1050 "Observer storage is transferred to a non-observer reference.",
1051 0, 0
28bf4b0b 1052 },
1053 {
1054 FK_EXPOSURE, FK_ABSTRACT, specialFlag,
1055 "repexpose",
1056 FLG_REPEXPOSE,
1057 "abstract representation is exposed (sets assignexpose, retexpose, and castexpose)",
1058 "The internal representation of an abstract type is visible to the "
1059 "caller. This means clients may have access to a pointer "
1060 "into the abstract representation.",
1061 0, 0
1062 },
1063 {
1064 FK_EXPOSURE, FK_ABSTRACT, modeFlag,
1065 "retexpose",
1066 FLG_RETEXPOSE,
1067 "abstract representation is exposed (return values only)",
1068 "The return value shares storage with an instance of an abstract "
1069 "type. This means clients may have access to a pointer into "
1070 "the abstract representation. Use the observer qualifier to "
1071 "return exposed storage that may not be modified by the "
1072 "client. Use the exposed qualifier to return modifiable "
1073 "(but not deallocatable) exposed storage (dangerous).",
1074 0, 0
1075 },
1076 {
1077 FK_EXPOSURE, FK_ABSTRACT, modeFlag,
1078 "assignexpose",
1079 FLG_ASSIGNEXPOSE,
1080 "abstract representation is exposed (assignments only)",
1081 "Storage internal to the representation of an abstract type is "
1082 "assigned to an external pointer. This means clients may "
1083 "have access to a pointer into the abstract representation. "
1084 "If the external pointer is a parameter, the exposed qualifier "
1085 "can be used to allow the assignment, however, this is "
1086 "considered dangerous programming practice.",
1087 0, 0
1088 },
1089 {
1090 FK_EXPOSURE, FK_ABSTRACT, modeFlag,
1091 "castexpose",
1092 FLG_CASTEXPOSE,
1093 "abstract representation is exposed through a cast",
1094 "Storage internal to the representation of an abstract type is exposed "
1095 "through a type cast. This means clients may have access to a "
1096 "pointer into the abstract representation.",
1097 0, 0
885824d3 1098 },
28bf4b0b 1099 {
bb7c2085 1100 FK_DECL, FK_TYPE, modeFlag,
1101 "redundantsharequal",
1102 FLG_REDUNDANTSHAREQUAL,
1103 "declaration uses observer qualifier that is always true",
1104 "A declaration of an immutable object uses a redundant observer qualifier.",
1105 0, 0
1106 } ,
1107 {
1108 FK_DECL, FK_TYPE, modeFlag,
1109 "misplacedsharequal",
1110 FLG_MISPLACEDSHAREQUAL,
1111 "declaration of unsharable storage uses sharing annotation",
1112 "A declaration of an unsharable object uses a sharing annotation.",
1113 0, 0
1114 } ,
1115
1116 /*
1117 ** 7. Function Interfaces
1118 */
1119
1120 /* 7.1 Modifications */
1121
1122 {
1123 FK_MODIFIES, FK_SPEC, plainFlag,
1124 "mods",
1125 FLG_MODIFIES,
1126 "unspecified modification of caller-visible state",
1127 "An externally-visible object is modified by a function, but not "
1128 "listed in its modifies clause.",
1129 0, 0
28bf4b0b 1130 },
1131 {
bb7c2085 1132 FK_MODIFIES, FK_SPEC, modeFlag,
1133 "mustmod",
1134 FLG_MUSTMOD,
1135 "specified modification is not detected",
1136 "An object listed in the modifies clause is not modified by the "
1137 "implementation of the function. The modification may not "
1138 "be detected if it is done through a call to an unspecified "
1139 "function.",
1140 0, 0
28bf4b0b 1141 },
1142 {
bb7c2085 1143 FK_MODIFIES, FK_MEMORY, plainFlag,
1144 "modobserver",
1145 FLG_MODOBSERVER,
1146 "possible modification of observer storage",
1147 "Storage declared with observer is possibly modified. Observer "
1148 "storage may not be modified.",
1149 0, 0
28bf4b0b 1150 },
1151 {
bb7c2085 1152 FK_MODIFIES, FK_MEMORY, modeFlag,
1153 "modobserveruncon",
1154 FLG_MODOBSERVERUNCON,
1155 "possible modification of observer storage through unconstrained call",
1156 "Storage declared with observer may be modified through a call to an "
1157 "unconstrained function.",
1158 0, 0
1159 },
1160 {
1161 FK_MODIFIES, FK_MEMORY, modeFlag,
1162 "modinternalstrict",
1163 FLG_MODINTERNALSTRICT,
1164 "possible modification of internal storage through function call",
1165 "A function that modifies internalState is called from a function that "
1166 "does not list internalState in its modifies clause",
1167 0, 0
1168 },
1169 {
1170 FK_MODIFIES, FK_UNSPEC, modeFlag,
1171 "modfilesys",
1172 FLG_MODFILESYSTEM,
1173 "report undocumented file system modifications (applies to unspecified "
1174 "functions if modnomods is set)",
28bf4b0b 1175 NULL, 0, 0
1176 },
1177 {
bb7c2085 1178 FK_MODIFIES, FK_UNSPEC, specialFlag,
1179 "modunspec",
1180 FLG_MODUNSPEC,
1181 "modification in unspecified functions (sets modnomods, "
1182 "modglobunspec and modstrictglobsunspec)",
28bf4b0b 1183 NULL, 0, 0
1184 },
1185 {
bb7c2085 1186 FK_MODIFIES, FK_UNSPEC, modeFlag,
1187 "modnomods",
1188 FLG_MODNOMODS,
1189 "modification in a function with no modifies clause",
1190 "An externally-visible object is modified by a function with no "
1191 "/*@modifies@*/ comment. The /*@modifies ... @*/ control "
1192 "comment can be used to give a modifies list for an "
1193 "unspecified function.",
28bf4b0b 1194 0, 0
1195 },
1196 {
bb7c2085 1197 FK_MODIFIES, FK_UNSPEC, modeFlag,
1198 "moduncon",
1199 FLG_MODUNCON,
1200 "possible modification through a call to an unconstrained function",
1201 "An unconstrained function is called in a function body where "
1202 "modifications are checked. Since the unconstrained function "
1203 "may modify anything, there may be undetected modifications in "
1204 "the checked function.",
1205 0, 0
1206 },
28bf4b0b 1207 {
bb7c2085 1208 FK_MODIFIES, FK_UNSPEC, modeFlag,
1209 "modunconnomods",
1210 FLG_MODUNCONNOMODS,
1211 "possible modification through a call to an unconstrained function in "
1212 "a function with no modifies clause",
1213 "An unconstrained function is called in a function body where "
1214 "modifications are checked. Since the unconstrained function "
1215 "may modify anything, there may be undetected modifications in "
1216 "the checked function.",
1217 0, 0
28bf4b0b 1218 },
1219 {
bb7c2085 1220 FK_MODIFIES, FK_GLOBALS, modeFlag,
1221 "globsimpmodsnothing",
1222 FLG_GLOBALSIMPMODIFIESNOTHING,
1223 "functions declared with a globals list but no modifies clause are "
1224 "assumed to modify nothing",
1225 "An implicit modifies nothing clause is assumed for a function "
1226 "declared with a globals list but not modifies clause.",
1227 0, 0
28bf4b0b 1228 },
1229 {
bb7c2085 1230 FK_MODIFIES, FK_GLOBALS, modeFlag,
1231 "modsimpnoglobs",
1232 FLG_MODIFIESIMPNOGLOBALS,
1233 "functions declared with a modifies clause but no globals list "
1234 "are assumed to use no globals",
1235 "An implicit empty globals list is assumed for a function "
1236 "declared with a modifies clause but no globals list.",
1237 0, 0
1238 },
1239
1240 /*
1241 ** Globals
1242 */
1243
1244 {
1245 FK_GLOBALS, FK_NONE, modeFlag,
1246 "globstate",
1247 FLG_GLOBSTATE,
1248 "returns with global in inconsistent state (null or undefined)",
1249 "A global variable does not satisfy its annotations when control is transferred.",
1250 0, 0
28bf4b0b 1251 },
bb7c2085 1252
28bf4b0b 1253 {
1254 FK_GLOBALS, FK_SPEC, plainFlag,
1255 "globs",
1256 FLG_GLOBALS,
1257 "undocumented use of a checked global variable",
1258 "A checked global variable is used in the function, but not listed in "
1259 "its globals clause. By default, only globals specified in .lcl "
1260 "files are checked. To check all globals, use +allglobals. To "
1261 "check globals selectively use /*@checked@*/ in the global "
1262 "declaration.",
1263 0, 0
1264 },
1265 {
1266 FK_GLOBALS, FK_SPEC, modeFlag,
1267 "globuse",
1268 FLG_USEALLGLOBS,
1269 "global listed for a function not used",
1270 "A global variable listed in the function's globals list is not used "
1271 "in the body of the function.",
1272 0, 0
1273 },
1274 {
1275 FK_GLOBALS, FK_NONE, modeFlag,
1276 "internalglobs",
1277 FLG_INTERNALGLOBS,
1278 "use of internalState",
1279 "A called function uses internal state, but the globals list for the "
1280 "function being checked does not include internalState",
1281 0, 0
1282 },
1283 {
1284 FK_GLOBALS, FK_NONE, modeFlag,
1285 "internalglobsnoglobs",
1286 FLG_INTERNALGLOBSNOGLOBS,
1287 "use of internalState (in function with no globals list)",
1288 "A called function uses internal state, but the function being checked "
1289 "has no globals list",
1290 0, 0
1291 },
1292 {
1293 FK_GLOBALS, FK_MODIFIES, modeFlag,
1294 "warnmissingglobs",
1295 FLG_WARNMISSINGGLOBALS,
1296 "global variable used in modifies clause is not listed in globals list",
1297 "A global variable is used in the modifies clause, but it not listed in "
1298 "the globals list. The variable will be added to the globals list.",
1299 0, 0
885824d3 1300 },
1301
28bf4b0b 1302 {
1303 FK_GLOBALS, FK_MODIFIES, modeFlag,
1304 "warnmissingglobsnoglobs",
1305 FLG_WARNMISSINGGLOBALSNOGLOBS,
1306 "global variable used in modifies clause in a function with no globals list",
1307 "A global variable is used in the modifies clause, but the function "
1308 "has no globals list. The variable will be added to the globals list.",
1309 0, 0
1310 },
1311 {
1312 FK_GLOBALS, FK_UNSPEC, modeFlag,
1313 "globnoglobs",
1314 FLG_GLOBUNSPEC,
1315 "use of checked global in a function with no globals list or specification",
1316 "A specified global variable is used in the function, but not listed "
1317 "in its globals list. Without +globnoglobs, only globals "
1318 "declared with /*@checkedstrict@*/ will produce use "
1319 "errors in functions without globals "
1320 "lists. The /*@globals ... @*/ control comment can be used to give "
1321 "a globals list for an unspecified function.",
1322 0, 0
1323 },
1324 {
1325 FK_GLOBALS, FK_IMPLICIT, modeFlag,
1326 "allglobs",
1327 FLG_ALLGLOBALS,
1328 "report use and modification errors for globals not annotated with unchecked",
1329 NULL, 0, 0
1330 },
1331 {
1332 FK_GLOBALS, FK_UNSPEC, modeFlag,
1333 "checkstrictglobs",
1334 FLG_CHECKSTRICTGLOBALS,
1335 "report use and modification errors for checkedstrict globals",
1336 NULL, 0, 0
1337 },
1338 {
1339 FK_GLOBALS, FK_UNSPEC, modeFlag,
1340 "impcheckedspecglobs",
1341 FLG_IMPCHECKEDSPECGLOBALS,
1342 "assume checked qualifier for unqualified global declarations in .lcl files",
1343 NULL, 0, 0
1344 },
1345 {
1346 FK_GLOBALS, FK_UNSPEC, modeFlag,
1347 "impcheckmodspecglobs",
1348 FLG_IMPCHECKMODSPECGLOBALS,
1349 "assume checkmod qualifier for unqualified global declarations in .lcl files",
1350 NULL, 0, 0
1351 },
1352 {
1353 FK_GLOBALS, FK_UNSPEC, modeFlag,
1354 "impcheckedstrictspecglobs",
1355 FLG_IMPCHECKEDSTRICTSPECGLOBALS,
1356 "assume checkmod qualifier for unqualified global declarations in .lcl files",
1357 NULL, 0, 0
1358 },
1359 {
1360 FK_GLOBALS, FK_UNSPEC, modeFlag,
1361 "impcheckedglobs",
1362 FLG_IMPCHECKEDGLOBALS,
1363 "assume checked qualifier for unqualified global declarations",
1364 NULL, 0, 0
1365 },
1366 {
1367 FK_GLOBALS, FK_UNSPEC, modeFlag,
1368 "impcheckmodglobs",
1369 FLG_IMPCHECKMODGLOBALS,
1370 "assume checkmod qualifier for unqualified global declarations",
1371 NULL, 0, 0
1372 },
1373 {
1374 FK_GLOBALS, FK_UNSPEC, modeFlag,
1375 "impcheckedstrictglobs",
1376 FLG_IMPCHECKEDSTRICTGLOBALS,
1377 "assume checkedstrict qualifier for unqualified global declarations",
1378 NULL, 0, 0
1379 },
1380 {
1381 FK_GLOBALS, FK_UNSPEC, modeFlag,
1382 "impcheckedstatics",
1383 FLG_IMPCHECKEDSTATICS,
1384 "assume checked qualifier for unqualified file static declarations",
1385 NULL, 0, 0
1386 },
1387 {
1388 FK_GLOBALS, FK_UNSPEC, modeFlag,
1389 "impcheckmodstatics",
1390 FLG_IMPCHECKMODSTATICS,
1391 "assume checkmod qualifier for unqualified file static declarations",
1392 NULL, 0, 0
1393 },
1394 {
1395 FK_GLOBALS, FK_UNSPEC, modeFlag,
1396 "impcheckmodinternals",
1397 FLG_IMPCHECKMODINTERNALS,
1398 "assume checkmod qualifier for unqualified local "
1399 "static declarations (for internal state modifications)",
1400 NULL, 0, 0
1401 },
1402 {
1403 FK_GLOBALS, FK_UNSPEC, modeFlag,
1404 "impcheckedstrictstatics",
1405 FLG_IMPCHECKEDSTRICTSTATICS,
1406 "assume checkedstrict qualifier for unqualified file static declarations",
1407 NULL, 0, 0
1408 },
1409 {
1410 FK_GLOBALS, FK_MODIFIES, modeFlag,
1411 "modglobs",
1412 FLG_MODGLOBS,
1413 "undocumented modification of a checked global variable",
1414 "A checked global variable is modified by the function, but not listed in "
1415 "its modifies clause.",
1416 0, 0
1417 },
1418 {
1419 FK_GLOBALS, FK_MODIFIES, modeFlag,
1420 "modglobsnomods",
1421 FLG_MODGLOBSUNSPEC,
1422 "undocumented modification of a checked global variable in a function "
1423 "declared with no modifies clause",
1424 "A checked global variable is modified by the function, but not listed in "
1425 "its modifies clause.",
1426 0, 0
1427 },
1428 {
1429 FK_GLOBALS, FK_MODIFIES, modeFlag,
1430 "modstrictglobsnomods",
1431 FLG_MODSTRICTGLOBSUNSPEC,
1432 "undocumented modification of a strict checked global variable in a "
1433 "function declared with no modifies clause",
1434 "A checked global variable is modified by the function, but not listed in "
1435 "its modifies clause.",
1436 0, 0
1437 },
1438 {
1439 FK_GLOBALS, FK_MODIFIES, modeFlag,
1440 "modglobsunchecked",
1441 FLG_MODGLOBSUNCHECKED,
1442 "undocumented modification of an unchecked checked global variable",
1443 "An unchecked global variable is modified by the function, but not listed in "
1444 "its modifies clause.",
1445 0, 0
1446 },
bb7c2085 1447
1448 /*
1449 ** State Clauses
1450 */
1451
1452 /*
1453 ** 8. Control Flow
1454 */
1455
1456 /* 8.1 Execution */
1457
28bf4b0b 1458 {
bb7c2085 1459 FK_CONTROL, FK_NONE, modeFlag,
1460 "noret",
1461 FLG_NORETURN,
1462 "path with no return detected in non-void function",
1463 "There is a path through a function declared to return a value on "
1464 "which there is no return statement. This means the execution "
1465 "may fall through without returning a meaningful result to "
1466 "the caller.",
28bf4b0b 1467 0, 0
1468 },
1469 {
bb7c2085 1470 FK_CONTROL, FK_NONE, plainFlag,
1471 "emptyreturn",
1472 FLG_EMPTYRETURN,
1473 "empty return in function declared to return value",
1474 NULL,
28bf4b0b 1475 0, 0
1476 },
1477 {
bb7c2085 1478 FK_CONTROL, FK_NONE, plainFlag,
1479 "alwaysexits",
1480 FLG_ALWAYSEXITS,
1481 "loop predicate always exits",
1482 NULL,
28bf4b0b 1483 0, 0
1484 },
bb7c2085 1485
28bf4b0b 1486 {
bb7c2085 1487 FK_CONTROL, FK_MEMORY, specialFlag,
1488 "loopexec",
1489 FLG_LOOPEXEC,
1490 "assume all loops execute at least once (sets forloopexec, whileloopexec and iterloopexec)",
1491 NULL, 0, 0
28bf4b0b 1492 },
1493 {
bb7c2085 1494 FK_CONTROL, FK_MEMORY, plainFlag,
1495 "forloopexec",
1496 FLG_FORLOOPEXEC,
1497 "assume all for loops execute at least once",
1498 NULL, 0, 0
28bf4b0b 1499 },
1500 {
bb7c2085 1501 FK_CONTROL, FK_MEMORY, plainFlag,
1502 "whileloopexec",
1503 FLG_WHILELOOPEXEC,
1504 "assume all while loops execute at least once",
1505 NULL, 0, 0
28bf4b0b 1506 },
1507 {
bb7c2085 1508 FK_CONTROL, FK_MEMORY, plainFlag,
1509 "iterloopexec",
1510 FLG_ITERLOOPEXEC,
1511 "assume all iterator loops execute at least once",
1512 NULL, 0, 0
60868d40 1513 },
1514 {
bb7c2085 1515 FK_CONTROL, FK_MEMORY, plainFlag,
1516 "obviousloopexec",
1517 FLG_OBVIOUSLOOPEXEC,
1518 "assume loop that can be determined to always execute always does",
1519 NULL, 0, 0
28bf4b0b 1520 },
bb7c2085 1521
1522 /* 8.2 Undefined Behavior */
1523
28bf4b0b 1524 {
bb7c2085 1525 FK_BEHAVIOR, FK_ANSI, modeFlag,
1526 "evalorder",
1527 FLG_EVALORDER,
1528 "code has unspecified or implementation-dependent behavior "
1529 "because of order of evaluation",
1530 "Code has unspecified behavior. "
1531 "Order of evaluation of function parameters or subexpressions "
1532 "is not defined, so if a value is used and modified in different "
1533 "places not separated by a sequence point constraining "
1534 "evaluation order, then the result of the expression is "
1535 "unspecified.",
60868d40 1536 0, 0
28bf4b0b 1537 },
1538 {
bb7c2085 1539 FK_BEHAVIOR, FK_ANSI, modeFlag,
1540 "evalorderuncon",
1541 FLG_EVALORDERUNCON,
1542 "code involving call to unspecified function has undefined or implementation-dependent behavior",
1543 "Code involving a call to function with no modifies or globals clause "
1544 "may have undefined or implementation-dependent behavior (Splint assumes the "
1545 "unconstrained call may modify any reachable state or use any global). Add a "
1546 "specification for the function.",
ccf0a4a8 1547 0, 0
28bf4b0b 1548 },
bb7c2085 1549
1550 /* 8.3 Problematic Control Structures */
1551
1552 /* 8.3.1 Infinite Loops */
1553
28bf4b0b 1554 {
bb7c2085 1555 FK_CONTROL, FK_NONE, modeFlag,
1556 "infloops",
1557 FLG_INFLOOPS,
1558 "likely infinite loop is detected",
1559 "This appears to be an infinite loop. Nothing in the body of the "
1560 "loop or the loop test modifies the value of the loop test. "
1561 "Perhaps the specification of a function called in the loop "
1562 "body is missing a modification.",
60868d40 1563 0, 0
28bf4b0b 1564 },
1565 {
bb7c2085 1566 FK_CONTROL, FK_NONE, modeFlag,
1567 "infloopsuncon",
1568 FLG_INFLOOPSUNCON,
1569 "likely infinite loop is detected (may result from unconstrained function)",
1570 "This appears to be an infinite loop. Nothing in the body of the "
1571 "loop or the loop test modifies the value of the loop test. "
1572 "There may be a modification through a call to an unconstrained "
1573 "function, or an unconstrained function in the loop test may use "
1574 "a global variable modified by the loop body.",
60868d40 1575 0, 0
28bf4b0b 1576 },
bb7c2085 1577
1578 /* 8.3.2 Switches */
1579
28bf4b0b 1580 {
bb7c2085 1581 FK_CONTROL, FK_NONE, modeFlag,
1582 "casebreak",
1583 FLG_CASEBREAK,
1584 "non-empty case in a switch without preceding break",
1585 "Execution falls through from the previous case.", 0, 0
28bf4b0b 1586 },
1587 {
bb7c2085 1588 FK_CONTROL, FK_NONE, modeFlag,
1589 "misscase",
1590 FLG_MISSCASE,
1591 "switch on enum type missing case for some value",
1592 "Not all values in an enumeration are present as cases in the switch.",
28bf4b0b 1593 0, 0
1594 },
1595 {
bb7c2085 1596 FK_CONTROL, FK_NONE, modeFlag,
1597 "firstcase",
1598 FLG_FIRSTCASE,
1599 "first statement in switch is not a case",
1600 "The first statement after a switch is not a case.",
28bf4b0b 1601 0, 0
1602 },
1603 {
bb7c2085 1604 FK_CONTROL, FK_NONE, plainFlag,
1605 "duplicatecases",
1606 FLG_DUPLICATECASES,
1607 "duplicate cases in switch",
1608 "Duplicate cases in switch.",
28bf4b0b 1609 0, 0
1610 },
bb7c2085 1611
1612 /* 8.3.3 Deep Breaks */
1613
28bf4b0b 1614 {
bb7c2085 1615 FK_CONTROL, FK_NONE, specialFlag,
1616 "deepbreak",
1617 FLG_DEEPBREAK,
1618 "break inside nested while or for or switch",
1619 "A break statement appears inside the body of a nested while, for or "
1620 "switch statement. Sets looploopbreak, loopswitchbreak, "
1621 "switchloopbreak, switchswitchbreak, and looploopcontinue.",
28bf4b0b 1622 0, 0
1623 },
1624 {
bb7c2085 1625 FK_CONTROL, FK_NONE, modeFlag,
1626 "looploopbreak",
1627 FLG_LOOPLOOPBREAK,
1628 "break inside nested while or for",
1629 "A break statement appears inside the body of a nested while or for "
1630 "statement. This is perfectly reasonable code, but check that "
1631 "the break is intended to break only the inner loop. The "
1632 "break statement may be preceded by /*@innerbreak@*/ to suppress "
1633 "the message for this break only.",
60868d40 1634 0, 0
28bf4b0b 1635 },
1636 {
bb7c2085 1637 FK_CONTROL, FK_NONE, modeFlag,
1638 "switchloopbreak",
1639 FLG_SWITCHLOOPBREAK,
1640 "break in loop inside switch",
1641 "A break statement appears inside the body of a while or for "
1642 "statement within a switch. This is perfectly reasonable code, but check that "
1643 "the break is intended to break only the inner loop. The "
1644 "break statement may be preceded by /*@loopbreak@*/ to suppress "
1645 "the message for this break only.",
1646 0, 0
28bf4b0b 1647 },
1648 {
bb7c2085 1649 FK_CONTROL, FK_NONE, modeFlag,
1650 "loopswitchbreak",
1651 FLG_LOOPSWITCHBREAK,
1652 "break in switch inside loop",
1653 "A break statement appears inside a switch statement within a while or "
1654 "for loop. This is perfectly reasonable code, but check that "
1655 "the break is intended to break only the inner loop. The "
1656 "break statement may be preceded by /*@switchbreak@*/ to suppress "
1657 "the message for this break only.",
60868d40 1658 0, 0
28bf4b0b 1659 },
1660 {
bb7c2085 1661 FK_CONTROL, FK_NONE, modeFlag,
1662 "switchswitchbreak",
1663 FLG_SWITCHSWITCHBREAK,
1664 "break in switch inside switch",
1665 "A break statement appears inside a switch statement within another "
1666 "switch statement. This is perfectly reasonable code, but check that "
1667 "the break is intended to break only the inner switch. The "
1668 "break statement may be preceded by /*@innerbreak@*/ to suppress "
1669 "the message for this break only.",
28bf4b0b 1670 0, 0
1671 },
1672 {
bb7c2085 1673 FK_CONTROL, FK_NONE, modeFlag,
1674 "looploopcontinue",
1675 FLG_LOOPLOOPCONTINUE,
1676 "continue inside nested loop",
1677 "A continue statement appears inside a loop within a loop. "
1678 "This is perfectly reasonable code, but check that "
1679 "the continue is intended to continue only the inner loop. The "
1680 "continue statement may be preceded by /*@innercontinue@*/ to suppress "
1681 "the message for this continue only.",
28bf4b0b 1682 0, 0
1683 },
bb7c2085 1684
1685 /* 8.3.4 Loop and If Bodies */
1686
28bf4b0b 1687 {
bb7c2085 1688 FK_CONTROL, FK_NONE, modeFlag,
1689 "whileempty",
1690 FLG_WHILEEMPTY,
1691 "a while statement has no body",
1692 "While statement has no body.",
28bf4b0b 1693 0, 0
1694 },
1695 {
bb7c2085 1696 FK_CONTROL, FK_NONE, modeFlag,
1697 "whileblock",
1698 FLG_WHILEBLOCK,
1699 "the body of a while statement is not a block",
1700 "While body is a single statement, not a compound block.",
28bf4b0b 1701 0, 0
1702 },
1703 {
bb7c2085 1704 FK_CONTROL, FK_NONE, modeFlag,
1705 "forempty",
1706 FLG_FOREMPTY,
1707 "a for statement has no body",
1708 "For statement has no body.",
1709 0, 0
28bf4b0b 1710 },
1711 {
bb7c2085 1712 FK_CONTROL, FK_NONE, modeFlag,
1713 "forblock",
1714 FLG_FORBLOCK,
1715 "the body of a for statement is not a block",
1716 "Loop body is a single statement, not a compound block.",
1717 0, 0
28bf4b0b 1718 },
1719 {
bb7c2085 1720 FK_CONTROL, FK_NONE, modeFlag,
1721 "ifempty",
1722 FLG_IFEMPTY,
1723 "an if statement has no body",
1724 "If statement has no body.",
1725 0, 0
28bf4b0b 1726 },
1727 {
bb7c2085 1728 FK_CONTROL, FK_NONE, modeFlag,
1729 "ifblock",
1730 FLG_IFBLOCK,
1731 "the body of an if statement is not a block",
1732 "If body is a single statement, not a compound block.",
28bf4b0b 1733 0, 0
1734 },
1735 {
bb7c2085 1736 FK_CONTROL, FK_NONE, specialFlag,
1737 "allempty",
1738 FLG_ALLEMPTY,
1739 "an if, while or for statement has no body (sets ifempty, "
1740 "whileempty and forempty",
1741 NULL,
28bf4b0b 1742 0, 0
1743 },
1744 {
bb7c2085 1745 FK_CONTROL, FK_NONE, specialFlag,
1746 "allblock",
1747 FLG_ALLBLOCK,
1748 "the body of an if, while or for statement is not a block "
1749 "(sets ifblock, whileblock and forblock)",
1750 "Body is a single statement, not a compound block.",
28bf4b0b 1751 0, 0
1752 },
bb7c2085 1753
1754 /* 8.3.5 Complete Logic */
1755
28bf4b0b 1756 {
bb7c2085 1757 FK_CONTROL, FK_NONE, modeFlag,
1758 "elseifcomplete",
1759 FLG_ELSEIFCOMPLETE,
1760 "if ... else if chains must have final else",
1761 "There is no final else following an else if construct.",
28bf4b0b 1762 0, 0
1763 },
bb7c2085 1764
1765 /* 8.4 Suspicious Statements */
1766
28bf4b0b 1767 {
bb7c2085 1768 FK_CONTROL, FK_NONE, modeFlag,
1769 "unreachable",
1770 FLG_UNREACHABLE,
1771 "unreachable code detected",
1772 "This code will never be reached on any possible execution.",
28bf4b0b 1773 0, 0
1774 },
bb7c2085 1775
1776 /* 8.4.1 Statements with No Effects */
1777
28bf4b0b 1778 {
bb7c2085 1779 FK_EFFECT, FK_CONTROL, modeFlag,
1780 "noeffect",
1781 FLG_NOEFFECT,
1782 "statement with no effect",
1783 "Statement has no visible effect --- no values are modified.",
28bf4b0b 1784 0, 0
1785 },
1786 {
bb7c2085 1787 FK_EFFECT, FK_CONTROL, modeFlag,
1788 "noeffectuncon",
1789 FLG_NOEFFECTUNCON,
1790 "statement with no effect (except possibly through call to "
1791 "unconstrained function)",
1792 "Statement has no visible effect --- no values are modified. It may "
1793 "modify something through a call to an unconstrained function.",
1794 0, 0
28bf4b0b 1795 },
bb7c2085 1796
1797 /* 8.4.2 Ignored Return Values */
1798
28bf4b0b 1799 {
bb7c2085 1800 FK_IGNORERET, FK_NONE, specialFlag,
1801 "retval",
1802 FLG_RETVAL,
1803 "return value ignored (sets retvalint, retvalbool and retvalother)",
1804 "Result returned by function call is not used. If this is intended, "
1805 "cast result to (void) to eliminate message.",
1806 0, 0
28bf4b0b 1807 },
1808 {
bb7c2085 1809 FK_IGNORERET, FK_BOOL, modeFlag,
1810 "retvalother",
1811 FLG_RETVALOTHER,
1812 "return value of type other than bool or int ignored",
1813 "Result returned by function call is not used. If this is intended, "
1814 "can cast result to (void) to eliminate message.",
28bf4b0b 1815 0, 0
1816 },
1817 {
bb7c2085 1818 FK_IGNORERET, FK_BOOL, modeFlag,
1819 "retvalbool",
1820 FLG_RETVALBOOL,
1821 "return value of manifest type bool ignored",
1822 "Result returned by function call is not used. If this is intended, "
1823 "can cast result to (void) to eliminate message.",
1824 0, 0
28bf4b0b 1825 },
1826 {
bb7c2085 1827 FK_IGNORERET, FK_NONE, modeFlag,
1828 "retvalint",
1829 FLG_RETVALINT,
1830 "return value of type int ignored",
1831 "Result returned by function call is not used. If this is intended, "
1832 "can cast result to (void) to eliminate message.",
1833 0, 0
28bf4b0b 1834 },
bb7c2085 1835
1836 /*
1837 ** 9. Buffer Sizes
1838 */
1839
28bf4b0b 1840 {
bb7c2085 1841 FK_BOUNDS, FK_MEMORY, modeFlag,
1842 "nullterminated",
1843 FLG_NULLTERMINATED,
1844 "misuse of nullterminated allocation",
1845 "A possibly non-nullterminated string/memory is used/referenced as a nullterminated one.",
1846 0, 0
28bf4b0b 1847 },
bb7c2085 1848
28bf4b0b 1849 {
bb7c2085 1850 FK_BOUNDS, FK_MEMORY, specialFlag,
1851 "bounds",
1852 FLG_BOUNDS,
1853 "memory bounds checking (sets boundsread and boundswrite)",
1854 "Memory read or write may be out of bounds of allocated storage.", 0, 0
28bf4b0b 1855 },
1856 {
9276a168 1857 FK_BOUNDS, FK_MEMORY, plainFlag,
bb7c2085 1858 "boundsread",
1859 FLG_BOUNDSREAD,
1860 "possible out of bounds read",
1861 "A memory read references memory beyond the allocated storage.",
1862 0, 0
885824d3 1863 },
28bf4b0b 1864 {
9276a168 1865 FK_BOUNDS, FK_MEMORY, plainFlag,
bb7c2085 1866 "boundswrite",
1867 FLG_BOUNDSWRITE,
1868 "possible buffer overflow from an out of bounds write",
1869 "A memory write may write to an address beyond the allocated buffer.",
28bf4b0b 1870 0, 0
1871 },
bb7c2085 1872
28bf4b0b 1873 {
9276a168 1874 FK_BOUNDS, FK_DISPLAY, plainFlag,
bb7c2085 1875 "fcnpost",
1876 FLG_FUNCTIONPOST,
1877 "display function post conditions",
1878 "Display function post conditions.",
28bf4b0b 1879 0, 0
1880 },
4a689c7f 1881 {
9276a168 1882 FK_BOUNDS, FK_DISPLAY, plainFlag,
4a689c7f 1883 "redundantconstraints",
1884 FLG_REDUNDANTCONSTRAINTS,
1885 "display seemingly redundant constraints",
1886 "Display seemingly redundant constraints",
1887 0, 0
1888 },
bb7c2085 1889 /*drl7x added 6/18/01 */
28bf4b0b 1890 {
bb7c2085 1891 FK_BOUNDS, FK_MEMORY, modeFlag,
1892 "checkpost",
1893 FLG_CHECKPOST,
1894 "unable to verify predicate in ensures clause",
1895 "The function implementation may not satisfy a post condition given in an ensures clause.",
28bf4b0b 1896 0, 0
1897 },
bb7c2085 1898
28bf4b0b 1899 {
9276a168 1900 FK_BOUNDS, FK_MEMORY, plainFlag,
bb7c2085 1901 "implictconstraint",
1902 FLG_IMPLICTCONSTRAINT,
1903 "generate implicit constraints for functions",
1904 NULL,
28bf4b0b 1905 0, 0
1906 },
bb7c2085 1907 /*drl7x added 4/29/01 */
28bf4b0b 1908 {
9276a168 1909 FK_BOUNDS, FK_MEMORY, plainFlag,
bb7c2085 1910 "orconstraint",
1911 FLG_ORCONSTRAINT,
1912 "use limited OR expressions to resolve constraints",
1913 NULL,
28bf4b0b 1914 0, 0
1915 },
bb7c2085 1916
28bf4b0b 1917 {
9276a168 1918 FK_BOUNDS, FK_MEMORY, plainFlag,
bb7c2085 1919 "nullterminated",
1920 FLG_NULLTERMINATEDWARNING,
1921 "misuse of nullterminated allocation",
1922 "A user annotated non-nullterminated buffer is used/referenced as a nullterminated one.",
28bf4b0b 1923 0, 0
1924 },
bb7c2085 1925
28bf4b0b 1926 {
9276a168 1927 FK_BOUNDS, FK_DISPLAY, plainFlag,
bb7c2085 1928 "showconstraintparens",
1929 FLG_PARENCONSTRAINT,
1930 "display parentheses around constraint terms",
1931 NULL,
28bf4b0b 1932 0, 0
bb7c2085 1933 },
9276a168 1934 /*drl added 2/4/2002*/
1935 {
1936 FK_BOUNDS, FK_DISPLAY, plainFlag,
1937 "boundscompacterrormessages",
1938 FLG_BOUNDSCOMPACTERRORMESSAGES,
1939 "Display fewer new lines in bounds checking error messages",
1940 NULL,
1941 0, 0
1942 },
28bf4b0b 1943 {
9276a168 1944 FK_BOUNDS, FK_DISPLAY, plainFlag,
bb7c2085 1945 "showconstraintlocation",
1946 FLG_CONSTRAINTLOCATION,
1947 "display location for every constraint generated",
1948 NULL,
28bf4b0b 1949 0, 0
bb7c2085 1950 }, /*drl added flag 4/26/01*/
1951
1952 /*
1953 ** 10. Extensible Checking
1954 */
1955
28bf4b0b 1956 {
bb7c2085 1957 FK_EXTENSIBLE, FK_FILES, globalStringFlag, ARG_FILE,
1958 "mts",
1959 FLG_MTSFILE,
1960 "load meta state declaration and corresponding xh file",
1961 NULL, 0, 0
28bf4b0b 1962 },
1963 {
bb7c2085 1964 FK_EXTENSIBLE, FK_MEMORY, modeFlag,
1965 "statetransfer",
1966 FLG_STATETRANSFER,
1967 "storage has been transfered with invalid state",
1968 "Transfer violates user-defined state rules.",
28bf4b0b 1969 0, 0
1970 },
1971 {
bb7c2085 1972 FK_EXTENSIBLE, FK_MEMORY, modeFlag,
1973 "statemerge",
1974 FLG_STATEMERGE,
1975 "control paths merge with storage in incompatible states",
1976 "Control path merge violates user-defined state merge rules.",
28bf4b0b 1977 0, 0
1978 },
bb7c2085 1979
1980 /*
1981 ** 11. Macros
1982 */
1983
28bf4b0b 1984 {
1985 FK_MACROS, FK_NONE, modeFlag,
1986 "macroredef",
1987 FLG_MACROREDEF,
1988 "macro redefined",
1989 "A macro is defined in more than one place.", 0, 0
1990 },
1991 {
1992 FK_MACROS, FK_UNRECOG, modeFlag,
1993 "macrounrecog",
1994 FLG_MACROUNDEF,
1995 "unrecognized identifier in macro",
1996 "An unrecognized identifier appears in a macro. If the identifier "
1997 "is defined before the macro is used, then this is okay.",
1998 0, 0
1999 },
bb7c2085 2000
2001 /* 11.1 Constant Macros */
2002
28bf4b0b 2003 {
bb7c2085 2004 FK_MACROS, FK_PROTOS, modeFlag,
2005 "macroconstdecl",
2006 FLG_MACROCONSTDECL,
2007 "non-parameterized macro without prototype or specification",
2008 "Macro constant has no declaration. Use /*@constant ...@*/ to "
2009 "declare the macro.",
28bf4b0b 2010 0, 0
2011 },
bb7c2085 2012
2013 /* 11.2 Function-like Macros */
2014
28bf4b0b 2015 {
bb7c2085 2016 FK_MACROS, FK_NONE, modeFlag,
2017 "macrostmt",
2018 FLG_MACROSTMT,
2019 "macro definition is syntactically not equivalent to function",
2020 "A macro is defined in a way that may cause syntactic problems. "
2021 "If the macro returns a value, use commas to separate expressions; "
2022 "otherwise, use do { <macro body> } while (FALSE) construct.",
28bf4b0b 2023 0, 0
2024 },
2025 {
bb7c2085 2026 FK_MACROS, FK_NONE, modeFlag,
2027 "macroempty",
2028 FLG_MACROEMPTY,
2029 "macro definition for is empty",
2030 "A macro definition has no body.",
28bf4b0b 2031 0, 0
2032 },
2033 {
bb7c2085 2034 FK_MACROS, FK_PARAMS, modeFlag,
2035 "macroparams",
2036 FLG_MACROPARAMS,
2037 "macro parameter not used exactly once",
2038 "A macro parameter is not used exactly once in all possible "
2039 "invocations of the macro. To behave like a function, "
2040 "each macro parameter must be used exactly once on all "
2041 "invocations of the macro so that parameters with "
2042 "side-effects are evaluated exactly once. Use /*@sef@*/ to "
2043 "denote parameters that must be side-effect free.",
28bf4b0b 2044 0, 0
2045 },
2046 {
bb7c2085 2047 FK_MACROS, FK_CONTROL, modeFlag,
2048 "macroreturn",
2049 FLG_MACRORETURN,
2050 "return statement in macro body",
2051 "The body of a macro declared as a function uses a return statement. "
2052 "This exhibits behavior that "
2053 "could not be implemented by a function.",
28bf4b0b 2054 0, 0
2055 },
2056 {
bb7c2085 2057 FK_MACROS, FK_PARAMS, modeFlag,
2058 "macroassign",
2059 FLG_MACROASSIGN,
2060 "assignment to a macro parameter",
2061 "A macro parameter is used as the left side of an "
2062 "assignment expression. This exhibits behavior that "
2063 "could not be implemented by a function.",
28bf4b0b 2064 0, 0
2065 },
2066 {
bb7c2085 2067 FK_MACROS, FK_NONE, modeFlag,
2068 "macroparens",
2069 FLG_MACROPARENS,
2070 "macro parameter used without parentheses (in potentially dangerous context)",
2071 "A macro parameter is used without parentheses. This could be "
2072 "dangerous if the macro is invoked with a complex expression "
2073 "and precedence rules will change the evaluation inside the macro.",
28bf4b0b 2074 0, 0
2075 },
2076 {
bb7c2085 2077 FK_MACROS, FK_PROTOS, modeFlag,
2078 "macrodecl",
2079 FLG_MACRODECL,
2080 "macro without prototype or specification (sets macrofcndecl and macroconstdecl)",
2081 "Argument checking cannot be done well for macros without prototypes "
2082 "or specifications, since the types of the arguments are unknown.",
2083 0, 0
28bf4b0b 2084 },
2085 {
bb7c2085 2086 FK_MACROS, FK_PROTOS, modeFlag,
2087 "macrofcndecl",
2088 FLG_MACROFCNDECL,
2089 "parameterized macro without prototype or specification",
2090 "Function macro has no declaration.",
2091 0, 0
28bf4b0b 2092 },
bb7c2085 2093
2094 /* 11.2.1 Side Effect Free Parameters */
2095
28bf4b0b 2096 {
bb7c2085 2097 FK_MACROS, FK_PARAMS, modeFlag,
2098 "sefparams",
2099 FLG_SEFPARAMS,
2100 "a parameter with side-effects is passed as a sef parameter",
2101 "An actual parameter corresponding to a sef parameter may have a side-effect.",
2102 0, 0
2103 },
28bf4b0b 2104 {
bb7c2085 2105 FK_MACROS, FK_PARAMS, modeFlag,
2106 "sefuncon",
2107 FLG_SEFUNSPEC,
2108 "a parameter with unconstrained side-effects is passed as a sef parameter",
2109 "An actual parameter corresponding to a sef parameter involves a call "
2110 "to a procedure with no modifies clause that may have a side-effect.",
2111 0, 0
28bf4b0b 2112 },
bb7c2085 2113
2114 /* 11.3 Controlling Macro Checking */
2115
28bf4b0b 2116 {
bb7c2085 2117 FK_MACROS, FK_NONE, plainFlag,
2118 "constmacros",
2119 FLG_CONSTMACROS,
2120 "check all macros without parameter lists as constants",
2121 "Every non-parameterized macro (not preceded by /*@notfunction@*/) "
2122 "is checked as a constant.",
2123 0, 0
28bf4b0b 2124 },
2125 {
bb7c2085 2126 FK_MACROS, FK_NONE, plainFlag,
2127 "fcnmacros",
2128 FLG_FCNMACROS,
2129 "check all macros with parameter lists as functions",
2130 "Every parameterized macro (not preceded by /*@notfunction@*/) "
2131 "is checked as a function.",
2132 0, 0
28bf4b0b 2133 },
2134 {
bb7c2085 2135 FK_MACROS, FK_NONE, plainSpecialFlag,
2136 "allmacros",
2137 FLG_ALLMACROS,
2138 "sets fcnmacros and constmacros",
2139 "All macros (not preceded by /*@notfunction@*/) are checked as functions or "
2140 "constants depending on whether or not they have parameter lists.",
2141 0, 0
28bf4b0b 2142 },
2143 {
bb7c2085 2144 FK_MACROS, FK_NONE, plainFlag,
2145 "libmacros",
2146 FLG_LIBMACROS,
2147 "check all macros with declarations in library as functions",
2148 "Every macro declared in the load library is checked.",
2149 0, 0
28bf4b0b 2150 },
2151 {
bb7c2085 2152 FK_MACROS, FK_NONE, plainFlag,
2153 "specmacros",
2154 FLG_SPECMACROS,
2155 "check all macros corresponding to specified functions or constants",
2156 "Every macro declared a specification file is checked.",
2157 0, 0
28bf4b0b 2158 },
2159 {
bb7c2085 2160 FK_MACROS, FK_NONE, modeFlag,
2161 "macromatchname",
2162 FLG_MACROMATCHNAME,
2163 "macro definition does not match iter or constant declaration",
2164 "A iter or constant macro is defined using a different name from the "
2165 "one used in the previous syntactic comment",
28bf4b0b 2166 0, 0
2167 },
2168 {
bb7c2085 2169 FK_MACROS, FK_NONE, plainFlag,
2170 "nextlinemacros",
2171 FLG_MACRONEXTLINE,
2172 "the line after a constant or iter declaration must be a macro definition",
2173 "A constant or iter declaration is not immediately followed by a macro definition.",
28bf4b0b 2174 0, 0
2175 },
bb7c2085 2176
2177 /* 11.4 Iterators */
2178
28bf4b0b 2179 {
bb7c2085 2180 FK_ITER, FK_NONE, plainFlag,
2181 "iterbalance",
2182 FLG_ITERBALANCE,
2183 "iter is not balanced with end_<iter>",
28bf4b0b 2184 NULL,
2e127cb8 2185 0, 0
2186 },
2187 {
bb7c2085 2188 FK_ITER, FK_NONE, plainFlag,
2189 "iteryield",
2190 FLG_ITERYIELD,
2191 "iter yield parameter is inappropriate",
2192 NULL,
28bf4b0b 2193 0, 0
2194 },
2e127cb8 2195 {
bb7c2085 2196 FK_ITER, FK_NONE, plainFlag,
2197 "hasyield",
2198 FLG_HASYIELD,
2199 "iter declaration has no yield parameters",
2200 "An iterator has been declared with no parameters annotated with "
2201 "yield. This may be what you want, if the iterator is meant "
2202 "to do something a fixed number of times, but returns no "
2203 "information to the calling context. Probably, a parameter "
2204 "is missing the yield annotation to indicate that it is "
2205 "assigned a value in the calling context.",
2e127cb8 2206 0, 0
2207 },
bb7c2085 2208
2209 /*
2210 ** 12. Naming Conventions
2211 */
2212
28bf4b0b 2213 {
bb7c2085 2214 FK_NAMES, FK_ABSTRACT, plainFlag,
2215 "namechecks",
2216 FLG_NAMECHECKS,
2217 "controls name checking without changing other settings",
2218 NULL, 0, 0
28bf4b0b 2219 },
bb7c2085 2220
2221 /* 12.1.1 Czech Names */
2222
28bf4b0b 2223 {
bb7c2085 2224 FK_NAMES, FK_ABSTRACT, specialFlag,
2225 "czech",
2226 FLG_CZECH,
2227 "czech naming convention (sets accessczech, czechfunctions, czechvars, "
2228 "czechconstants, czechenums, and czechmacros)",
2229 "Name is not consistent with Czech naming convention.", 0, 0
28bf4b0b 2230 },
2231 {
bb7c2085 2232 FK_NAMES, FK_ABSTRACT, plainFlag,
2233 "czechfcns",
2234 FLG_CZECHFUNCTIONS,
2235 "czech naming convention violated in a function or iterator declaration",
2236 "Function or iterator name is not consistent with Czech naming convention.", 0, 0
28bf4b0b 2237 },
2238 {
bb7c2085 2239 FK_NAMES, FK_ABSTRACT, plainFlag,
2240 "czechvars",
2241 FLG_CZECHVARS,
2242 "czech naming convention violated in a variable declaration",
2243 "Variable name is not consistent with Czech naming convention.", 0, 0
28bf4b0b 2244 },
2245 {
bb7c2085 2246 FK_NAMES, FK_ABSTRACT, plainFlag,
2247 "czechmacros",
2248 FLG_CZECHMACROS,
2249 "czech naming convention violated in an expanded macro name",
2250 "Expanded macro name is not consistent with Czech naming convention.", 0, 0
28bf4b0b 2251 },
2252 {
bb7c2085 2253 FK_NAMES, FK_ABSTRACT, plainFlag,
2254 "czechconsts",
2255 FLG_CZECHCONSTANTS,
2256 "czech naming convention violated in a constant declaration",
2257 "Constant name is not consistent with Czech naming convention.", 0, 0
28bf4b0b 2258 },
2259 {
bb7c2085 2260 FK_NAMES, FK_ABSTRACT, plainFlag,
2261 "czechtypes",
2262 FLG_CZECHTYPES,
2263 "czech naming convention violated in a user-defined type definition",
2264 "Type name is not consistent with Czech naming convention. Czech type "
2265 "names must not use the underscore character.", 0, 0
28bf4b0b 2266 },
bb7c2085 2267
2268 /* 12.1.2 Slovak Names */
2269
28bf4b0b 2270 {
bb7c2085 2271 FK_NAMES, FK_ABSTRACT, specialFlag,
2272 "slovak",
2273 FLG_SLOVAK,
2274 "slovak naming convention violated",
2275 "Name is not consistent with Slovak naming convention.", 0, 0
28bf4b0b 2276 },
2277 {
bb7c2085 2278 FK_NAMES, FK_ABSTRACT, plainFlag,
2279 "slovakfcns",
2280 FLG_SLOVAKFUNCTIONS,
2281 "slovak naming convention violated in a function or iterator declaration",
2282 "Function or iterator name is not consistent with Slovak naming convention.", 0, 0
28bf4b0b 2283 },
2284 {
bb7c2085 2285 FK_NAMES, FK_ABSTRACT, plainFlag,
2286 "slovakmacros",
2287 FLG_SLOVAKMACROS,
2288 "slovak naming convention violated in an expanded macro name",
2289 "Expanded macro name is not consistent with Slovak naming convention.", 0, 0
28bf4b0b 2290 },
2291 {
bb7c2085 2292 FK_NAMES, FK_ABSTRACT, plainFlag,
2293 "slovakvars",
2294 FLG_SLOVAKVARS,
2295 "slovak naming convention violated in a variable declaration",
2296 "Variable name is not consistent with Slovak naming convention.", 0, 0
28bf4b0b 2297 },
2298 {
bb7c2085 2299 FK_NAMES, FK_ABSTRACT, plainFlag,
2300 "slovakconsts",
2301 FLG_SLOVAKCONSTANTS,
2302 "slovak naming convention violated in a constant declaration",
2303 "Constant name is not consistent with Slovak naming convention.", 0, 0
28bf4b0b 2304 },
2305 {
bb7c2085 2306 FK_NAMES, FK_ABSTRACT, plainFlag,
2307 "slovaktypes",
2308 FLG_SLOVAKTYPES,
2309 "slovak naming convention violated in a use-defined type definition",
2310 "Type name is not consistent with Slovak naming convention. Slovak type "
2311 "names may not include uppercase letters.", 0, 0
28bf4b0b 2312 },
bb7c2085 2313
2314 /* 12.1.3 Czechoslovak Names */
28bf4b0b 2315 {
bb7c2085 2316 FK_NAMES, FK_ABSTRACT, specialFlag,
2317 "czechoslovak",
2318 FLG_CZECHOSLOVAK,
2319 "czech or slovak naming convention violated",
2320 "Name is not consistent with either Czech or Slovak naming convention.", 0, 0
28bf4b0b 2321 },
2322 {
bb7c2085 2323 FK_NAMES, FK_ABSTRACT, plainFlag,
2324 "czechoslovakfcns",
2325 FLG_CZECHOSLOVAKFUNCTIONS,
2326 "czechoslovak naming convention violated in a function or iterator declaration",
2327 "Function name is not consistent with Czechoslovak naming convention.", 0, 0
28bf4b0b 2328 },
2329 {
bb7c2085 2330 FK_NAMES, FK_ABSTRACT, plainFlag,
2331 "czechoslovakmacros",
2332 FLG_CZECHOSLOVAKMACROS,
2333 "czechoslovak naming convention violated in an expanded macro name",
2334 "Expanded macro name is not consistent with Czechoslovak naming convention.", 0, 0
28bf4b0b 2335 },
2336 {
bb7c2085 2337 FK_NAMES, FK_ABSTRACT, plainFlag,
2338 "czechoslovakvars",
2339 FLG_CZECHOSLOVAKVARS,
2340 "czechoslovak naming convention violated in a variable declaration",
2341 "Variable name is not consistent with Czechoslovak naming convention.", 0, 0
28bf4b0b 2342 },
2343 {
bb7c2085 2344 FK_NAMES, FK_ABSTRACT, plainFlag,
2345 "czechoslovakconsts",
2346 FLG_CZECHOSLOVAKCONSTANTS,
2347 "czechoslovak naming convention violated in a constant declaration",
2348 "Constant name is not consistent with Czechoslovak naming convention.", 0, 0
28bf4b0b 2349 },
2350 {
bb7c2085 2351 FK_NAMES, FK_ABSTRACT, plainFlag,
2352 "czechoslovaktypes",
2353 FLG_CZECHOSLOVAKTYPES,
2354 "czechoslovak naming convention violated in a user-defined type definition",
2355 "Type name is not consistent with Czechoslovak naming convention. Czechoslovak "
2356 "type names may not include uppercase letters or the underscore character.", 0, 0
28bf4b0b 2357 },
bb7c2085 2358
2359 /* 12.2 Namespace Prefixes */
2360
28bf4b0b 2361 {
bb7c2085 2362 FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING,
2363 "macrovarprefix",
2364 FLG_MACROVARPREFIX,
2365 "set namespace prefix for variables declared in a macro body",
2366 "A variable declared in a macro body does not start with the macrovarprefix.",
28bf4b0b 2367 0, 0
bb7c2085 2368 } ,
28bf4b0b 2369 {
bb7c2085 2370 FK_NAMES, FK_PREFIX, plainFlag,
2371 "macrovarprefixexclude",
2372 FLG_MACROVARPREFIXEXCLUDE,
2373 "the macrovarprefix may not be used for non-macro variables",
2374 "A variable declared outside a macro body starts with the macrovarprefix.",
2375 0, 0
2376 } ,
28bf4b0b 2377 {
bb7c2085 2378 FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING,
2379 "tagprefix",
2380 FLG_TAGPREFIX,
2381 "set namespace prefix for struct, union and enum tags",
2382 "A tag identifier does not start with the tagprefix.",
28bf4b0b 2383 0, 0
bb7c2085 2384 } ,
28bf4b0b 2385 {
bb7c2085 2386 FK_NAMES, FK_PREFIX, plainFlag,
2387 "tagprefixexclude",
2388 FLG_TAGPREFIXEXCLUDE,
2389 "the tagprefix may not be used for non-tag identifiers",
2390 "An identifier that is not a tag starts with the tagprefix.",
2391 0, 0
2392 } ,
28bf4b0b 2393 {
bb7c2085 2394 FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING,
2395 "enumprefix",
2396 FLG_ENUMPREFIX,
2397 "set namespace prefix for enum members",
2398 "An enum member does not start with the enumprefix.",
28bf4b0b 2399 0, 0
bb7c2085 2400 } ,
28bf4b0b 2401 {
bb7c2085 2402 FK_NAMES, FK_PREFIX, plainFlag,
2403 "enumprefixexclude",
2404 FLG_ENUMPREFIXEXCLUDE,
2405 "the enumprefix may not be used for non-enum member identifiers",
2406 "An identifier that is not an enum member starts with the enumprefix.",
2407 0, 0
2408 } ,
28bf4b0b 2409 {
bb7c2085 2410 FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING,
2411 "filestaticprefix",
2412 FLG_FILESTATICPREFIX,
2413 "set namespace prefix for file static declarations",
2414 "A file-static identifier does not start with the filestaticprefix.",
28bf4b0b 2415 0, 0
bb7c2085 2416 } ,
28bf4b0b 2417 {
bb7c2085 2418 FK_NAMES, FK_PREFIX, plainFlag,
2419 "filestaticprefixexclude",
2420 FLG_FILESTATICPREFIXEXCLUDE,
2421 "the filestaticprefix may not be used for identifiers that are not file static",
2422 "An identifier that is not file static starts with the filestaticprefix.",
2423 0, 0
2424 } ,
28bf4b0b 2425 {
bb7c2085 2426 FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING,
2427 "globalprefix",
2428 FLG_GLOBPREFIX,
2429 "set namespace prefix for global variables",
2430 "A global variable does not start with the globalprefix",
28bf4b0b 2431 0, 0
bb7c2085 2432 } ,
28bf4b0b 2433 {
bb7c2085 2434 FK_NAMES, FK_PREFIX, plainFlag,
2435 "globalprefixexclude",
2436 FLG_GLOBPREFIXEXCLUDE,
2437 "the globalprefix may not be used for non-global identifiers",
2438 "An identifier that is not a global variable starts with the globalprefix.",
2439 0, 0
2440 } ,
28bf4b0b 2441 {
bb7c2085 2442 FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING,
2443 "typeprefix",
2444 FLG_TYPEPREFIX,
2445 "set namespace prefix for user-defined types",
2446 "A user-defined type does not start with the typeprefix",
28bf4b0b 2447 0, 0
bb7c2085 2448 } ,
28bf4b0b 2449 {
bb7c2085 2450 FK_NAMES, FK_PREFIX, plainFlag,
2451 "typeprefixexclude",
2452 FLG_TYPEPREFIXEXCLUDE,
2453 "the typeprefix may not be used for identifiers that are not type names",
2454 "An identifier that is not a type name starts with the typeprefix.",
2455 0, 0
2456 } ,
28bf4b0b 2457 {
bb7c2085 2458 FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING,
2459 "externalprefix",
2460 FLG_EXTERNALPREFIX,
2461 "set namespace prefix for external identifiers",
2462 "An external identifier does not start with the externalprefix",
28bf4b0b 2463 0, 0
bb7c2085 2464 } ,
28bf4b0b 2465 {
bb7c2085 2466 FK_NAMES, FK_PREFIX, plainFlag,
2467 "externalprefixexclude",
2468 FLG_EXTERNALPREFIXEXCLUDE,
2469 "the externalprefix may not be used for non-external identifiers",
2470 "An identifier that is not external starts with the externalprefix.",
2471 0, 0
2472 } ,
28bf4b0b 2473 {
bb7c2085 2474 FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING,
2475 "localprefix",
2476 FLG_LOCALPREFIX,
2477 "set namespace prefix for local variables",
2478 "A local variable does not start with the localprefix",
28bf4b0b 2479 0, 0
bb7c2085 2480 } ,
28bf4b0b 2481 {
bb7c2085 2482 FK_NAMES, FK_PREFIX, plainFlag,
2483 "localprefixexclude",
2484 FLG_LOCALPREFIXEXCLUDE,
2485 "the localprefix may not be used for non-local identifiers",
2486 "An identifier that is not a local variable starts with the localprefix.",
2487 0, 0
2488 } ,
28bf4b0b 2489 {
bb7c2085 2490 FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING,
2491 "uncheckedmacroprefix",
2492 FLG_UNCHECKEDMACROPREFIX,
2493 "set namespace prefix for unchecked macros",
2494 "An unchecked macro name does not start with the uncheckedmacroprefix",
28bf4b0b 2495 0, 0
bb7c2085 2496 } ,
28bf4b0b 2497 {
bb7c2085 2498 FK_NAMES, FK_PREFIX, plainFlag,
2499 "uncheckedmacroprefixexclude",
2500 FLG_UNCHECKEDMACROPREFIXEXCLUDE,
2501 "the uncheckmacroprefix may not be used for identifiers that are not "
2502 "unchecked macros",
2503 "An identifier that is not the name of an unchecked macro "
2504 "starts with the uncheckedmacroprefix.",
2505 0, 0
2506 } ,
28bf4b0b 2507 {
bb7c2085 2508 FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING,
2509 "constprefix",
2510 FLG_CONSTPREFIX,
2511 "set namespace prefix for constants",
2512 "A constant does not start with the constantprefix",
2513 0, 0
2514 } ,
28bf4b0b 2515 {
bb7c2085 2516 FK_NAMES, FK_PREFIX, plainFlag,
2517 "constprefixexclude",
2518 FLG_CONSTPREFIXEXCLUDE,
2519 "the constprefix may not be used for non-constant identifiers",
2520 "An identifier that is not a constant starts with the constantprefix.",
2521 0, 0
2522 } ,
28bf4b0b 2523 {
bb7c2085 2524 FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING,
2525 "iterprefix",
2526 FLG_ITERPREFIX,
2527 "set namespace prefix for iterators",
2528 "An iter does not start with the iterator prefix",
2529 0, 0
2530 } ,
28bf4b0b 2531 {
bb7c2085 2532 FK_NAMES, FK_PREFIX, plainFlag,
2533 "iterprefixexclude",
2534 FLG_ITERPREFIXEXCLUDE,
2535 "the iterprefix may not be used for non-iter identifiers",
2536 "An identifier that is not a iter starts with the iterprefix.",
2537 0, 0
2538 } ,
28bf4b0b 2539 {
bb7c2085 2540 FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING,
2541 "protoparamprefix",
2542 FLG_DECLPARAMPREFIX,
2543 "set namespace prefix for parameters in function prototype declarations",
2544 "A parameter name in a function prototype declaration does not start with the "
2545 "declaration parameter prefix",
2546 0, 0
2547 } ,
2548
2549 /* 12.3 Naming Restrictions */
28bf4b0b 2550 {
2551 FK_NAMES, FK_ANSI, modeFlag,
27c9e640 2552 "isoreserved",
28bf4b0b 2553 FLG_ANSIRESERVED,
2554 "external name conflicts with name reserved for system or standard library",
27c9e640 2555 "External name is reserved for system use by ISO C99 standard.",
28bf4b0b 2556 0, 0
2557 },
2558 {
2559 FK_NAMES, FK_ANSI, modeFlag,
2560 "cppnames",
2561 FLG_CPPNAMES,
2562 "external or internal name is a C++ keyword or reserved word",
2563 "External name is a C++ keyword or reserved word. "
2564 "This could lead to problems if the "
2565 "code is compiled with a C++ compiler.",
2566 0, 0
2567 },
2568 {
2569 FK_NAMES, FK_ANSI, modeFlag,
27c9e640 2570 "isoreservedinternal",
28bf4b0b 2571 FLG_ANSIRESERVEDLOCAL,
2572 "internal name conflicts with name reserved for system or standard library",
27c9e640 2573 "Internal name is reserved for system in ISO C99 standard (this should not be necessary unless you are worried about C library implementations that violate the standard and use macros).",
28bf4b0b 2574 0, 0
2575 },
2576 {
2577 FK_NAMES, FK_ANSI, plainFlag,
2578 "distinctexternalnames",
2579 FLG_DISTINCTEXTERNALNAMES,
2580 "external name is not distinguishable from another external name using "
2581 "the number of significant characters",
2582 "An external name is not distinguishable from another external name "
2583 "using the number of significant characters. According to "
2584 "ANSI Standard (3.1), an implementation may only consider the first 6 "
2585 "characters significant, and ignore alphabetical case "
27c9e640 2586 "distinctions (ISO C99 requires 31). The "
28bf4b0b 2587 "+externalnamelen <n> flag may be used to change the number "
2588 "of significant characters, and -externalnamecaseinsensitive to make "
2589 "alphabetical case significant in external names.",
2590 0, 0
2591 },
2592 {
2593 FK_NAMES, FK_ANSI, specialValueFlag,
2594 "externalnamelen",
2595 FLG_EXTERNALNAMELEN,
2596 "set the number of significant characters in an external name",
27c9e640 2597 "Sets the number of significant characters in an external name (default is 6 for old "
2598 "ANSI89 limit, C99 requires 31). "
2599 "Sets +distinctexternalnames.",
28bf4b0b 2600 0, 0
2601 },
2602 {
2603 FK_NAMES, FK_ANSI, plainSpecialFlag,
2604 "externalnamecaseinsensitive",
2605 FLG_EXTERNALNAMECASEINSENSITIVE,
2606 "alphabetic comparisons for external names are case-insensitive",
27c9e640 2607 "Make alphabetic case insignificant in external names. By ANSI89 "
28bf4b0b 2608 "standard, case need not be significant in an external name. "
2609 "If +distinctexternalnames is not set, sets "
2610 "+distinctexternalnames with unlimited external name length.",
2611 0, 0
2612 },
2613 {
2614 FK_NAMES, FK_ANSI, plainFlag,
2615 "distinctinternalnames",
2616 FLG_DISTINCTINTERNALNAMES,
2617 "internal name is not distinguishable from another internal name using "
2618 "the number of significant characters",
2619 "An internal name is not distinguishable from another internal name "
2620 "using the number of significant characters. According to "
27c9e640 2621 "ANSI89 Standard (3.1), an implementation may only consider the first 31 "
2622 "characters significant (ISO C99 specified 63). The "
28bf4b0b 2623 "+internalnamelen <n> flag changes the number "
2624 "of significant characters, -internalnamecaseinsensitive to makes "
2625 "alphabetical case significant, and "
2626 "+internalnamelookalike to make similar-looking characters "
2627 "non-distinct.",
2628 0, 0
2629 },
2630 {
2631 FK_NAMES, FK_ANSI, specialValueFlag,
2632 "internalnamelen",
2633 FLG_INTERNALNAMELEN,
2634 "set the number of significant characters in an internal name",
27c9e640 2635 "Sets the number of significant characters in an internal name (ANSI89 "
28bf4b0b 2636 "default is 31.) Sets +distinctinternalnames.",
2637 0, 0
2638 },
2639 {
2640 FK_NAMES, FK_ANSI, plainSpecialFlag,
2641 "internalnamecaseinsensitive",
2642 FLG_INTERNALNAMECASEINSENSITIVE,
2643 "set whether case is significant an internal names "
2644 "(-internalnamecaseinsensitive means case is significant)" ,
2645 "Set whether case is significant an internal names "
2646 "(-internalnamecaseinsensitive "
27c9e640 2647 "means case is significant). By ANSI89 default, case is not "
28bf4b0b 2648 "significant. If +distinctinternalnames is not set, sets "
2649 "+distinctinternalnames with unlimited internal name length.",
2650 0, 0
2651 },
2652 {
2653 FK_NAMES, FK_ANSI, plainSpecialFlag,
2654 "internalnamelookalike",
2655 FLG_INTERNALNAMELOOKALIKE,
2656 "lookalike characters match in internal names",
2657 "Set whether similar looking characters (e.g., \"1\" and \"l\") "
2658 "match in internal names.",
2659 0, 0
2660 },
2661 {
bb7c2085 2662 FK_NAMES, FK_PREFIX, modeFlag,
2663 "protoparamname",
2664 FLG_DECLPARAMNAME,
2665 "a parameter in a function prototype has a name",
2666 "A parameter in a function prototype has a name. This is dangerous, "
2667 "since a macro definition could be visible here.",
28bf4b0b 2668 0, 0
2669 } ,
2670 {
bb7c2085 2671 FK_NAMES, FK_PREFIX, modeFlag,
2672 "protoparammatch",
2673 FLG_DECLPARAMMATCH,
2674 "the name of a parameter in a function prototype and corresponding "
2675 "declaration must match (after removing the protoparamprefix",
2676 "A parameter in a function definition does not have the same name as "
2677 "the corresponding in the declaration of the function after "
2678 "removing the protoparamprefix",
2679 0, 0
2680 } ,
28bf4b0b 2681 {
2682 FK_NAMES, FK_PREFIX, plainFlag,
bb7c2085 2683 "protoparamprefixexclude",
2684 FLG_DECLPARAMPREFIXEXCLUDE,
2685 "the protoparamprefix may not be used for non-declaraction parameter identifiers",
2686 "An identifier that is not a parameter name in a function prototype "
2687 "starts with the protoparamprefix.",
28bf4b0b 2688 0, 0
2689 } ,
bb7c2085 2690
2691 /*
2692 ** 13. Completeness
2693 */
2694
2695 /* 13.1 Unused Declarations */
2696
28bf4b0b 2697 {
bb7c2085 2698 FK_USE, FK_COMPLETE, modeFlag,
2699 "topuse",
2700 FLG_TOPUNUSED,
2701 "declaration at top level not used",
2702 "An external declaration not used in any source file.", 0, 0
2703 },
2704 {
2705 FK_USE, FK_EXPORT, modeFlag,
2706 "exportlocal",
2707 FLG_EXPORTLOCAL,
2708 "a declaration is exported but not used outside this module",
2709 "A declaration is exported, but not used outside this module. "
2710 "Declaration can use static qualifier.",
28bf4b0b 2711 0, 0
bb7c2085 2712 },
28bf4b0b 2713 {
bb7c2085 2714 FK_USE, FK_EXPORT, modeFlag,
2715 "exportheader",
2716 FLG_EXPORTHEADER,
2717 "a declaration is exported but does not appear in a header file",
2718 "A declaration is exported, but does not appear in a header file.",
2719 0, 0
2720 },
28bf4b0b 2721 {
bb7c2085 2722 FK_USE, FK_EXPORT, modeFlag,
2723 "exportheadervar",
2724 FLG_EXPORTHEADERVAR,
2725 "a variable declaration is exported but does not appear in a header file",
2726 "A variable declaration is exported, but does not appear in a header "
2727 "file. (Used with exportheader.)",
28bf4b0b 2728 0, 0
bb7c2085 2729 },
28bf4b0b 2730 {
bb7c2085 2731 FK_USE, FK_NONE, modeFlag,
2732 "fielduse",
2733 FLG_FIELDUNUSED,
2734 "field of structure type not used",
2735 "A field is present in a structure type but never used. Use /*@unused@*/ in front of field declaration to suppress message.",
2736 0, 0
2737 },
28bf4b0b 2738 {
bb7c2085 2739 FK_USE, FK_NONE, modeFlag,
2740 "enummemuse",
2741 FLG_ENUMMEMUNUSED,
2742 "member of an enum type not used",
2743 "A member of an enum type is never used.",
28bf4b0b 2744 0, 0
bb7c2085 2745 },
28bf4b0b 2746 {
bb7c2085 2747 FK_USE, FK_NONE, modeFlag,
2748 "constuse",
2749 FLG_CONSTUNUSED,
2750 "constant declared but not used",
2751 "A constant is declared but not used. Use unused in the constant declaration to suppress message.",
2752 0, 0
2753 },
28bf4b0b 2754 {
bb7c2085 2755 FK_USE, FK_NONE, modeFlag,
2756 "fcnuse",
2757 FLG_FUNCUNUSED,
2758 "function declared but not used",
2759 "A function is declared but not used. Use /*@unused@*/ in front of function header to suppress message.",
28bf4b0b 2760 0, 0
bb7c2085 2761 },
28bf4b0b 2762 {
bb7c2085 2763 FK_USE, FK_PARAMS, modeFlag,
2764 "paramuse",
2765 FLG_PARAMUNUSED,
2766 "function parameter not used ",
2767 "A function parameter is not used in the body of the function. If the argument is needed for type compatibility or future plans, use /*@unused@*/ in the argument declaration.",
2768 0, 0
2769 },
28bf4b0b 2770 {
bb7c2085 2771 FK_USE, FK_TYPE, modeFlag,
2772 "typeuse",
2773 FLG_TYPEUNUSED,
2774 "type declared but not used",
2775 "A type is declared but not used. Use /*@unused@*/ in front of typedef to suppress messages.",
28bf4b0b 2776 0, 0
bb7c2085 2777 },
2778 {
2779 FK_USE, FK_NONE, modeFlag,
2780 "varuse",
2781 FLG_VARUNUSED,
2782 "variable declared but not used",
2783 "A variable is declared but never used. Use /*@unused@*/ in front "
2784 "of declaration to suppress message.",
2785 0, 0
2786 },
2787 {
2788 FK_USE, FK_COMPLETE, modeFlag,
2789 "unusedspecial",
2790 FLG_UNUSEDSPECIAL,
2791 "unused declaration in special file (corresponding to .l or .y file)",
2792 NULL, 0, 0
28bf4b0b 2793 } ,
bb7c2085 2794
2795 /* 13.2 Complete Programs */
2796
28bf4b0b 2797 {
bb7c2085 2798 FK_COMPLETE, FK_NONE, modeFlag,
2799 "declundef",
2800 FLG_DECLUNDEF,
2801 "function or variable declared but never defined",
2802 "A function or variable is declared, but not defined in any source code file.",
2803 0, 0
2804 },
28bf4b0b 2805 {
bb7c2085 2806 FK_COMPLETE, FK_SPEC, modeFlag,
2807 "specundef",
2808 FLG_SPECUNDEF,
2809 "function or variable specified but never defined",
2810 "A function or variable is declared in an .lcl file, but not defined in any source code file.",
28bf4b0b 2811 0, 0
bb7c2085 2812 },
28bf4b0b 2813 {
bb7c2085 2814 FK_COMPLETE, FK_SPEC, plainFlag,
2815 "specundecl",
2816 FLG_SPECUNDECL,
2817 "function or variable specified but never declared in a source file",
2818 "A function or variable is declared in an .lcl file, but not declared "
2819 "in any source code file.",
2820 0, 0
2821 },
28bf4b0b 2822 {
bb7c2085 2823 FK_DECL, FK_LIBS, plainFlag,
2824 "newdecl",
2825 FLG_NEWDECL,
2826 "report new global declarations in source files",
2827 "There is a new declaration that is not declared in a loaded library "
2828 "or earlier file. (Use this flag to check for consistency "
2829 "against a library.)",
28bf4b0b 2830 0, 0
bb7c2085 2831 },
28bf4b0b 2832 {
bb7c2085 2833 FK_INIT, FK_SPEC, plainFlag,
2834 "needspec",
2835 FLG_NEEDSPEC,
2836 "information in specifications is not also included in syntactic comments",
2837 "There is information in the specification that is not duplicated "
2838 "in syntactic comments. Normally, this is not an "
2839 "error, but it may be useful to detect it to make "
2840 "sure checking incomplete systems without the specifications will "
2841 "still use this information.",
2842 0, 0
2843 },
2844
2845 /*
2846 ** 14. Libraries and Header File Inclusion
2847 */
2848
2849 /* 14.1 Standard Libraries */
2850
28bf4b0b 2851 {
bb7c2085 2852 FK_LIBS, FK_INIT, idemGlobalFlag,
2853 "nolib",
2854 FLG_NOLIB,
2855 "do not load standard library",
2856 NULL, 0, 0
2857 },
2858 {
2859 FK_LIBS, FK_INIT, globalFlag,
2860 "isolib",
2861 FLG_ANSILIB,
2862 "use normal standard library",
2863 "Library based on the ISO standard library specification is used.",
28bf4b0b 2864 0, 0
bb7c2085 2865 },
28bf4b0b 2866 {
bb7c2085 2867 FK_LIBS, FK_INIT, globalFlag,
2868 "strictlib",
2869 FLG_STRICTLIB,
2870 "interpret standard library strictly",
2871 "Stricter version of the standard library is used. (The default "
2872 "library is standard.lcd; strict library is strict.lcd.)",
2873 0, 0
2874 },
28bf4b0b 2875 {
bb7c2085 2876 FK_LIBS, FK_INIT, globalFlag,
2877 "unixlib",
2878 FLG_UNIXLIB,
2879 "use UNIX (sort-of) standard library",
2880 "UNIX version of the standard library is used.",
28bf4b0b 2881 0, 0
bb7c2085 2882 },
28bf4b0b 2883 {
bb7c2085 2884 FK_LIBS, FK_INIT, globalFlag,
2885 "unixstrictlib",
2886 FLG_UNIXSTRICTLIB,
2887 "use strict version of UNIX (sort-of) library",
2888 "strict version of the UNIX library is used.",
2889 0, 0
2890 },
28bf4b0b 2891 {
bb7c2085 2892 FK_LIBS, FK_INIT, globalFlag,
2893 "posixlib",
2894 FLG_POSIXLIB,
2895 "use POSIX standard library",
2896 "POSIX version of the standard library is used.",
28bf4b0b 2897 0, 0
bb7c2085 2898 },
28bf4b0b 2899 {
bb7c2085 2900 FK_LIBS, FK_INIT, globalFlag,
2901 "posixstrictlib",
2902 FLG_POSIXSTRICTLIB,
2903 "use strict POSIX standard library",
2904 "POSIX version of the strict standard library is used.",
2905 0, 0
2906 },
28bf4b0b 2907 {
bb7c2085 2908 FK_LIBS, FK_INIT, globalFlag,
2909 "whichlib",
2910 FLG_WHICHLIB,
2911 "show standard library filename",
2912 NULL, 0, 0
2913 },
28bf4b0b 2914 {
bb7c2085 2915 FK_LIBS, FK_ANSI, plainFlag,
2916 "warnposixheaders",
2917 FLG_WARNPOSIX,
2918 "a POSIX header is included, but the POSIX library is not used",
2919 "Header name matches a POSIX header, but the POSIX library is not selected.",
2920 0, 0
2921 },
28bf4b0b 2922 {
bb7c2085 2923 FK_LIBS, FK_ANSI, plainFlag,
2924 "warnunixlib",
2925 FLG_WARNUNIXLIB,
2926 "warn when the unix library is used",
2927 "Unix library may not be compatible with all platforms",
28bf4b0b 2928 0, 0
2929 },
2930 {
bb7c2085 2931 FK_LIBS, FK_ANSI, plainFlag,
2932 "usevarargs",
2933 FLG_USEVARARGS,
2934 "non-standard <varargs.h> included",
2935 "Header <varargs.h> is not part of ANSI Standard. "
2936 "Should use <stdarg.h> instead.",
28bf4b0b 2937 0, 0
2938 },
bb7c2085 2939
2940 /* 14.2 Generating Libraries */
2941
28bf4b0b 2942 {
bb7c2085 2943 FK_LIBS, FK_FILES, globalStringFlag, ARG_FILE,
2944 "dump",
2945 FLG_DUMP,
2946 "save state for merging (default suffix .lcd)",
2947 NULL, 0, 0
2948 },
2949 {
2950 FK_LIBS, FK_FILES, globalStringFlag, ARG_FILE,
2951 "load",
2952 FLG_MERGE,
2953 "load state from dump file (default suffix .lcd)",
2954 NULL, 0, 0
2955 },
2956
2957 /* 14.3 Header File Inclusion */
2958
2959 {
2960 FK_HEADERS, FK_SPEED, globalFlag,
2961 "singleinclude",
2962 FLG_SINGLEINCLUDE,
2963 "optimize header inclusion to eliminate redundant includes",
2964 "When checking multiple files, each header file is processed only "
2965 "once. This may change the meaning of the code, if the "
2966 "same header file is included in different contexts (e.g., the "
2967 "header file includes #if directives and the values are "
2968 "different when it is included in different places.)",
2969 0, 0
2970 },
2971 {
2972 FK_HEADERS, FK_SPEED, globalFlag,
2973 "neverinclude",
2974 FLG_NEVERINCLUDE,
2975 "optimize header inclusion to not include any header files",
2976 "Ignore header includes. Only works if relevant information is "
2977 "loaded from a library.",
2978 0, 0
2979 },
2980 {
2981 FK_HEADERS, FK_SPEED, globalFlag,
2982 "skipsysheaders",
2983 FLG_SKIPSYSHEADERS,
2984 "do not include header files in system directories (set by -sysdirs)",
2985 "Do not include header files in system directories (set by -sysdirs)",
2986 0, 0
2987 },
2988
2989 /*
2990 ** A. Operation?
2991 */
2992
2993
2994 /*
2995 ** Syntax
2996 */
2997
2998 {
2999 FK_SYNTAX, FK_ANSI, plainFlag,
3000 "gnuextensions",
3001 FLG_GNUEXTENSIONS,
3002 "support some gnu (gcc) language extensions",
3003 "ANSI C does not allow some language features supported by gcc and other compilers. "
3004 "Use +gnuextensions to allow some of these extensions.", 0, 0
3005 },
3006
3007 /* Prototypes */
3008
3009 {
3010 FK_PROTOS, FK_ANSI, modeFlag,
3011 "noparams",
3012 FLG_NOPARAMS,
3013 "function declaration has no parameter list",
3014 "A function declaration does not have a parameter list.",
3015 0, 0
3016 },
3017 {
3018 FK_PROTOS, FK_ANSI, modeFlag,
3019 "oldstyle",
3020 FLG_OLDSTYLE,
3021 "old style function definition",
3022 "Function definition is in old style syntax. Standard prototype "
3023 "syntax is preferred.",
3024 0, 0
3025 },
3026
3027
3028 /*
3029 ** System functions
3030 */
3031
3032 {
3033 FK_SYSTEMFUNCTIONS, FK_TYPE, plainFlag,
3034 "maintype",
3035 FLG_MAINTYPE,
3036 "type of main does not match expected type",
3037 "The function main does not match the expected type.",
28bf4b0b 3038 0, 0
3039 },
3040 {
bb7c2085 3041 FK_SYSTEMFUNCTIONS, FK_BEHAVIOR, modeFlag,
3042 "exitarg",
3043 FLG_EXITARG,
3044 "argument to exit has implementation defined behavior",
3045 "The argument to exit should be 0, EXIT_SUCCESS or EXIT_FAILURE",
28bf4b0b 3046 0, 0
3047 },
bb7c2085 3048
28bf4b0b 3049 {
bb7c2085 3050 FK_DECL, FK_NONE, modeFlag,
3051 "shadow",
3052 FLG_SHADOW,
3053 "declaration reuses name visible in outer scope",
3054 "An outer declaration is shadowed by the local declaration.",
28bf4b0b 3055 0, 0
3056 },
3057 {
bb7c2085 3058 FK_DECL, FK_LIBS, modeFlag,
3059 "incondefslib",
3060 FLG_INCONDEFSLIB,
3061 "function, variable or constant defined in a library is redefined with inconsistent type",
3062 "A function, variable or constant previously defined in a library is "
3063 "redefined with a different type.",
27c9e640 3064 0, 0
3065 },
3066 {
bb7c2085 3067 FK_DECL, FK_LIBS, modeFlag,
3068 "overload",
3069 FLG_WARNOVERLOAD,
3070 "library function overloaded",
3071 "A function, variable or constant defined in the library is redefined "
3072 "with a different type.",
28bf4b0b 3073 0, 0
3074 },
3075 {
bb7c2085 3076 FK_DECL, FK_NONE, modeFlag,
3077 "nestedextern",
3078 FLG_NESTEDEXTERN,
3079 "an extern declaration is inside a function scope",
3080 "An extern declaration is used inside a function scope.",
28bf4b0b 3081 0, 0
bb7c2085 3082 },
28bf4b0b 3083 {
bb7c2085 3084 FK_DECL, FK_NONE, modeFlag,
3085 "redecl",
3086 FLG_REDECL,
3087 "function or variable redeclared",
3088 "A function or variable is declared in more than one place. This is "
3089 "not necessarily a problem, since the declarations are consistent.",
28bf4b0b 3090 0, 0
bb7c2085 3091 },
28bf4b0b 3092 {
bb7c2085 3093 FK_DECL, FK_NONE, plainFlag,
3094 "redef",
3095 FLG_REDEF,
3096 "function or variable redefined",
3097 "A function or variable is redefined. One of the declarations should use extern.",
28bf4b0b 3098 0, 0
3099 },
3100 {
bb7c2085 3101 FK_DECL, FK_TYPE, modeFlag,
3102 "imptype",
3103 FLG_IMPTYPE,
3104 "variable declaration has unknown (implicitly int) type",
3105 "A variable declaration has no explicit type. The type is implicitly int.",
28bf4b0b 3106 0, 0
3107 },
bb7c2085 3108
28bf4b0b 3109 {
bb7c2085 3110 FK_DIRECT, FK_FILES, globalStringFlag, ARG_DIRECTORY,
3111 "tmpdir",
3112 FLG_TMPDIR,
3113 "set directory for writing temp files",
3114 NULL, 0, 0
28bf4b0b 3115 },
3116 {
bb7c2085 3117 FK_DIRECT, FK_FILES, globalStringFlag, ARG_PATH,
3118 "larchpath",
3119 FLG_LARCHPATH,
3120 "set path for searching for library files (overrides LARCH_PATH environment variable)",
3121 NULL, 0, 0
28bf4b0b 3122 },
28bf4b0b 3123 {
bb7c2085 3124 FK_DIRECT, FK_FILES, globalStringFlag, ARG_DIRECTORY,
3125 "lclimportdir",
3126 FLG_LCLIMPORTDIR,
3127 "set directory to search for LCL import files (overrides LCLIMPORTDIR)",
3128 NULL, 0, 0
28bf4b0b 3129 },
a779b61e 3130 {
bb7c2085 3131 FK_DIRECT, FK_FILES, globalStringFlag, ARG_PATH,
3132 "sysdirs",
3133 FLG_SYSTEMDIRS,
3134 "set directories for system files (default /usr/include). Separate "
3135 "directories with path separator (colons in Unix, semi-colons in Windows). "
3136 "Flag settings propagate to files in a system directory. If "
3137 "-sysdirerrors is set, no errors are reported for files in "
3138 "system directories.",
3139 NULL, 0, 0
a779b61e 3140 },
4c02d8be 3141 {
bb7c2085 3142 FK_DIRECT, FK_FILES, plainFlag,
3143 "skipansiheaders",
3144 FLG_SKIPANSIHEADERS,
3145 "prevent inclusion of header files in a system directory with "
3146 "names that match standard ANSI headers. The symbolic information "
3147 "in the standard library is used instead. Flag in effect only "
3148 "if a library including the ANSI library is loaded. The ANSI "
3149 "headers are: assert, ctype, errno, float, limits, locale, math, "
3150 "setjmp, signal, stdarg, stddef, stdio, stdlib, strings, string, "
3151 "time, and wchar.",
3152 NULL, 0, 0
4c02d8be 3153 },
03d670b6 3154 {
bb7c2085 3155 FK_DIRECT, FK_FILES, plainFlag,
3156 "skipposixheaders",
3157 FLG_SKIPPOSIXHEADERS,
3158 "prevent inclusion of header files in a system directory with "
3159 "names that match standard POSIX headers. The symbolic information "
3160 "in the posix library is used instead. The POSIX headers are: "
3161 "dirent, fcntl, grp, pwd, termios, sys/stat, sys/times, "
3162 "sys/types, sys/utsname, sys/wait, unistd, and utime.",
3163 NULL, 0, 0
03d670b6 3164 },
3165 {
bb7c2085 3166 FK_DIRECT, FK_SUPPRESS, modeFlag,
3167 "sysdirerrors",
3168 FLG_SYSTEMDIRERRORS,
3169 "report errors in files in system directories (set by -sysdirs)",
3170 NULL, 0, 0
3171 },
3172 {
3173 FK_DIRECT, FK_MACROS, plainFlag,
3174 "sysdirexpandmacros",
3175 FLG_SYSTEMDIREXPAND,
3176 "expand macros in system directories regardless of other settings, "
3177 "except for macros corresponding to names defined in a load library",
3178 NULL, 0, 0
03d670b6 3179 },
3180
28bf4b0b 3181 {
bb7c2085 3182 FK_DIRECT, FK_HEADERS, globalExtraArgFlag,
3183 "I<directory>",
3184 FLG_INCLUDEPATH,
3185 "add to C include path",
3186 NULL, 0, 0
28bf4b0b 3187 },
28bf4b0b 3188 {
bb7c2085 3189 FK_DIRECT, FK_SPEC, globalExtraArgFlag,
3190 "S<directory>",
3191 FLG_SPECPATH,
3192 "add to spec path",
3193 NULL, 0, 0
885824d3 3194 },
28bf4b0b 3195 {
bb7c2085 3196 FK_EXPORT, FK_SPEC, specialFlag,
3197 "exportany",
3198 FLG_EXPORTANY,
3199 "variable, function or type exported but not specified",
3200 "A variable, function or type is exported, but not specified.",
28bf4b0b 3201 0, 0
bb7c2085 3202 },
28bf4b0b 3203 {
bb7c2085 3204 FK_EXPORT, FK_SPEC, modeFlag,
3205 "exportfcn",
3206 FLG_EXPORTFCN,
3207 "function exported but not specified",
3208 "A function is exported, but not specified.", 0, 0
28bf4b0b 3209 },
28bf4b0b 3210 {
bb7c2085 3211 FK_EXPORT, FK_SPEC, modeFlag,
3212 "exportmacro",
3213 FLG_EXPORTMACRO,
3214 "expanded macro exported but not specified",
3215 "A macro is exported, but not specified.", 0, 0
28bf4b0b 3216 },
28bf4b0b 3217 {
bb7c2085 3218 FK_EXPORT, FK_SPEC, modeFlag,
3219 "exporttype",
3220 FLG_EXPORTTYPE,
3221 "type definition exported but not specified",
3222 "A type is exported, but not specified.", 0, 0
28bf4b0b 3223 },
3224 {
bb7c2085 3225 FK_EXPORT, FK_SPEC, modeFlag,
3226 "exportvar",
3227 FLG_EXPORTVAR,
3228 "variable exported but not specified",
3229 "A variable is exported, but not specified.", 0, 0
28bf4b0b 3230 },
3231 {
bb7c2085 3232 FK_EXPORT, FK_SPEC, modeFlag,
3233 "exportconst",
3234 FLG_EXPORTCONST,
3235 "constant exported but not specified",
3236 "A constant is exported, but not specified.", 0, 0
28bf4b0b 3237 },
3238 {
bb7c2085 3239 FK_EXPORT, FK_SPEC, modeFlag,
3240 "exportiter",
3241 FLG_EXPORTITER,
3242 "constant exported but not specified",
3243 "A constant is exported, but not specified.", 0, 0
3244 },
3245
3246 {
3247 FK_FORMAT, FK_DISPLAY, valueFlag,
3248 "linelen",
3249 FLG_LINELEN,
3250 "set length of messages (number of chars)",
3251 NULL, 0, 0
28bf4b0b 3252 },
3253 {
bb7c2085 3254 FK_FORMAT, FK_DISPLAY, valueFlag,
3255 "indentspaces",
3256 FLG_INDENTSPACES,
3257 "set number of spaces to indent sub-messages",
3258 NULL, 0, 0
28bf4b0b 3259 },
3260 {
bb7c2085 3261 FK_FORMAT, FK_DISPLAY, plainFlag,
3262 "showcolumn",
3263 FLG_SHOWCOL,
3264 "show column number where error is found",
3265 NULL, 0, 0
28bf4b0b 3266 },
3267 {
bb7c2085 3268 FK_FORMAT, FK_DISPLAY, plainFlag,
3269 "parenfileformat",
3270 FLG_PARENFILEFORMAT,
3271 "show column number where error is found",
3272 NULL, 0, 0
28bf4b0b 3273 },
3274 {
bb7c2085 3275 FK_FORMAT, FK_NONE, plainFlag,
3276 "showfunc",
3277 FLG_SHOWFUNC,
3278 "show name of function containing error",
3279 NULL, 0, 0
28bf4b0b 3280 },
3281 {
bb7c2085 3282 FK_FORMAT, FK_NONE, plainFlag,
3283 "showallconjs",
3284 FLG_SHOWALLCONJS,
3285 "show all possible types",
3286 "When a library function is declared with multiple possible type, the "
3287 "alternate types are shown only if +showallconjs.",
3288 0, 0
28bf4b0b 3289 },
1d239d69 3290 {
bb7c2085 3291 FK_LIBS, FK_NONE, plainFlag,
3292 "impconj",
3293 FLG_IMPCONJ,
3294 "make all alternate types implicit (useful for making system libraries",
3295 NULL, 0, 0
3296 } ,
28bf4b0b 3297 {
bb7c2085 3298 FK_GLOBAL, FK_ERRORS, globalValueFlag,
3299 "expect",
3300 FLG_EXPECT,
3301 "expect <int> code errors",
3302 NULL, 0, 0
28bf4b0b 3303 },
3304 {
bb7c2085 3305 FK_GLOBAL, FK_ERRORS, globalValueFlag,
3306 "lclexpect",
3307 FLG_LCLEXPECT,
3308 "expect <int> spec errors",
3309 NULL, 0, 0
28bf4b0b 3310 },
3311 {
bb7c2085 3312 FK_GLOBAL, FK_USE, idemSpecialFlag,
3313 "partial",
3314 FLG_PARTIAL,
3315 "check as partial system (-specundef, -declundef, -exportlocal, "
3316 "don't check macros in headers without corresponding .c files)",
3317 NULL, 0, 0
28bf4b0b 3318 },
bb7c2085 3319
3320 /*
3321 ** Appendix D. Specifications
3322 */
3323
28bf4b0b 3324 {
bb7c2085 3325 FK_HEADERS, FK_SPEC, globalFlag,
3326 "lh",
3327 FLG_DOLH,
3328 "generate .lh files", NULL,
3329 0, 0
28bf4b0b 3330 },
3331 {
bb7c2085 3332 FK_HEADERS, FK_SPEC, globalFlag,
3333 "lcs",
3334 FLG_DOLCS,
3335 "generate .lcs files", NULL,
3336 0, 0
28bf4b0b 3337 },
bb7c2085 3338
3339 /*
3340 ** 1. Operation
3341 */
3342
28bf4b0b 3343 {
bb7c2085 3344 FK_HELP, FK_NONE, plainFlag,
3345 "warnflags",
3346 FLG_WARNFLAGS,
3347 "warn when command line sets flag in abnormal way",
3348 "Command line sets flag in abnormal way",
a956d444 3349 0, 0
3350 },
3351 {
bb7c2085 3352 FK_HELP, FK_NONE, plainFlag,
3353 "warnrc",
3354 FLG_WARNRC,
3355 "warn when there are problems with reading the initialization files",
3356 "There was a problem reading an initialization file",
a956d444 3357 0, 0
28bf4b0b 3358 },
3359 {
bb7c2085 3360 FK_HELP, FK_NONE, plainFlag,
3361 "badflag",
3362 FLG_BADFLAG,
3363 "warn about bad command line flags",
3364 "A flag is not recognized or used in an incorrect way",
28bf4b0b 3365 0, 0
3366 },
3367 {
bb7c2085 3368 FK_HELP, FK_NONE, plainFlag,
3369 "fileextensions",
3370 FLG_FILEEXTENSIONS,
3371 "warn when command line file does not have a recognized extension",
3372 NULL, 0, 0
28bf4b0b 3373 },
3374 {
bb7c2085 3375 FK_HELP, FK_NONE, globalExtraArgFlag,
3376 "help",
3377 FLG_HELP,
3378 "-help <flags> will describe flags",
3379 "Display help",
28bf4b0b 3380 0, 0
3381 },
3382 {
bb7c2085 3383 FK_INIT, FK_FILES, globalFileFlag,
3384 "f",
3385 FLG_OPTF,
3386 "read an options file (default ~/.splintrc not loaded)",
3387 "Read an options file (instead of loading default ~/.splintc)",
28bf4b0b 3388 0, 0
3389 },
3390 {
bb7c2085 3391 FK_INIT, FK_FILES, globalFileFlag,
3392 "i",
3393 FLG_INIT,
3394 "set LCL initilization file",
3395 NULL, 0, 0
3396 },
3397 {
3398 FK_INIT, FK_FILES, globalFlag,
3399 "nof",
3400 FLG_NOF,
3401 "do not read options file",
3402 "Do not read the default options file (~/.splintrc)",
28bf4b0b 3403 0, 0
3404 },
3405 {
bb7c2085 3406 FK_INIT, FK_COMMENTS, charFlag,
3407 "commentchar",
3408 FLG_COMMENTCHAR,
3409 "set marker character for syntactic comments (default is '@')",
3410 "Set the marker character for syntactic comments. Comments beginning "
3411 "with /*<char> are interpreted by Splint, where <char> is the "
3412 "comment marker character.",
28bf4b0b 3413 0, 0
3414 },
bb7c2085 3415
3416 /*
3417 ** Limits
3418 */
3419
28bf4b0b 3420 {
bb7c2085 3421 FK_LIMITS, FK_ANSI, modeValueFlag,
3422 "controlnestdepth",
3423 FLG_CONTROLNESTDEPTH,
3424 "set maximum nesting depth of compound statements, iteration control "
3425 "structures, and selection control structures (ANSI89 minimum is 15; ISO99 is 63)",
3426 "Maximum number of control levels exceeded.",
3427 0, 0
3428 },
3429 {
3430 FK_LIMITS, FK_ANSI, modeValueFlag,
3431 "stringliterallen",
3432 FLG_STRINGLITERALLEN,
3433 "set maximum length of string literals (ANSI89 minimum is 509; ISO99 is 4095)",
3434 "Maximum length of string literal exceeded.",
28bf4b0b 3435 0, 0
3436 },
3437 {
bb7c2085 3438 FK_LIMITS, FK_ANSI, modeValueFlag,
3439 "numstructfields",
3440 FLG_NUMSTRUCTFIELDS,
3441 "set maximum number of fields in a struct or union (ANSI89 minimum is 127; ISO99 is 1023)",
3442 "Maximum number of fields in a struct or union exceeded.",
28bf4b0b 3443 0, 0
3444 },
3445 {
bb7c2085 3446 FK_LIMITS, FK_ANSI, modeValueFlag,
3447 "numenummembers",
3448 FLG_NUMENUMMEMBERS,
3449 "set maximum number of members of an enum (ANSI89 minimum is 127; ISO99 is 1023)",
3450 "Limit on maximum number of members of an enum is exceeded.",
3451 0, 0
28bf4b0b 3452 },
3453 {
bb7c2085 3454 FK_LIMITS, FK_ANSI, modeValueFlag,
3455 "includenest",
3456 FLG_INCLUDENEST,
45569d72 3457 "set maximum number of nested #include files (ANSI89 minimum is 8; ISO99 is 63)",
bb7c2085 3458 "Maximum number of nested #include files exceeded.",
3459 0, 0
28bf4b0b 3460 },
3461 {
bb7c2085 3462 FK_LIMITS, FK_ANSI, specialFlag,
3463 "ansi89limits",
3464 FLG_ANSI89LIMITS,
3465 "check for violations of standard limits (controlnestdepth, "
3466 "stringliterallen, includenest, numstructfields, numenummembers) based on ANSI89 standard",
3467 NULL,
3468 0, 0
28bf4b0b 3469 },
3470 {
bb7c2085 3471 FK_LIMITS, FK_ANSI, specialFlag,
3472 "iso99limits",
3473 FLG_ISO99LIMITS,
3474 "check for violations of standard limits (controlnestdepth, "
3475 "stringliterallen, includenest, numstructfields, numenummembers) based on ISO99 standard",
3476 NULL,
3477 0, 0
28bf4b0b 3478 },
bb7c2085 3479
28bf4b0b 3480 {
3481 FK_PREPROC, FK_NONE, globalExtraArgFlag,
3482 "D<initializer>",
3483 FLG_DEFINE,
3484 "passed to pre-processor",
3485 NULL, 0, 0
3486 },
3487 {
3488 FK_PREPROC, FK_NONE, globalExtraArgFlag,
3489 "U<initializer>",
3490 FLG_UNDEFINE,
3491 "passed to pre-processor",
3492 NULL, 0, 0
3493 },
4c9767b3 3494 {
3495 FK_PREPROC, FK_SYNTAX, plainFlag,
dcdc46c8 3496 "unrecogdirective",
4c9767b3 3497 FLG_UNRECOGDIRECTIVE,
3498 "unrecognized pre-processor directive",
3499 "Pre-processor directive is not recognized.",
3500 0, 0
3501 },
28bf4b0b 3502 {
3503 FK_SUPPRESS, FK_COMMENTS, globalFlag,
3504 "supcounts",
3505 FLG_SUPCOUNTS,
3506 "The number of errors detected does not match number in /*@i<n>@*/.",
3507 NULL, 0, 0
3508 },
3509 {
3510 FK_SUPPRESS, FK_ERRORS, valueFlag,
3511 "limit",
3512 FLG_LIMIT,
3513 "limit <int> consecutive repeated errors",
3514 NULL, 0, 0
3515 },
3516 {
3517 FK_SYNTAX, FK_NONE, plainFlag,
3518 "syntax",
3519 FLG_SYNTAX,
3520 "syntax error in parsing",
77d37419 3521 "Code cannot be parsed. For help on parse errors, see splint -help parseerrors.",
28bf4b0b 3522 0, 0
3523 },
3524 {
3525 FK_SYNTAX, FK_NONE, plainFlag,
3526 "trytorecover",
3527 FLG_TRYTORECOVER,
3528 "try to recover from parse error",
4c9767b3 3529 "Try to recover from parse error. It really means try - this doesn't usually work.", 0, 0
28bf4b0b 3530 },
3531 {
3532 FK_SYNTAX, FK_PREPROC, plainFlag,
3533 "preproc",
3534 FLG_PREPROC,
bb7c2085 3535 "preprocessing error", NULL,
28bf4b0b 3536 0, 0
3537 },
45569d72 3538
28bf4b0b 3539 {
3540 FK_TYPE, FK_NONE, plainFlag,
3541 "type",
3542 FLG_TYPE,
3543 "type mismatch",
3544 "Types are incompatible.",
3545 0, 0
3546 },
45569d72 3547
7534721d 3548 {
3549 FK_TYPE, FK_NONE, plainFlag,
3550 "stringliteraltoolong",
3551 FLG_STRINGLITTOOLONG,
3552 "string literal too long for character array",
3553 "A string literal is assigned to a char array too small to hold it.",
3554 0, 0
3555 },
1810fe2a 3556 {
3557 FK_TYPE, FK_NONE, modeFlag,
3558 "stringliteralnoroomfinalnull",
3559 FLG_STRINGLITNOROOMFINALNULL,
3560 "string literal leaves no room for null terminator",
3561 "A string literal is assigned to a char array that is not big enough to hold the final null terminator. This may not be a problem because a null character has been explictedly included in the string literal using an escape sequence",
3562 0, 0
3563 },
7534721d 3564 {
3565 FK_TYPE, FK_NONE, modeFlag,
3566 "stringliteralnoroom",
3567 FLG_STRINGLITNOROOM,
3568 "string literal leaves no room for null terminator",
3569 "A string literal is assigned to a char array that is not big enough to hold the null terminator.",
3570 0, 0
3571 },
3572 {
3573 FK_TYPE, FK_NONE, modeFlag,
3574 "stringliteralsmaller",
3575 FLG_STRINGLITSMALLER,
3576 "string literal is smaller than the char array it is assigned to",
3577 "A string literal is assigned to a char array that smaller than the string literal needs.",
3578 0, 0
3579 },
28bf4b0b 3580 {
3581 FK_TYPE, FK_NONE, modeFlag,
3582 "enummembers",
3583 FLG_ENUMMEMBERS,
3584 "enum members must be int values",
3585 "Type of initial values for enum members must be int.",
3586 0, 0
3587 },
885824d3 3588
28bf4b0b 3589 {
3590 FK_TYPE, FK_NONE, plainFlag,
3591 "formattype",
3592 FLG_FORMATTYPE,
3593 "type-mismatch in parameter corresponding to format code in a printf or scanf-like function",
3594 "Type of parameter is not consistent with corresponding code in format string.",
3595 0, 0
3596 },
3597 {
3598 FK_TYPE, FK_NONE, modeFlag,
3599 "formatconst",
3600 FLG_FORMATCONST,
3601 "format parameter is not a string constant (hence variable arguments cannot be typechecked)",
3602 "Format parameter is not known at compile-time. This can lead to security vulnerabilities because the arguments cannot be type checked.",
3603 0, 0
3604 },
3605 {
3606 FK_TYPE, FK_NONE, plainFlag,
3607 "formatcode",
3608 FLG_FORMATCODE,
3609 "invalid format code in format string for printf or scanf-like function",
3610 "Format code in a format string is not valid.",
3611 0, 0
3612 },
3613 {
3614 FK_TYPEEQ, FK_ABSTRACT, modeFlag,
3615 "forwarddecl",
3616 FLG_FORWARDDECL,
3617 "forward declarations of pointers to abstract representation match abstract type",
3618 NULL, 0, 0
3619 },
3620 {
3621 FK_TYPEEQ, FK_ABSTRACT, modeFlag,
3622 "voidabstract",
3623 FLG_ABSTVOIDP,
3624 "void * matches pointers to abstract types, casting ok (dangerous)",
3625 "A pointer to void is cast to a pointer to an abstract type (or vice versa).",
3626 0, 0
3627 },
3628 {
3629 FK_TYPEEQ, FK_POINTER, plainFlag,
3630 "castfcnptr",
3631 FLG_CASTFCNPTR,
3632 "a pointer to a function is cast to a pointer to void (or vice versa)",
3633 "A pointer to a function is cast to (or used as) a pointer to void (or vice versa).",
3634 0, 0
3635 },
3636 {
3637 FK_TYPEEQ, FK_ARRAY, modeFlag,
3638 "charindex",
3639 FLG_CHARINDEX,
3640 "char can be used to index arrays",
3641 "To allow char types to index arrays, use +charindex.", 0, 0
3642 },
3643 {
3644 FK_TYPEEQ, FK_ARRAY, modeFlag,
3645 "enumindex",
3646 FLG_ENUMINDEX,
3647 "enum can be used to index arrays",
3648 "To allow enum types to index arrays, use +enumindex.", 0, 0
3649 },
3650 {
3651 FK_TYPEEQ, FK_BOOL, modeFlag,
3652 "boolint",
3653 FLG_BOOLINT,
3654 "bool and int are equivalent",
3655 "To make bool and int types equivalent, use +boolint.",
3656 0, 0
3657 },
3658 {
3659 FK_TYPEEQ, FK_NONE, modeFlag,
3660 "charint",
3661 FLG_CHARINT,
3662 "char and int are equivalent",
3663 "To make char and int types equivalent, use +charint.",
3664 0, 0
3665 },
3666 {
3667 FK_TYPEEQ, FK_NONE, modeFlag,
3668 "enumint",
3669 FLG_ENUMINT,
3670 "enum and int are equivalent",
3671 "To make enum and int types equivalent, use +enumint.",
3672 0, 0
3673 },
3674 {
3675 FK_TYPEEQ, FK_NONE, modeFlag,
3676 "floatdouble",
3677 FLG_FLOATDOUBLE,
3678 "float and double are equivalent",
3679 "To make float and double types equivalent, use +floatdouble.",
3680 0, 0
3681 },
3682 {
3683 FK_TYPEEQ, FK_NUMBERS, modeFlag,
3684 "ignorequals",
3685 FLG_IGNOREQUALS,
3686 "ignore type qualifiers (long, short, unsigned)",
3687 "To ignore type qualifiers in type comparisons use +ignorequals.",
3688 0, 0
3689 },
3690 {
3691 FK_TYPEEQ, FK_SYNTAX, plainFlag,
3692 "duplicatequals",
3693 FLG_DUPLICATEQUALS,
45569d72 3694 "report duplicate type qualifiers (e.g., unsigned unsigned)",
3695 "Duplicate type qualifiers not supported by ISO standard.",
28bf4b0b 3696 0, 0
3697 },
3698 {
3699 FK_TYPEEQ, FK_NUMBERS, modeFlag,
3700 "ignoresigns",
3701 FLG_IGNORESIGNS,
3702 "ignore signs in type comparisons (unsigned matches signed)",
3703 "To ignore signs in type comparisons use +ignoresigns",
3704 0, 0
3705 },
3706 {
3707 FK_TYPEEQ, FK_NUMBERS, modeFlag,
3708 "numliteral",
3709 FLG_NUMLITERAL,
3710 "int literals can be reals",
3711 "An int literal is used as any numeric type (including float and long long). Use +numliteral to "
3712 "allow int literals to be used as any numeric type.",
3713 0, 0
3714 },
3715 {
3716 FK_TYPEEQ, FK_NUMBERS, modeFlag,
3717 "charintliteral",
3718 FLG_CHARINTLITERAL,
3719 "character constants (e.g., 'a') can be used as ints",
3720 "A character constant is used as an int. Use +charintliteral to "
3721 "allow character constants to be used as ints. (This is safe "
3722 "since the actual type of a char constant is int.)",
3723 0, 0
3724 },
3725 {
3726 FK_TYPEEQ, FK_NUMBERS, modeFlag,
3727 "relaxquals",
3728 FLG_RELAXQUALS,
3729 "report qualifier mismatches only if dangerous",
990ec868 3730 "To allow qualifier mismatches that are not dangerous, use +relaxquals.", 0, 0
28bf4b0b 3731 },
3732 {
3733 FK_TYPEEQ, FK_NUMBERS, modeFlag,
3734 "relaxtypes",
3735 FLG_RELAXTYPES,
3736 "allow all numeric types to match",
990ec868 3737 "To allow all numeric types to match, use +relaxtypes.", 0, 0
28bf4b0b 3738 },
3739 {
3740 FK_TYPEEQ, FK_NONE, modeFlag,
3741 "charunsignedchar",
3742 FLG_CHARUNSIGNEDCHAR,
3743 "allow char and unsigned char types to match",
3744 "To allow char and unsigned char types to match use +charunsignedchar.",
3745 0, 0
3746 },
3747 {
3748 FK_TYPEEQ, FK_NUMBERS, modeFlag,
3749 "matchanyintegral",
3750 FLG_MATCHANYINTEGRAL,
3751 "allow any intergral type to match an arbitrary integral type (e.g., dev_t)",
3752 "To allow arbitrary integral types to match any integral type, use +matchanyintegral.",
3753 0, 0
3754 },
3755 {
3756 FK_TYPEEQ, FK_NUMBERS, modeFlag,
3757 "longunsignedintegral",
3758 FLG_LONGUNSIGNEDINTEGRAL,
3759 "allow long unsigned type to match an arbitrary integral type (e.g., dev_t)",
3760 "To allow arbitrary integral types to match long unsigned, use +longunsignedintegral.",
3761 0, 0
3762 },
3763 {
3764 FK_TYPEEQ, FK_NUMBERS, modeFlag,
3765 "longintegral",
3766 FLG_LONGINTEGRAL,
3767 "allow long type to match an arbitrary integral type (e.g., dev_t)",
3768 "To allow arbitrary integral types to match long unsigned, use +longintegral.",
3769 0, 0
3770 },
3771 {
3772 FK_TYPEEQ, FK_NUMBERS, modeFlag,
3773 "longunsignedunsignedintegral",
3774 FLG_LONGUNSIGNEDUNSIGNEDINTEGRAL,
3775 "allow long unsigned type to match an arbitrary unsigned integral type (e.g., size_t)",
3776 "To allow arbitrary unsigned integral types to match long unsigned, "
3777 "use +longunsignedunsignedintegral.",
3778 0, 0
3779 },
3780 {
3781 FK_TYPEEQ, FK_NUMBERS, modeFlag,
3782 "longsignedintegral",
3783 FLG_LONGSIGNEDINTEGRAL,
3784 "allow long type to match an arbitrary signed integral type (e.g., ssize_t)",
3785 "To allow arbitrary signed integral types to match long unsigned, use +longsignedintegral.",
3786 0, 0
3787 },
3788 {
3789 FK_TYPEEQ, FK_POINTER, plainFlag,
3790 "zeroptr",
3791 FLG_ZEROPTR,
bb7c2085 3792 "tread 0 as a pointer",
28bf4b0b 3793 NULL, 0, 0
3794 },
3795 {
3796 FK_TYPEEQ, FK_BOOL, modeFlag,
3797 "zerobool",
3798 FLG_ZEROBOOL,
bb7c2085 3799 "treat 0 as a boolean",
28bf4b0b 3800 NULL, 0, 0
3801 },
3802 {
3803 FK_UNRECOG, FK_DISPLAY, plainFlag,
3804 "repeatunrecog",
3805 FLG_REPEATUNRECOG,
3806 "do not suppress repeated unrecognized identifier messages (instead of only reporting the first error)",
3807 "Identifier used in code has not been declared. (Message repeated for future uses in this file.)",
3808 0, 0
3809 },
3810 {
3811 FK_UNRECOG, FK_DISPLAY, plainFlag,
3812 "sysunrecog",
3813 FLG_SYSTEMUNRECOG,
3814 "report unrecognized identifiers with system (__) prefix",
3815 "Identifier used in code has not been declared. (Message repeated for "
77d37419 3816 "future uses in this file.) Use +gnuextensions to make Splint "
28bf4b0b 3817 "recognize some keywords that are gnu extensions.",
3818 0, 0
3819 },
3820 {
3821 FK_UNRECOG, FK_NONE, plainFlag,
3822 "unrecog",
3823 FLG_UNRECOG,
3824 "unrecognized identifier",
3825 "Identifier used in code has not been declared.", 0, 0
3826 },
bb7c2085 3827
3828
28bf4b0b 3829 {
3830 FK_DECL, FK_TYPE, plainFlag,
3831 "annotationerror",
3832 FLG_ANNOTATIONERROR,
3833 "annotation is used in inconsistent location",
3834 "A declaration uses an invalid annotation.",
3835 0, 0
3836 } ,
3837 {
3838 FK_DECL, FK_TYPE, plainFlag,
3839 "commenterror",
3840 FLG_COMMENTERROR,
3841 "inconsistent syntactic comment",
3842 "A syntactic comment is used inconsistently.",
3843 0, 0
3844 } ,
45569d72 3845
3846 /*
3847 ** Use Warnings
3848 */
3849
28bf4b0b 3850 {
45569d72 3851 FK_WARNUSE, FK_NONE, plainFlag,
bb7c2085 3852 "warnuse",
3853 FLG_WARNUSE,
3854 "warn when declaration marked with warn is used",
3855 "Declaration marked with warn clause is used (can be suppresed by more specific flags).",
28bf4b0b 3856 0, 0
3857 },
28bf4b0b 3858 {
bb7c2085 3859 FK_WARNUSE, FK_SECURITY, modeFlag,
3860 "bufferoverflow",
3861 FLG_BUFFEROVERFLOW,
3862 "possible buffer overflow vulnerability",
3863 "Use of function that may lead to buffer overflow.",
3864 0, 0
3865 },
3866 {
3867 FK_WARNUSE, FK_SECURITY, modeFlag,
3868 "bufferoverflowhigh",
3869 FLG_BUFFEROVERFLOWHIGH,
3870 "likely buffer overflow vulnerability",
3871 "Use of function that may lead to buffer overflow.",
3872 0, 0
3873 },
3874 {
3875 FK_WARNUSE, FK_SECURITY, modeFlag,
3876 "implementationoptional",
3877 FLG_IMPLEMENTATIONOPTIONAL,
3878 "declarator is implementation optional (ISO99 does not require an implementation to provide it)",
3879 "Use of a declarator that is implementation optional, not required by ISO99.",
3880 0, 0
3881 },
3882 {
3883 FK_WARNUSE, FK_NONE, modeFlag,
3884 "legacy",
3885 FLG_LEGACY,
3886 "legacy declaration in Unix Standard",
3887 "Use of a declarator that is marked as a legacy entry in the Unix Standard.",
3888 0, 0
3889 },
3890 {
3891 FK_WARNUSE, FK_SECURITY, modeFlag,
3892 "multithreaded",
3893 FLG_MULTITHREADED,
3894 "function is not reentrant",
3895 "Non-reentrant function should not be used in multithreaded code.",
3896 0, 0
28bf4b0b 3897 },
3898 {
bb7c2085 3899 FK_WARNUSE, FK_SECURITY, modeFlag,
3900 "portability",
3901 FLG_PORTABILITY,
3902 "function may have undefined behavior",
3903 "Use of function that may have implementation-dependent behavior.",
28bf4b0b 3904 0, 0
3905 },
3906 {
bb7c2085 3907 FK_WARNUSE, FK_SECURITY, modeFlag,
3908 "superuser",
3909 FLG_SUPERUSER,
3910 "function is restricted to superusers",
3911 "Call to function restricted to superusers.",
28bf4b0b 3912 0, 0
3913 },
3914 {
bb7c2085 3915 FK_WARNUSE, FK_SECURITY, modeFlag,
3916 "toctou",
3917 FLG_TOCTOU,
3918 "possible time of check, time of use vulnerability",
3919 "Possible time of check, time of use vulnerability.",
3920 0, 0
3921 },
3922 {
3923 FK_WARNUSE, FK_SECURITY, modeFlag,
3924 "unixstandard",
3925 FLG_UNIXSTANDARD,
3926 "function is not required in Standard UNIX Specification",
3927 "Use of function that need not be provided by UNIX implementations",
28bf4b0b 3928 0, 0
3929 },
885824d3 3930
28bf4b0b 3931 /*
bb7c2085 3932 ** ITS4 Compability Flags
3933 **
3934 ** These flags flags must appear in order (most severe -> weakest).
28bf4b0b 3935 */
885824d3 3936
28bf4b0b 3937 {
bb7c2085 3938 FK_ITS4, FK_SECURITY, specialFlag,
28bf4b0b 3939 "its4mostrisky",
3940 FLG_ITS4MOSTRISKY,
3941 "most risky security vulnerabilities (from its4 database)",
3942 "Security vulnerability classified as most risky in its4 database.",
3943 0, 0
3944 },
3945 {
bb7c2085 3946 FK_ITS4, FK_SECURITY, specialFlag,
28bf4b0b 3947 "its4veryrisky",
3948 FLG_ITS4VERYRISKY,
3949 "very risky security vulnerabilities (from its4 database)",
3950 "Security vulnerability classified as very risky in its4 database.",
3951 0, 0
3952 },
3953 {
bb7c2085 3954 FK_ITS4, FK_SECURITY, specialFlag,
28bf4b0b 3955 "its4risky",
3956 FLG_ITS4RISKY,
3957 "risky security vulnerabilities (from its4 database)",
3958 "Security vulnerability classified as risky in its4 database.",
3959 0, 0
3960 },
3961 {
bb7c2085 3962 FK_ITS4, FK_SECURITY, specialFlag,
28bf4b0b 3963 "its4moderate",
3964 FLG_ITS4MODERATERISK,
3965 "moderately risky security vulnerabilities (from its4 database)",
3966 "Security vulnerability classified as moderate risk in its4 database.",
3967 0, 0
3968 },
3969 {
bb7c2085 3970 FK_ITS4, FK_SECURITY, specialFlag,
28bf4b0b 3971 "its4low",
3972 FLG_ITS4LOWRISK,
3973 "risky security vulnerabilities (from its4 database)",
3974 "Security vulnerability classified as risky in its4 database.",
3975 0, 0
3976 },
885824d3 3977
28bf4b0b 3978 /*
bb7c2085 3979 ** Syntactic comments
28bf4b0b 3980 */
885824d3 3981
28bf4b0b 3982 {
bb7c2085 3983 FK_SYNCOMMENTS, FK_SUPPRESS, plainFlag,
3984 "nocomments",
3985 FLG_NOCOMMENTS,
3986 "ignore all stylized comments",
3987 NULL, 0, 0
3988 },
3989 {
3990 FK_SYNCOMMENTS, FK_ABSTRACT, plainFlag,
3991 "noaccess",
3992 FLG_NOACCESS,
3993 "ignore access comments",
3994 NULL, 0, 0
3995 },
3996
3997 {
3998 FK_SYNCOMMENTS, FK_SYNTAX, plainFlag,
3999 "unrecogcomments",
4000 FLG_UNRECOGCOMMENTS,
4001 "stylized comment is unrecognized",
4002 "Word after a stylized comment marker does not correspond to a "
4003 "stylized comment.",
28bf4b0b 4004 0, 0
bb7c2085 4005 },
28bf4b0b 4006 {
bb7c2085 4007 FK_SYNCOMMENTS, FK_SYNTAX, plainFlag,
4008 "unrecogflagcomments",
4009 FLG_UNRECOGFLAGCOMMENTS,
4010 "stylized flag comment uses an unrecognized flag",
4011 "Semantic comment attempts to set a flag that is not recognized.",
28bf4b0b 4012 0, 0
bb7c2085 4013 },
28bf4b0b 4014 {
bb7c2085 4015 FK_SYNCOMMENTS, FK_SUPPRESS, modeFlag,
4016 "tmpcomments",
4017 FLG_TMPCOMMENTS,
4018 "interpret t comments (ignore errors in lines marked with /*@t<n>@*/",
4019 NULL, 0, 0
4020 },
4021 {
4022 FK_SYNCOMMENTS, FK_SUPPRESS, plainFlag,
4023 "lintcomments",
4024 FLG_LINTCOMMENTS,
4025 "interpret traditional lint comments (/*FALLTHROUGH*/, /*NOTREACHED*/)",
4026 NULL, 0, 0
4027 },
4028 {
4029 FK_SYNCOMMENTS, FK_SUPPRESS, modeFlag,
4030 "warnlintcomments",
4031 FLG_WARNLINTCOMMENTS,
4032 "warn when a traditional lint comment is used",
4033 "A traditional lint comment is used. Some traditional lint comments "
4034 "are interpreted by Splint to enable easier checking of legacy "
4035 "code. It is preferable to replace these comments with the "
4036 "suggested Splint alternative.",
28bf4b0b 4037 0, 0
4038 },
bb7c2085 4039
4040 /*
4041 ** Comments
4042 */
4043
7272a1c1 4044 {
bb7c2085 4045 FK_COMMENTS, FK_SYNTAX, plainFlag,
4046 "continuecomment",
4047 FLG_CONTINUECOMMENT,
4048 "line continuation marker (\\) in comment before */ on same line",
4049 "A line continuation marker (\\) appears inside a comment on the same "
4050 "line as the comment close. Preprocessors should handle this "
4051 "correctly, but it causes problems for some preprocessors.",
7272a1c1 4052 0, 0
4053 },
1d239d69 4054 {
bb7c2085 4055 FK_COMMENTS, FK_SYNTAX, plainFlag,
4056 "slashslashcomment",
4057 FLG_SLASHSLASHCOMMENT,
4058 "use of // comment",
4059 "A // comment is used. ISO C99 allows // comments, but earlier standards did not.",
1d239d69 4060 0, 0
4061 },
4062 {
bb7c2085 4063 FK_COMMENTS, FK_SYNTAX, plainFlag,
4064 "nestcomment",
4065 FLG_NESTCOMMENT,
4066 "comment begins inside comment",
4067 "A comment open sequence (/*) appears within a comment. This usually "
4068 "means an earlier comment was not closed.",
1d239d69 4069 0, 0
4070 },
bb7c2085 4071
4072 /*
4073 ** Flags for controlling warning message printing.
4074 */
4075
4076 /* Display */
4077
7272a1c1 4078 {
bb7c2085 4079 FK_DISPLAY, FK_ERRORS, plainFlag,
4080 "quiet",
4081 FLG_QUIET,
4082 "suppress herald and error count",
4083 NULL, 0, 0
4084 },
4085 {
4086 FK_DISPLAY, FK_ERRORS, plainFlag,
4087 "usestderr",
4088 FLG_USESTDERR,
4089 "send error messages to standard error (instead of standard out)",
4090 NULL, 0, 0
4091 },
4092 {
4093 FK_DISPLAY, FK_ERRORS, plainFlag,
4094 "showsummary",
4095 FLG_SHOWSUMMARY,
4096 "show summary of all errors reported and suppressed",
4097 NULL, 0, 0
4098 },
4099 {
4100 FK_DISPLAY, FK_FILES, plainFlag,
4101 "showscan",
4102 FLG_SHOWSCAN,
4103 "show file names are they are processed",
4104 NULL, 0, 0
4105 },
e55c0c6d 4106 {
4107 FK_DISPLAY, FK_FILES, plainFlag,
4108 "warnsysfiles",
4109 FLG_WARNSYSFILES,
4110 "Splint has been run on a system file, by default no errors are reported for system files. Use +systemdirerrors if you want splint to report errors in system files. A file is considered a system file if it is in a system directory or a subdirectory of a system directory. The sysdirs flag can be used to control the directories treated as system directories.",
4111 NULL, 0, 0
4112 },
bb7c2085 4113 {
4114 FK_DISPLAY, FK_NONE, globalFlag,
4115 "stats",
4116 FLG_STATS,
4117 "display lines processed and time",
4118 NULL, 0, 0
4119 },
4120 {
4121 FK_DISPLAY, FK_NONE, globalFlag,
4122 "timedist",
4123 FLG_TIMEDIST,
4124 "display time distribution",
4125 NULL, 0, 0
4126 },
4127 {
4128 FK_DISPLAY, FK_USE, globalFlag,
4129 "showalluses",
4130 FLG_SHOWUSES,
4131 "show sorted list of uses of all globals",
4132 NULL, 0, 0
4133 },
4134
4135 /* Hints */
4136
4137 {
4138 FK_HINTS, FK_FORMAT, plainFlag,
4139 "hints",
4140 FLG_HINTS,
4141 "provide a hint the first time a particular warning appears",
4142 "Provide a hint the first time a particular warning appears",
7272a1c1 4143 0, 0
4144 },
e83c79ec 4145 {
bb7c2085 4146 FK_HINTS, FK_FORMAT, plainFlag,
4147 "forcehints",
4148 FLG_FORCEHINTS,
4149 "provide a hint for every warnings",
4150 "Provide a hint for every warning",
e83c79ec 4151 0, 0
bb7c2085 4152 },
4153
4154 /*
4155 ** Flags for debugging
4156 */
4157
bb7c2085 4158 {
4159 FK_DEBUG, FK_NONE, valueFlag,
4160 "bugslimit",
4161 FLG_BUGSLIMIT,
4162 "set maximum number of bugs detected before giving up",
4163 NULL, 0, 0
4164 },
4165 {
9276a168 4166 FK_DEBUG, FK_BOUNDS, plainFlag,
bb7c2085 4167 "debugfcnconstraint",
4168 FLG_DEBUGFUNCTIONCONSTRAINT,
4169 "debug function constraints",
4170 "Perform buffer overflow checking even if the errors would be surpressed.",
4171 0, 0
4172 },
4173 {
4174 FK_DEBUG, FK_NONE, specialDebugFlag,
4175 "grammar",
4176 FLG_GRAMMAR,
4177 "debug parsing", NULL,
4178 0, 0
4179 },
45569d72 4180 {
4181 FK_DEBUG, FK_NONE, debugFlag,
4182 "keep",
4183 FLG_KEEP,
4184 "do not delete temporary files", NULL,
4185 0, 0
4186 },
bb7c2085 4187 {
4188 FK_DEBUG, FK_NONE, debugFlag,
4189 "nopp",
4190 FLG_NOPP,
4191 "do not pre-process input files", NULL,
4192 0, 0
4193 },
4194 {
45569d72 4195 FK_DEBUG, FK_NONE, debugFlag,
4196 "showsourceloc",
4197 FLG_SHOWSOURCELOC,
4198 "display the source code location where a warning is produced", NULL,
bb7c2085 4199 0, 0
4200 },
28bf4b0b 4201} ;
bb7c2085 4202
4203
This page took 1.248742 seconds and 5 git commands to generate.