Guide Contents
1. Overview
2. Operation
3. Abstract Types
4. Function Interfaces
5. Memory Management
6. Sharing
7. Value Constraints
8. Macros
9. Naming Conventions
10. Other Checks
Contact: lclint@cs.virginia.edu
This guide is preserved to maintain old links, but has been replaced by the Splint Manual.

Appendix C Flags

Flags can be grouped into four major categories:

Global flags can be used in initialization files and at the command line; all other flags may also be used in control comments.

Global Flags

Global flags can be set at the command line or in an options file, but cannot be set locally using stylized comments. These flags control on-line help, initialization files, pre-processor flags, libraries and output.

Help

On-line help provides documentation on LCLint operation and flags. When a help flag is used, no checking is done by LCLint. Help flags may be preceded by - or +.

help

Display general help overview, including list of additional help topics.
help <topic>
Display help on <topic>. Available topics:
annotationsdescribe annotations
commentsdescribe control comments
flagssummarize flag categories
flags <category>all flags pertaining to <category> (one of the categories listed by lclint -help flags)
flags alphaall flags in alphabetical order
flags fullprint a full description of all flags
mailprint information on mailing lists
modesflags settings in modes
prefixcodescharacter codes for setting namespace prefixes
referencesprint references to relevant papers and web sites
varsdescribe environment variables
versionprint maintainer and version information
help <flag>
Describe flag <flag>. (May list several flags.)
warnflags
Display a warning when a flag is set in a surprising way. An error is reported if an obsolete (LCLint Version 1.4 or earlier) flag is set, a flag is set to its current value (i.e., the + or - may be wrong), or a mode selector flag is set after mode checking flags that will be reset by the mode were set. By default, warnflags is on. To suppress flag warnings, use -warnflags.

Initialization

These flags control directories and files used by LCLint. They may be used from the command line or in an options file, but may not be used as control comments in the source code. Except where noted. they have the same meaning preceded by - or +.

tmpdir <directory>

Set directory for writing temp files. Default is /tmp/.
I<directory>
Add directory to path searched for C include files. Note there is no space after the I, to be consistent with C preprocessor flags.
S<directory>
Add directory to path search for .lcl specification files.

f <file>

Load options file <file>. If this flag is used from the command line, the default ~/.lclintrc file is not loaded. This flag may be used in an options file to load in another options file.
nof
Prevents the default options files (./.lclintrc and ~/.lclintrc) from being loaded. (Setting -nof overrides +nof, causing the options files to be loaded normally.)
systemdirs
Set directories for system files (default is "/usr/include"). Separate directories with colons (e.g., "/usr/include:/usr/local/lib"). Flag settings propagate to files in a system directory. If -systemdirerrors is set, no errors are reported for files in system directories.

Pre-processor

These flags are used to define or undefine pre-processor constants. The -I<directory> flag is also passed to the C pre-processor.

D<initializer>

Passed to the C pre-processor.
U<initializer>
Passed to the C pre-processor

Libraries

These flags control the creation and use of libraries.

dump <file>

Save state in <file> for loading. The default extension .lcd is added if <file> has no extension.
load <file>
Load state from <file> (created by -dump). The default extension .lcd is added if <file> has no extension. Only one library file may be loaded.

By default, the standard library is loaded if the -load flag is not used to load a user library. If no user library is loaded, one of the following flags may be used to select a different standard library. Precede the flag by + to load the described library (or prevent a library from being loaded using nolib). See Apppendix F for information on the provided libraries.

nolib

Do not load any library. This prevents the standard library from being loaded.
ansi-lib
Use the ANSI standard library (selected by default).
strict-lib
Use strict version of the ANSI standard library.
posix-lib
Use the POSIX standard library.
posix-strict-lib
Use the strict version of the POSIX standard library.
unix-lib
Use UNIX version of standard library.
unix-strict-lib
Use the strict version of the UNIX standard library.

Output

These flags control what additional information is printed by LCLint. Setting +<flag> causes the described information to be printed; setting -<flag> prevents it. By default, all these flags are off.

usestderr

Send error messages to standard error (instead of standard out).
showsummary
Show a summary of all errors reported and suppressed. Counts of suppressed errors are not necessarily correct since turning a flag off may prevent some checking from being done to save computation, and errors that are not reported may propagate differently from when they are reported.
showscan
Show file names are they are processed.
showalluses
Show list of uses of all external identifiers sorted by number of uses.
stats
Display number of lines processed and checking time.
timedist
Display distribution of where checking time is spent.
quiet
Suppress herald and error count. (If quiet is not set, LCLint prints out a herald with version information before checking begins, and a line summarizing the total number of errors reported.)
whichlib
Print out the standard library filename and creation information.
limit <number>
At most <number> similar errors are reported consecutively. Further errors are suppressed, and a message showing the number of suppressed messages is printed.

Expected Errors

Normally, LCLint will expect to report no errors. The exit status will be success (0) if no errors are reported, and failure if any errors are reported. Flags can be used to set the expected number of reported errors. Because of the provided error suppression mechanisms, these options should probably not be used for final checking real programs but may be useful in developing programs using make.

expect <number>

Exactly <number> code errors are expected. LCLint will exit with failure exit status unless <number> code errors are detected.

Message Format

These flags control how messages are printed. They may be set at the command line, in options files, or locally in syntactic comments. The linelen and limit flags may be preceded by + or - with the same meaning; for the other flags, + turns on the describe printing and - turns it off. The box to the left of each flag gives its default value.

showcolumn

Show column number where error is found. Default: +
showfunc
Show name of function (or macro) definition containing error. The function name is printed once before the first message detected in that function. Default: +

