LJ Archive

LCLint Annotations

abstract: in a type definition, this annotation defines the type to be abstract. Outside the file where it was defined, the code will not be able to reference it unless the abstract type name is defined in the module. mutable: a type defined as mutable is passed to functions by reference. immutable: a type defined as immutable is passed to functions by value.

globals: indicates which global variables a function can use.

modifies: indicates which external variables a function can modify. only: the object referenced by a pointer with this annotation is referenced only by this pointer. This is a very important tool to detect memory leaks.

observer: indicates that a call to the function with this definition cannot modify the returned value.

exposed: allows, for efficiency reasons, abstract definitions to be ignored. It is similar to the friend clause of C++.

in: indicates that this function parameter is a function call parameter. out: indicates that this function parameter is a return parameter. null: the defined pointer can be NULL. By default, no pointer without this annotation can be assigned to NULL.

truenull: the annotated function returns TRUE if its first parameter is NULL. falsenull: the annotated function returns FALSE if its first parameter is NULL. notnull: the defined pointer cannot be NULL. Once a variable with NULL annotation is tested, this annotation is used to overwrite the NULL annotation.

exits: the annotated function will never return. trueexit: the annotated function does not return if its first parameter is TRUE. This annotation is useful in conjunction with the assert macro.

falseexit: the annotated function does not return if its first parameter is FALSE. This annotation is useful in conjunction with the assert macro. sef: the calculation of the function call parameters cannot generate side effects. It is useful to avoid bugs by side effects in macro functions. alt: this annotation allows the code to make casts to indicated types. unused: the indicated element will not be used.

Using Modifiers

Any one of the modifiers is invoked with this format:

LCLint
where modifiers-file is a list of modifiers, in which each modifier is preceded by a + for activation and a - for deactivation. Modifiers can also be invoked from the code using annotations: +modifier turns on the action specified by the modifier and -modifier turns off the action.
LJ Archive