Oracle® Solaris Studio 12.4: C User's Guide

Exit Print View

Updated: March 2015
 
 

4.3.9 -errchk=l(, l)

Perform additional checking as specified by l. The default is -errchk=%none. Specifying -errchk is equivalent to specifying -errchk=%all. l is a comma-separated list of checks that consists of one or more of the flags in the following table, for example, -errchk=longptr64,structarg.

Table 4-1  -errchk Flags
Value
Meaning
%all
Perform all of -errchk’s checks.
%none
Perform none of -errchk’s checks. This is the default.
[no%]locfmtchk
Check for printf-like format strings during the first pass of lint. Regardless of whether you use -errchk=locfmtchk, lint always checks for printf-like format strings in its second pass.
[no%]longptr64
Check portability to environment for which the size of long integers and pointers is 64 bits and the size of plain integers is 32 bits. Check assignments of pointer expressions and long integer expressions to plain integers, even when explicit cast is used.
Note that system header files define types intended to manipulate pointers. With the -m32 flag those types may be defined as base types like int that cannot safely manipulate a pointer, thus leading to false warnings. For example, usages of size_t:
#include <stdlib.h>
size_t
myfiunk(uint32_t param)
{
        return sizeof(uint64_t) * param;
}
.
$ lint -m32 -mux -errchk=longptr64 bug.c
(5) warning: assignment of 64-bit integer to 32-bit integer
$
[no%]structarg
Check structural arguments passed by value and report the cases when formal parameter type is not known.
[no%]parentheses
Check the clarity of precedence within your code. Use this option to enhance the maintainability of code. If -errchk=parentheses returns a warning, consider using additional parentheses to clearly signify the precedence of operations within the code.
[no%]signext
Check for situations in which the normal ISO C value-preserving rules allow the extension of the sign of a signed-integral value in an expression of unsigned-integral type. This option only produces error messages when you specify -errchk=longptr64 as well.
[no%]sizematch
Check for the assignment of a larger integer to a smaller integer and issue a warning. These warnings are also issued for assignment between same size integers that have different signs (unsigned int gets a signed int).