showallconjs
Show all possible alternate types (see Section 8.2.2). Default: -
paren-file-format
Use file(line) format in messages.
hints
Provide hints describing an error and how a message may be suppressed for the first error reported in each error class. Default: +
forcehints
Provide hints for all errors reported, even if the hint has already been displayed for the same error class. Default: -
linelen <number>
Set length of maximum message line to <number> characters. LCLint will split messages longer than <number> characters long into multiple lines. Default: 80

Mode Selector Flags

Mode selects flags set the mode checking flags to predefined values. They provide a quick coarse-grain way of controlling what classes of errors are reported. Specific checking flags may be set after a mode flag to override the mode settings. Mode flags may be used locally, however the mode settings will override specific command line flag settings. A warning is produced if a mode flag is used after a mode checking flag has been set.

These are brief descriptions to give a general idea of what each mode does. To see the complete flag settings in each mode, use lclint -help modes. A mode flag has the same effect when used with either + or -.

weak

Weak checking, intended for typical unannotated C code. No modifies checking, macro checking, rep exposure, or clean interface checking is done. Return values of type int may be ignored. The types bool, int, char and user-defined enum types are all equivalent. Old style declarations are unreported.
standard
The default mode. All checking done by weak, plus modifies checking, global alias checking, use all parameters, using released storage, ignored return values or any type, macro checking, unreachable code, infinite loops, and fall-through cases. The types bool, int and char are distinct. Old style declarations are reported.
checks
Moderately strict checking. All checking done by standard, plus must modification checking, rep exposure, return alias, memory management and complete interfaces.
strict
Absurdly strict checking. All checking done by checks, plus modifications and global variables used in unspecified functions, strict standard library, and strict typing of C operators. A special reward will be presented to the first person to produce a real program that produces no errors with strict checking.
Checking Flags

These flags control checking done by LCLint. They may be set locally using syntactic comments, from the command line, or in an options file. Some flags directly control whether a certain class of message is reported. Preceding the flag by + turns reporting on, and preceding the flag by - turns reporting off. Other flags control checking less directly by determining default values (what annotations are implicit), making types equivalent (to prevent certain type errors), controlling representation access, etc. For these flags, the effect of + is described, and the effect of - is the opposite (or explicitly explained if there is no clear opposite). The organization of this section mirrors Sections 3-10.

Key

Under each flag name is a flag descriptor encoding the what kind of flag it is and its default value. The descriptions are:

plain: -

A plain flag. The value after the colon gives the default setting (e.g., this flag is off.)
m: --++
A mode checking flag. The value of the flag is set by the mode selector. The four signs give the setting in the weak, standard, checks and strict modes. (e.g., this flag is off in the weak and standard modes, and on in the checks and strict modes.)
shortcut
A shortcut flag. This flag sets other flags, so it has no default value.

Types

Abstract Types

plain: -
impabstract

Implicit abstract annotation for type declarations that do not use concrete.

m: -+++
mutrep

Representation of mutable type has sharing semantics.

Access (Section 3.1)

plain: +
accessmodule

An abstract type defined in M.h (or specified in M.lcl) is accessible in M.c.

plain: +
accessfile

An abstract type named type is accessible in files named type.<extenstion>.

plain: +
accessczech

An abstract type named type may be accessible in a function named type_name. (see Section 9.1.1)

plain: -
accessslovak

An abstract type named type may be accessible in a function named typeName. (see Section.9.1.2)

plain: -
accessczechoslovak

An abstract type named type may be accessible in a function named type_name or typeName. (see Section 9.1.3)

shortcut
accessall

Sets accessmodule, accessfile and accessczech.

Boolean Types (Section 3.3)

These flags control the type name used to represent booleans, and whether the boolean type is abstract.

plain: -
bool

Boolean type is an abstract type.

plain: unset
booltype <name>

Set name of boolean type to <name>.

plain: FALSE
boolfalse <name>

Set name of boolean false to <name>.

plain: TRUE
booltrue <name>

Set name of boolean true to <name>.

Predicates

m: --++
predboolptr

Type of condition test is a pointer.

m: -+++
predboolint

Type of condition test is an integral type.

m: ++++
predboolothers

Type of condition test is not a boolean, pointer or integral type.

shortcut
predbool

Sets predboolint, predboolptr and preboolothers.

plain: +
predassign

The condition test is an assignment expression. If an assignment is intended, add an extra parentheses nesting (e.g., if ((a = b)) ...).

Primitive Operations

m: ---+
ptrarith

Arithmetic involving pointer and integer.

m: ++--
ptrnegate

Allow the operand of the ! operator to be a pointer.

m: ---+
bitwisesigned

An operand to a bitwise operator is not an unsigned values. This may have unexpected results depending on the signed representations.

m: -+++
shiftsigned

An operand to a shift operator is not unsigned values. This may have unexpected results depending on the signed representations.

m: ---+
strictops

Primitive operation does not type check strictly.

m: ---+
sizeoftype

Operand of sizeof operator is a type. (Safer to use expression, int *x = sizeof (*x); instead of sizeof (int).)

Format Codes

plain: +
formatcode

Invalid format code in format string for printflike or scanflike function.

plain: +
formattype

Type-mismatch in parameter corresponding to format code in a printflike or scanflike function.

Main

plain: +
maintype

Type of main does not match expected type (function returning an int, taking no parameters or two parameters of type int and char **.)

Comparisons

m: -+++
boolcompare

Comparison between boolean values. This is dangerous since there may be multiple TRUE values if any non-zero value is interpreted at TRUE.

