C-sparse
view release on metacpan or search on metacpan
src/sparse-0.4.4/sparse.1 view on Meta::CPAN
.B \-Waddress\-space
Warn about code which mixes pointers to different address spaces.
Sparse allows an extended attribute
.BI __attribute__((address_space( num )))
on pointers, which designates a pointer target in address space \fInum\fR (a
constant integer). With \fB\-Waddress\-space\fR, Sparse treats pointers with
identical target types but different address spaces as distinct types. To
override this warning, such as for functions which convert pointers between
address spaces, use a type that includes \fB__attribute__((force))\fR.
Sparse issues these warnings by default. To turn them off, use
\fB\-Wno\-address\-space\fR.
.
.TP
.B \-Wbitwise
Warn about unsupported operations or type mismatches with restricted integer
types.
Sparse supports an extended attribute, \fB__attribute__((bitwise))\fR, which
creates a new restricted integer type from a base integer type, distinct from
the base integer type and from any other restricted integer type not declared
in the same declaration or \fBtypedef\fR. For example, this allows programs
to create \fBtypedef\fRs for integer types with specific endianness. With
\fB-Wbitwise\fR, Sparse will warn on any use of a restricted type in
arithmetic operations other than bitwise operations, and on any conversion of
one restricted type into another, except via a cast that includes
\fB__attribute__((force))\fR.
__bitwise ends up being a "stronger integer separation". That one
doesn't allow you to mix with non-bitwise integers, so now it's much
harder to lose the type by mistake.
__bitwise is for *unique types* that cannot be mixed with other
types, and that you'd never want to just use as a random integer (the
integer 0 is special, though, and gets silently accepted iirc - it's
kind of like "NULL" for pointers). So "gfp_t" or the "safe endianness"
types would be __bitwise: you can only operate on them by doing
specific operations that know about *that* particular type.
Generally, you want bitwise if you are looking for type safety. Sparse
does not issue these warnings by default.
.
.TP
.B \-Wcast\-to\-as
Warn about casts which add an address space to a pointer type.
A cast that includes \fB__attribute__((force))\fR will suppress this warning.
Sparse does not issue these warnings by default.
.
.TP
.B \-Wcast\-truncate
Warn about casts that truncate constant values.
Sparse issues these warnings by default. To turn them off, use
\fB\-Wno\-cast\-truncate\fR.
.
.TP
.B \-Wcontext
Warn about potential errors in synchronization or other delimited contexts.
Sparse supports several means of designating functions or statements that
delimit contexts, such as synchronization. Functions with the extended
attribute
.BI __attribute__((context( expression , in_context , out_context ))
require the context \fIexpression\fR (for instance, a lock) to have the value
\fIin_context\fR (a constant nonnegative integer) when called, and return with
the value \fIout_context\fR (a constant nonnegative integer). For APIs
defined via macros, use the statement form
.BI __context__( expression , in_value , out_value )
in the body of the macro.
With \fB-Wcontext\fR Sparse will warn when it sees a function change the
context without indicating this with a \fBcontext\fR attribute, either by
decreasing a context below zero (such as by releasing a lock without acquiring
it), or returning with a changed context (such as by acquiring a lock without
releasing it). Sparse will also warn about blocks of code which may
potentially execute with different contexts.
Sparse issues these warnings by default. To turn them off, use
\fB\-Wno\-context\fR.
.
.TP
.B \-Wdecl
Warn about any non-\fBstatic\fR variable or function definition that has no
previous declaration.
Private symbols (functions and variables) internal to a given source file
should use \fBstatic\fR, to allow additional compiler optimizations, allow
detection of unused symbols, and prevent other code from relying on these
internal symbols. Public symbols used by other source files will need
declarations visible to those other source files, such as in a header file.
All declarations should fall into one of these two categories. Thus, with
\fB-Wdecl\fR, Sparse warns about any symbol definition with neither
\fBstatic\fR nor a declaration. To fix this warning, declare private symbols
\fBstatic\fR, and ensure that the files defining public symbols have the
symbol declarations available first (such as by including the appropriate
header file).
Sparse issues these warnings by default. To turn them off, use
\fB\-Wno\-decl\fR.
.
.TP
.B \-Wdeclaration-after-statement
Warn about declarations that are not at the start of a block.
These declarations are permitted in C99 but not in C89.
Sparse issues these warnings by default only when the C dialect is
C89 (i.e. -ansi or -std=c89). To turn them off, use
\fB\-Wno\-declaration\-after\-statement\fR.
.
.TP
.B \-Wdefault\-bitfield\-sign
Warn about any bitfield with no explicit signedness.
Bitfields have no standard-specified default signedness. (C99 6.7.2) A
bitfield without an explicit \fBsigned\fR or \fBunsigned\fR creates a
portability problem for software that relies on the available range of values.
To fix this, specify the bitfield type as \fBsigned\fR or \fBunsigned\fR
explicitly.
Sparse does not issue these warnings by default.
( run in 1.836 second using v1.01-cache-2.11-cpan-39bf76dae61 )