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