m: -+++
realcompare

Comparison involving float or double values. This is dangerous since it may produce unexpected results because floating point representations are inexact.

m: -+++
ptrcompare

Comparison between pointer and number.

Type Equivalence

m: +---
voidabstract

Allow void * to match pointers to abstract types. (Casting a pointer to an abstract type to a pointer to void is okay if +voidabstract is set.)

plain: +
castfcnptr

A pointer to a function is cast to (or used as) a pointer to void (or vice versa).

m: +---
forwarddecl

Forward declarations of pointers to abstract representation match abstract type.

m: -+++
imptype

A variable declaration has no explicit type. The type is implicitly int.

plain: +
incompletetype

A formal parameter is declared with an incomplete type (e.g., int[][]).

m: +---
charindex

Allow char to index arrays.

m: ----
enumindex

Allow members of enum type to index arrays.

m: +---
boolint

Make bool and int types equivalent. (No type errors are reported when a boolean is used where an integral type is expected and vice versa.)

m: +---
charint

Make char and int types equivalent.

m: ++--
enumint

Make enum and int types equivalent.

m: +---
floatdouble

Make float and double types equivalent.

m: ----
ignorequals

Ignore type qualifiers (long, short, unsigned).

m: ++--
relaxquals

Report qualifier mismatches only if dangerous (information may be lost since a larger type is assigned to (or passed as) a smaller one or a comparison uses signed and unsigned values.)

m: ----
ignoresigns

Ignore signs in type comparisons (unsigned matches signed).

plain: -
longintegral

Allow long type to match an arbitrary integral type (e.g., size_t).

m: +---
longunsignedintegral

Allow long unsigned type to match an arbitrary integral type (e.g., dev_t).

plain: -
matchanyintegral

Allow any integral type to match an arbitrary integral type (e.g., dev_t).

m: +---
long-unsigned-unsigned-integral

Allow unsigned long type to match an arbitrary unsigned integral type (e.g., size_t).

m: +---
long-signed-integral

Allow long type to match an arbitrary signed integral type (e.g., ssize_t).

m: ++++
num-literal

Integer literals can be used as floats.

plain: +
char-int-literal

A character constant may be used as an int.

m: ++++
zeroptr

Literal 0 may be used as a pointer.

m: ----
relaxtypes

Allow all numeric types to match.

plain: +
fullinitblock

Initializer does not set every field in the structure.

Function Interfaces

Modification (Section 4.1)

m: ++++
modifies

Undocumented modification of caller-visible state. Without +moduncon, modification errors are only reported in the definitions of functions declared with a modifies clause (or specified).

m: --++
mustmod

Documented modification is not detected. An object listed in the modifies clause for a function, is not modified by the implementation.

shortcut
mod-uncon

Report modification errors in functions declared without a modifies clause.(Sets modnomods, mod-globs-nomods and mod-strict-globs-nomods.)

m: ---+
mod-nomods

Report modification errors (not involving global variables) in functions declared without a modifies clause.

m: ---+
mod-uncon-nomods

An unconstrained function is called in a function body where modifications are checked. Since the unconstrained function may modify anything, there may be undetected modifications in the checked function.

m: ---+
mod-internal-strict

A function that modifies internalState is called from a function that does not list internalState in its modifies clause.

m: ---+
mod-file-sys

A function modifies the file system but does not list fileSystem in its modifies clause.

Global Variables (Section 4.2)

Errors involving the use and modification of global and file static variables are reported depending on flag settings, annotations where the global variable is declared, and whether or not the function where the global is used was declared with a globals clause.

m: ++++
globs

Undocumented use of a checked global variable in a function with a globals list.

m: ++++
globuse

A global listed in the globals list is not used in the implementation.

m: ---+
globnoglobs

Use of a checked global in a function with no globals list.

m: ---+
internalglobs

Undocumented use of internal state (should have globals internalState).

m: ---+
internalglobsnoglobs

Use of internal state in function with no globals list.

m: -+++
globstate

A function returns with global in inconsistent state (null or undefined)

m: --++
allglobs

Report use and modification errors for globals not annotated with unchecked.

m: ++++
checkstrictglobs

Report use and modification errors for checkedstrict globals.

Modification of Global Variables

m: -+++
modglobs

Undocumented modification of a checked global variable.

m: ---+
modglobsunchecked

Undocumented modification of an unchecked global variable.

m: ---+
modglobsnomods

Undocumented modification of a checked global variable in a function with no modifies clause.

m: ---+
modstrictglobsnomods

Undocumented modification of a checkedstrict global variable in a function declared with no modifies clause.

Globals Lists and Modifies Clauses

m: ---+
warnmissingglobs

Global variable used in modifies clause is not listed in globals list. (The global is added to the globals list.)

m: ---+
warnmissingglobsnoglobs

Global variable used in modifies clause of a function with no globals list.

m: --++
globsimpmodsnothing

A function declared with a globals list but no modifies clause is assumed to modify nothing.

m: ----
modsimpnoglobs

A function declared with a modifies clause but no globals list is assumed to use no globals.

Implicit Checking Qualifiers

m: ----
impcheckedglobs

Implicit checked qualifier on global variables with no checking annotation.

m: ----
impcheckedstatics

Implicit checked qualifier file static scope variables with no checking annotation.

m: ----
impcheckmodglobs

Implicit checkmod qualifier on global variables with no checking annotation.

m: ----
impcheckmodstatics

Implicit checkmod qualifier file static scope variables with no checking annotation.

m: ---+
impcheckedstrictglobs

Implicit checked qualifier on global variables with no checking annotation.

m: ---+
impcheckedstrictstatics

Implicit checked qualifier file static scope variables with no checking annotation.

m: --++
impcheckmodinternals

Implicit checkmod qualifier on function scope static variables with no checking annotation.

m: -+++
impglobsweak

Global Aliasing

shortcut
globalias

Function returns with global aliasing external state (sets checkstrictglobalias, checkedglobalias, checkmodglobalias and uncheckedglobalias).

m: -+++
checkstrictglobalias

Function returns with a checkstrict global aliasing external state.

m: -+++
checkedglobalias

Function returns with a checked global aliasing external state.

m: -+++
checkmodglobalias

Function returns with a checkmod global aliasing external state.

m: --++
uncheckedglobalias

Function returns with an unchecked global aliasing external state.

Declaration Consistency (Section 4.3)

m: -+++
incondefs

Identifier redeclared or redefined with inconsistent type.

m: -+++
incondefslib

Identifier defined in a library is redefined with inconsistent type

m: ----
overload

Standard library function overloaded.

m: -+++
matchfields

A struct or enum type is redefined with inconsistent fields or members.

Memory Management

Reporting of memory management errors is controlled by flags setting checking and implicit annotations and code annotations.

Deallocation Errors (Section 5.2)

m: -+++
usereleased

Storage used after it may have been released.

m: ---+
strictusereleased

An array element used after it may have been released.

Inconsistent Branches

m: -+++
branchstate

Storage has inconsistent states of alternate paths through a branch (e.g., it is released in the true branch of an if-statement, but there is no else branch.)

m: ---+
strictbranchstate

Storage through array fetch has inconsistent states of alternate paths through a branch. Since array elements are not checked accurately, this may lead to spurious errors.

m: --++
deparrays

Treat array elements as dependent storage. Checking of array elements cannot be done accurately by LCLint. If deparrays is not set, array elements are assumed to be independent, so code that releases the same element more than once will produce no error. If deparrays is set, array elements are assumed to be dependent, so code that releases the same element more that once will produce an error, but so will code that releases different elements correctly will produce a spurious error.

Memory Leaks

m: -+++
mustfree

Allocated storage was not released before return or scope exit Errors are reported for only, fresh or owned storage.

m: -+++
compdestroy

All only references derivable from out only parameter of type void * must be released. (This is the type of the parameter to free, but may also be used for user-defined deallocation functions.)

m: ---+
strictdestroy

Report complete destruction errors for array elements that may have been released. (If strictdestroy is not set, LCLint will assume that if any array element was released, the entire array was correctly released.)

Transfer Errors

A transfer error is reported when storage is transferred (by an assignment, passing a parameter, or returning) in a way that is inconsistent.

shortcut
memtrans

Sets all memory transfer errors flags.

m: -+++
onlytrans

Only storage transferred to non-only reference (memory leak).

m: -+++
ownedtrans

Owned storage transferred to non-owned reference (memory leak).

m: -+++
freshtrans

Newly-allocated storage transferred to non-only reference (memory leak).

m: -+++
sharedtrans

Shared storage transferred to non-shared reference.

m: -+++
dependenttrans

Inconsistent dependent transfer. Dependent storage is transferred to a non-dependent reference.

m: -+++
temptrans

Temporary storage (associated with a temp formal parameter) is transferred to a non-temporary reference. The storage may be released or new aliases created.

m: -+++
kepttrans

Kept storage transferred to non-temporary reference.

m: -+++
keeptrans

Keep storage is transferred in a way that may add a new alias to it, or release it.

m: -+++
refcounttrans

Reference counted storage is transferred in an inconsistent way.

m: -+++
newreftrans

A new reference transferred to a reference counted reference (reference count is not set correctly).

m: -+++
immediatetrans

An immediate address (result of &) is transferred inconsistently.

m: -+++
statictrans

Static storage is transferred in an inconsistent way.

m: -+++
exposetrans

Inconsistent exposure transfer. Exposed storage is transferred to a non-exposed, non-observer reference.

m: -+++
observertrans

Inconsistent observer transfer. Observer storage is transferred to a non-observer reference.

m: -+++
unqualifiedtrans

Unqualified storage is transferred in an inconsistent way.

Initializers

m: --++
onlyunqglobaltrans

Only storage transferred to an unqualified global or static reference. This may lead to a memory leak, since the new reference is not necessarily released.

m: --++
staticinittrans

Static storage is used as an initial value in an inconsistent way.

m: --++
unqualifiedinittrans

Unqualified storage is used as an initial value in an inconsistent way.

Derived Storage

m: -+++
compmempass

Storage derivable from a parameter does not match the alias kind expected for the formal parameter.

Stack References

m: ++++
stackref

A stack reference is pointed to by an external reference when the function returns. Since the call frame will be destroyed when the function returns the return value will point to dead storage. (Section 5.2.6)

Implicit Memory Annotations (Section 5.3)

plain: +
globimponly

Assume unannotated global storage is only.

plain: +
paramimptemp

Assume unannotated parameter is temp.

plain: +
retimponly

Assume unannotated returned storage is only.

plain: +
structimponly

Assume unannotated structure or union field is only.

shortcut
codeimponly

Sets globimponly, retimponly and structimponly.

m: -+++
memimp

Report memory errors for unqualified storage.

m: ----
passunknown

Passing a value as an unannotated parameter clears its annotation. This will prevent many spurious errors from being report for unannotated programs, but eliminates the possibility of detecting many errors.

Sharing

Aliasing (Section 6)

m: -+++
aliasunique

A actual parameter that is passed as a unique formal parameter is aliased by another parameter or global variable.

m: -+++
mayaliasunique

A actual parameter that is passed as a unique formal parameter may be aliased by another parameter or global variable.

m: -+++
mustnotalias

An alias has been added to a temp-qualifier parameter or global that is visible externally when the function returns.

m: --++
retalias

A function returns an alias to parameter or global.

Exposure (Section 6.2)

shortcut
repexpose

The internal representation of an abstract type is visible to the caller. This means clients may have access to a pointer into the abstract representation. (Sets assignexpose, retexpose, and castexpose.)

m: --++
assignexpose

Abstract representation is exposed by an assignment or passed parameter.

m: --++
castexpose

Abstract representation is exposed through a cast.

m: --++
retexpose

Abstract representation is exposed by a return value.

Observer Modifications

plain: +
modobserver

Possible modification of observer storage.

m: ---+
modobserveruncon

Storage declared with observer may be modified through a call to an unconstrained function.

String Literals (Section 6.2.1)

m: --++
readonlytrans

Report memory transfer errors for initializations to read-only string literals

m: -+++
readonlystrings

String literals are read-only (ANSI semantics). An error is reported if a string literal may be modified or released.

Use Before Definition (Section 7.1)

m: -+++
usedef

The value of a location that may not be initialized on some execution path is used.

m: ----
impouts

Allow unannotated pointer parameters to functions to be implicit out parameters.

m: -+++
compdef

Storage derivable from a parameter, return value or global variable is not completely defined.

m: -+++
uniondef

No field of a union is defined. (No error is reported if at least one union field is defined.)

m: -+++
mustdefine

Parameter declared with out is not defined before return or scope exit.

Null Pointers (Section 7.2)

m: -+++
nullderef

A possibly null pointer may be dereferenced.

m: -+++
nullpass

A possibly null pointer is passed as a parameter not annotated with null.

m: -+++
nullret

A possibly null pointer is return as a result not annotated with null.

m: -+++
nullstate

Possibly null pointer reachable from a reference with no null annotation.

m: -+++
nullassign

Inconsistent assignment or initialization involving null pointer.

shortcut
null

Sets all null checking flags.

Macros (Section 8)

These flags control expansion and checking of macro definitions and invocations.

Macro Expansion

These flags control which macros are checked as functions or constants, and which are expanded in the pre-processing phase. Macros preceded by /*@notfunction@*/ are never expanded regardless of these flag settings. These flags may be used in source-file control comments.

plain: -
fcnmacros

Macros defined with parameter lists are not expanded and are checked as functions.

plain: -
constmacros

Macros defined without parameter lists are not expanded and are checked as constants.

shortcut
allmacros

Sets allfcnmacros and allconstmacros.

plain: -
libmacros

Macros defining identifiers declared in a loaded library are not expanded and are checked according to the library information.

Macro Definitions

These flags control what errors are reported in macro definitions.

m: -+++
macrostmt

Macro definition is not syntactically equivalent to function. This means if the macro is used as a statement (e.g., if (test) macro();) unexpected behavior may result. One fix is to surround the macro body with do { ...; } while (FALSE).

m: -+++
macroparams

A macro parameter is not used exactly once in all possible invocations of the macro.

m: -+++
macroassign

A macro parameter is used as the left side of an assignment expression.

m: -+++
macroparens

A macro parameter is used without parentheses (in potentially dangerous context).

m: ---+
macroempty

Macro definition of a function is empty.

m: -+++
macroredef

Macro is redefined. There is another macro defined with the same name.

m: -+++
macrounrecog

An unrecognized identifier appears in a macro definition. Since the identifier may be defined where the macro is used, this could be okay, but LCLint will not be able to check the unrecognized identifier appropriately.

Corresponding Declarations

m: ++++
macromatchname

A iter or constant macro is defined using a different name from the one used in the previous syntactic comment.

shortcut
macrodecl

A macro definition has no corresponding declaration. (Sets macrofcndecl and macroconstdecl.)

m: -+++
macrofcndecl

Macro definition with parameter list has no corresponding function prototype. Without a prototype, the types of the macro result and parameters is unknown.

m: -+++
macroconstdecl

A macro definition without parameter list has no corresponding constant declaration.

plain: +
nextlinemacros

A constant or iter declaration is not immediately followed by a macro definition.

Side-Effect Free Parameters (Section 8.2.1)

These flags control error reporting for parameters with inconsistent side-effects in invocations of checked function macros and function calls.

m: -+++
sefparams

An actual parameter with side-effects is passed as a formal parameter declared with sef.

m: --++
sefuncon

An actual parameter involving a call to an unconstrained function (declared without modifies clause) that may modify anything is passed as a sef parameter.

Iterators

plain: -
hasyield

An iterator has been declared with no parameters annotated with yield.

Naming Conventions

plain: +
namechecks

Turns all name checking on or off without changing other settings.

Type-Based Naming Conventions (Section 9.1)

Czech Naming Convention

shortcut
czech

Selects complete Czech naming convention (sets accessczech, czechfcns, czechvars, czechconsts, czechmacros, and czechtypes).

plain: +
accessczech

Allow access to abstract types following Czech naming convention. The representation of an abstract type named t is accessible in the definition of a function or constant named t_name.

plain: -
czechfcns

Function or iterator name is not consistent with Czech naming convention.

plain: -
czechvars

Variable name is not consistent with Czech naming convention.

plain: -
czechmacros

Expanded macro name is not consistent with Czech naming convention.

plain: -
czechconsts

Constant name is not consistent with Czech naming convention.

plain: -
czechtypes

Type name is not consistent with Czech naming convention. Czech type names must not use the underscore character.

Slovak Naming Convention

shortcut
slovak

Selects complete Slovak naming convention (sets accessslovak, slovakfcns, slovakvars, slovakconsts, slovakmacros, and slovaktypes).

plain: -
accessslovak

Allow access to abstract types following Slovak naming convention. The representation of an abstract type named t is accessible in the definition of a function or constant named tName.

plain: -
slovakfcns

Function or iterator name is not consistent with Slovak naming convention.

plain: -
slovakmacros

Expanded macro name is not consistent with Slovak naming convention.

plain: -
slovakvars

Variable name is not consistent with Slovak naming convention.

plain: -
slovakconsts

Constant name is not consistent with Slovak naming convention.

plain: -
slovaktypes

Type name is not consistent with Slovak naming convention. Slovak type names may not include uppercase letters.

Czechoslovak Naming Convention

shortcut
czechoslovak

Selects complete Czechoslovak naming convention (sets accessczechoslovak, czechoslovakfcns, czechoslovakvars, czechoslovakconsts, czechoslovakmacros, and czechoslovaktypes).

plain: -
accessczechoslovak

Allow access to abstract types by Czechoslovak naming convention. The representation of an abstract type named t is accessible in the definition of a function or constant named t_name or tName.

plain: -
czechoslovakfcns

Function name is not consistent with Czechoslovak naming convention.

plain: -
czechoslovakmacros

Expanded macro name is not consistent with Czechoslovak naming convention.

plain: -
czechoslovakvars

Variable name is not consistent with Czechoslovak naming convention.

plain: -
czechoslovakconsts

Constant name is not consistent with Czechoslovak naming convention.

plain: -
czechoslovaktypes

Type name is not consistent with Czechoslovak naming convention. Czechoslovak type names may not include uppercase letters or the underscore character.

Namespace Prefixes (Section 9.2)

macrovarprefix <prefix string>

Set namespace prefix for variables declared in a macro body. (Default is m_.)

plain: +
macrovarprefixexclude

A variable declared outside a macro body starts with the macrovarprefix.

tagprefix <prefix string>

Set namespace prefix of struct, union or enum tag identifiers.

plain: -
tagprefixexclude

An identifier that is not a tag starts with the tagprefix.

enumprefix <prefix string>

Set namespace prefix for enum members.

plain: -
enumprefixexclude

An identifier that is not an enum member starts with the enumprefix.

filestaticprefix <prefix string>

Set namespace prefix for file static declarations.

plain: -
filestaticprefixexclude

An identifier that is not file static starts with the filestaticprefix.

globalprefix <prefix string>

Set namespace prefix for global variables.

plain: -
globalprefixexclude

An identifier that is not a global variable starts with the globalprefix.

typeprefix <prefix string>

Set namespace prefix for user-defined types.

plain: -
typeprefixexclude

An identifier that is not a type name starts with the typeprefix.

externalprefix <prefix string>

Set namespace prefix for external identifiers.

plain: -
externalprefixexclude

An identifier that is not external starts with the externalprefix.

localprefix <prefix string>

Set namespace prefix for local variables.

plain: -
localprefixexclude

An identifier that is not a local variable starts with the localprefix.

uncheckedmacroprefix <prefix string>

Set namespace prefix for unchecked macros.

plain: -
uncheckedmacroprefixexclude

An identifier that is not the name of an unchecked macro starts with the uncheckedmacroprefix.

constprefix <prefix string>

Set namespace prefix for constants.

plain: -
constprefixexclude

An identifier that is not a constant starts with the constantprefix.

iterprefix <prefix string>

Set namespace prefix for iterators.

plain: -
iterprefixexclude

An identifier that is not a iter starts with the iterprefix.

proto-param-prefix <prefix string>

Set namespace prefix for parameters in function prototypes.

plain: -
proto-param-prefix-exclude

An identifier that is not a parameter in a function prototype starts with the protoprarmprefix.

m: --++
proto-param-name

A parameter in a function prototype has a name (can interfere with macro definitions).

m: ---+
proto-param-match

The name of a parameter in a function definition does not match the corresponding name of the parameter in a function prototype (after removing the protoparamprefix).

Naming Restrictions (Section 9.3)

m: -+++
shadow

Declaration reuses name visible in outer scope.

Reserved Names

m: --++
ansi-reserved

External name conflicts with name reserved for the compiler or standard library.

m: ---+
ansi-reserved-internal

Internal name conflicts with name reserved for the compiler or standard library.

m: --++
cpp-names

Internal or external name conflicts with a C++ reserved word. (Will cause problems if program is compiled with a C++ compiler.)

Distinct External Names

plain: -
distinct-external-names

An external name is not distinguishable from another external name using externalnamelen significant characters.

external-name-len<number>

Sets the number of significant characters in an external name (ANSI default minimum is 6). Sets +distinctexternalnames.

plain: -
external-name-case-insensitive

Make alphabetic case insignificant in external names. According to ANSI standard, case need not be significant in an external name. If +distinctexternalnames is not set, sets +distinctexternalnames with unlimited external name length.

Distinct Internal Names

m: ----
distinct-internal-names

An internal name is not distinguishable from another internal name using internalnamelen significant characters. (Also effected by internalnamecaseinsensitive and internalnamelookalike.)

internal-name-len <number>

Set the number of significant characters in an internal name. Sets +distinctinternalnames.

plain: -
internal-name-case-insensitive

Set whether case is significant an internal names (-internalnamecaseinsensitive means case is significant). If +distinctinternalnames is not set, sets +distinct-internal-names with unlimited internal name length.

plain: -
internalnamelookalike

Set whether similar looking characters (e.g., "1" and "l") match in internal names.

Other Checks

Undefined Evaluation Order (Section 10.1)

m: -+++
evalorder

Behavior of an expression is undefined because sub-expressions contain interfering side effects that may be evaluated in any order.

m: ---+
evalorderuncon

An expression may be undefined because a sub-expression contains a call to an unconstrained function (no modifies clause) that may modify something that may be modified or used by another sub-expression.

Problematic Control Structures (Section 10.2)

m: -+++
infloops

Likely infinite loop is detected (Section 10.2.1).

m: --++
infloopsuncon

Likely infinite loop is detected. Loop test or body calls an unconstrained function, that may produce an undetected modification.

m: ---+
elseifcomplete

There is no final else following an else if construct (Section 10.2.5).

m: -+++
casebreak

These is a non-empty case in a switch not followed by a break (Section 10.2.2).

m: -+++
misscase

A switch on an enum type is missing a case for a member of the enumerator.

m: ----
loopexec

Assume all loops execute at least once. This effects use-before-definition and memory checking. It should probably not be used globally, but may be used surrounding a particular loop that is known to always execute to prevent spurious messages.

Deep Break (Section 10.2.3)

shortcut
deepbreak

Report errors for break statements inside a nested while, for or switch. (Sets all nested break and continue flags.)

m: --++
looploopbreak

There is a break inside a while, for or iterator loop that is inside a while, for or iterator loop. Mark with /*@innerbreak@*/ to suppress the message.

m: --++
switchloopbreak

There is a break inside a while, for or iterator loop that is inside a switch statement. Mark with /*@loopbreak@*/.

m: ---+
loopswitchbreak

There is a break inside a switch statement that is inside a while, for or iterator loop. Mark with /*@switchbreak@*/.

m: ---+
switchswitchbreak

There is a break inside a switch statement that is inside another switch statement. Mark with /*@innerbreak@*/.

m: ---+
looploopcontinue

There is a continue inside a while, for or iterator loop that is inside a while, for or iterator loop. Mark with /*@innercontinue@*/.

Loop and if Bodies (Section 10.2.4)

shortcut
allempty

An if, while or for statement has no body (sets ifempty, whileempty and forempty.)

shortcut
allblock

The body of an if, while or for statement is not a block (sets ifblock, whileblock and forblock.)

m: --++
whileempty

A while statement has no body.

m: ---+
whileblock

The body of a while statement is not a block

m: ---+
forempty

A for statement has no body.

m: ---+
forblock

The body of a for statement is not a block.

m: ++++
ifempty

An if statement has no body.

m: ---+
ifblock

The body of an if statement is not a block.

Suspicious Statements (Section 10.3)

m: -+++
unreachable

Code is not reached on any possible execution.

m: -+++
noeffect

Statement has no effect.

m: ---+
noeffectuncon

Statement involving call to unconstrained function may have no effect.

m: -+++
noret

There is a path with no return in a function declared to return a non-void value.

Ignored Return Values (Section 10.3.2)

These flags control when errors are reported for function calls that do not use the return value. Casting the function call to void or declaring the called function to return /*@alt void@*/.

m: -+++
retvalbool

Return value of type bool ignored.

m: -+++
retvalint

Return value of type int ignored.

m: ++++
retvalother

Return value of type other than bool or int ignored.

shortcut
retval

Return value ignored (Sets retvalbool, retvalint, retvalother.)

Unused Declarations (Section 10.4)

These flags control when errors are reported for declarations that are never used. The unused annotation can be used to prevent unused errors from being report for a particular declaration.

m: ---+
topuse

A external declaration is not used in any file.

m: -+++
constuse

Constant never used.

m: -+++
enummemuse

Member of enumerator never used.

m: ++++
varuse

Variable never used.

m: -+++
paramuse

Function parameter never used.

m: ++++
fcnuse

Function is never used.

m: ++++
typeuse

Defined type never used.

m: -+++
fielduse

Field of structure or union type is never used.

m: ---+
unusedspecial

Declaration in a special file (corresponding to .l or .y file) is unused.

Complete Programs (Section 10.5)

m: --++
declundef

Function, variable, iterator or constant declared but never defined.

shortcut
partial

Check as partial system (sets -declundef, -exportlocal and prevents checking of macros in headers without corresponding .c files.)

Exports

m: ---+
export-local

A declaration is exported but not used outside this module. (Declaration can use the static qualifier.)

m: --++
export-header

A declaration (other than a variable) is exported but does not appear in a header file.

m: --++
export-header-var

A variable declaration is exported but does not appear in a header file.

Unrecognized Identifiers

plain: +
unrecog

An unrecognized identifier is used.

plain: +
sys-unrecog

Report unrecognized identifiers that start with the system prefix, __ (two underscores).

plain: -
repeat-unrecog

Report multiple messages for unrecognized identifiers. If repeatunrecog is not set, an error is reported only the first time a particular unrecognized identifier appears in the file.

Multiple Definition and Declarations

plain: +
redef

A function or variable is defined more than once.

m: --++
redecl

An identifier is declared more than once.

m: -+++
nested-extern

An extern declaration is used inside a function body.

ANSI C Conformance

m: --++
noparams

A function is declared without a parameter list prototype.

m: ---+
oldstyle

Function definition is in old style syntax. Standard prototype syntax is preferred.

m: -+++
exitarg

Argument to exit has implementation defined behavior. The only valid arguments to exit are EXIT_SUCCESS, EXIT_FAILURE and 0. An error is reported if LCLint can detect statically that the argument to exit is not one of these.

Limits (Section 10.6)

shortcut
ansilimits

Check for violations of standard limits (Sets controlnestdepth, stringliterallen, includenest, numstructfields, and numenummembers).

m: ---+

controlnestdepth <number>

Set maximum nesting depth of compound statements, iteration control structures, and selection control structures (ANSI minimum is 15).

m: ---+
stringliterallen <number>

Set maximum length of string literals (ANSI minimum is 509).

m: ---+
numstructfields <number>

Set maximum number of fields in a struct or union (ANSI minimum is 127).

m: ---+
numenummembers <number>

Set maximum number of members of an enum type (ANSI minimum is 127).

m: --++
includenest <number>

Set maximum number of nested #include files (ANSI minimum is 8).

Header Inclusion (Apppendix F)

plain: +
skip-ansi-headers

Prevent inclusion of header files in a system directory with names that match standard ANSI headers. The symbolic information in the standard library is used instead. In effect only if a library that includes the ANSI library is used. The ANSI headers are: assert, ctype, errno, float, limits, locale, math, setjmp, signal, stdarg, stddef, stdio, stdlib, strings, string, time, and wchar.

plain: +
skip-posix-headers

Prevent inclusion of header files in a system directory with names that match standard POSIX headers. The symbolic information in the standard library is used instead. In effect only if a library that includes the POSIX library is used. The POSIX headers are: dirent, fcntl, grp, pwd, termios, sys/stat, sys/times, sys/types, sys/utsname, sys/wait, unistd, and utime.

plain: +
warn-posix-headers

Report use of a POSIX header when checking a program with a non-POSIX library.

skipsysheaders

Do not include header files in system directories (as set by -sysdirs)

plain: +
sys-dir-expand-macros

Expand macros in system directories regardless of other settings, except for macros corresponding to names defined in a load library.

m: ---+
sys-dir-errors

Report errors in files in system directories (set by -systemdirs).

single-include

Optimize header inclusion to only include each header file once.

never-include

Use library information instead of including header files.

Comments

These flags control how syntactic comments are interpreted (see Apppendix E).

commentchar <char>

Set the marker character for syntactic comments. Comments beginning with /*<char> are interpreted by LCLint. Default: @

plain: -
noaccess

Ignore access comments.

plain: -
nocomments

Ignore all stylized comments.

plain: +
supcounts

Actual number of errors does not match number in /*@i<n>@*/

plain: +
lintcomments

Interpret traditional lint comments (/*FALLTHROUGH*/, /*NOTREACHED*/, /*PRINTLIKE*/).

m: -+++
warnlintcomments

Print a warning and suggest an alternative when a traditional lint comment is used.

plain: +
unrecogcomments

Stylized comment is unrecognized.

Parsing

plain: -
continue-comment

A line continuation marker (\) appears inside a comment on the same line as the comment close. Preprocessors should handle this correctly, but it causes problems for some preprocessors. plain: +
nest-comment

A comment open sequence (/*) appears inside a comment. This usually indicates that an earlier comment was not closed.

plain: +
duplicate-quals

Report duplicate type qualifiers (e.g., long long). Duplicate type qualifiers not supported by ANSI, but some compilers (e.g., gcc) do support duplicate qualifiers.

plain: +
gnu-extensions

Support some GNU (gcc) and Microsoft language extensions.

Array Formal Parameters

These flags control reporting of common errors caused by confusion about the semantics of array formal parameters.

General Checks

plain: +
sizeof-formal-array

The sizeof operator is used on a parameter declared as an array. (In many instances this has unexpected behavior, since the result is the size of a pointer to the element type, not the number of elements in the array.)

plain: +
fixed-formal-array

An array formal parameter is declared with a fixed size (e.g., int x[20]). This is likely to be confusing, since the size is ignored.

plain: -
formal-array

A formal parameter is declared as an array. This is probably not a problem, but can be confusing since it is treated as a pointer.

These flags should probably not be set globally since the turn off general checks that should always be done. They may be used locally to suppress spurious errors.

plain: +
abstract

A data abstraction barrier is violated.

plain: +
control

A control flow error is detected.

plain: +
syntax

Parse error.

plain: -
trytorecover

Try to recover from a parse error. If trytorecover is not set, LCLint will abort checking after a parse error is detected. If it is set, LCLint will attempt to recover, but LCLint does performs only minimal error recovery.

plain: +
type

Type mismatch.

Flag Name Abbreviations

Within a flag name, abbreviations may be used. Table 2 shows the flag name abbreviations. The expanded and short forms are interchangeable in flag names.

For example, globsimpmodsnothing and globalsimpliesmodifiesnothing denote the same flag. Abbreviations in flag names allow pronounceable, descriptive names to be used without making flag names excessively long (although one must admit even globsimpmodsnothing is a bit of a mouthful.)

Expanded FormShort Form
constant const
declaration decl
function fcn
global glob
implicit, implied imp
iterator iter
length len
modifies mods
modify mod
memory mem
parameter param
pointer ptr
return ret
variable var
unconstrained, unconst uncon
Table 2. Flag name abbreviations.

Next: Appendix D. Annotations
Contents

This guide is preserved to maintain old links, but has been replaced by the Splint Manual.

Guide Contents
1. Overview
2. Operation
3. Abstract Types
4. Function Interfaces
5. Memory Management
6. Sharing
7. Value Constraints
8. Macros
9. Naming Conventions
10. Other Checks
Contact: lclint@cs.virginia.edu