Print this page
new smatch
@@ -17,10 +17,15 @@
corresponding warning option -Wsomething. Sparse issues some warnings
by default; to turn off those warnings, pass the negation of the
associated warning option, -Wno-something.
WARNING OPTIONS
+ -fmax-warnings=COUNT
+ Set the maximum number of displayed warnings to COUNT, which
+ should be a numerical value or 'unlimited'. The default limit
+ is 100.
+
-Wsparse-all
Turn on all sparse warnings, except for those explicitly
disabled via -Wno-something.
-Wsparse-error
@@ -29,18 +34,26 @@
-Waddress-space
Warn about code which mixes pointers to different address
spaces.
Sparse allows an extended attribute
- __attribute__((address_space(num))) on pointers, which
- designates a pointer target in address space num (a constant
- integer). With -Waddress-space, 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 __attribute__((force)).
+ __attribute__((address_space(id))) on pointers, which designates
+ a pointer target in address space id (an identifier or a
+ constant integer). With -Waddress-space, Sparse treats pointers
+ with identical target types but different address spaces as
+ distinct types and will warn accordingly.
+ Sparse will also warn on casts which remove the address space
+ (casts to an integer type or to a plain pointer type). An
+ exception to this is when the destination type is uintptr_t (or
+ unsigned long) since such casts are often used to "get a pointer
+ value representation in an integer type" and such values are
+ independent of the address space.
+
+ To override these warnings, use a type that includes
+ __attribute__((force)).
+
Sparse issues these warnings by default. To turn them off, use
-Wno-address-space.
-Wbitwise
Warn about unsupported operations or type mismatches with
@@ -70,15 +83,31 @@
particular type.
Sparse issues these warnings by default. To turn them off, use
-Wno-bitwise.
+ -Wbitwise-pointer
+ Same as -Wbitwise but for casts to or from pointers to bitwise
+ types.
+
+ Sparse does not issue these warnings by default.
+
+ -Wcast-from-as
+ Warn about casts which remove an address space from a pointer
+ type.
+
+ This is similar to -Waddress-space but will also warn on casts
+ to unsigned long.
+
+ Sparse does not issues these warnings by default.
+
-Wcast-to-as
Warn about casts which add an address space to a pointer type.
A cast that includes __attribute__((force)) will suppress this
- warning.
+ warning. No warning is generated if the original type is
+ uintptr_t (or unsigned long).
Sparse does not issue these warnings by default.
-Wcast-truncate
Warn about casts that truncate constant values.
@@ -208,16 +237,10 @@
enum type.
Sparse issues these warnings by default. To turn them off, use
-Wno-enum-mismatch.
- -Wempty-character-constant
- Warn about a constant such as ''.
-
- Sparse issues these warnings by default. To turn them off, use
- -Wno-empty-character-constant.
-
-Wexternal-function-has-definition
Warn about function definitions that are declared with external
linkage.
Sparse issues these warnings by default. To turn them off, use
@@ -248,16 +271,10 @@
-Wno-memcpy-max-count.
The limit can be changed with -fmemcpy-max-count=COUNT, the
default being 100000.
- -Wnon-ansi-function-declaration
- Warn about non-ANSI function declarations.
-
- Sparse issues these warnings by default. To turn them off, use
- -Wno-non-ansi-function-declaration.
-
-Wnon-pointer-null
Warn about the use of 0 as a NULL pointer.
0 has integer type. NULL has pointer type.
@@ -353,14 +370,25 @@
Such declarations can lead to error-prone code.
Sparse does not issue these warnings by default.
+ -Wshift-count-negative
+ Warn if a shift count is negative.
+
+ Sparse issues these warnings by default.
+
+ -Wshift-count-overflow
+ Warn if a shift count is bigger than the operand's width.
+
+ Sparse issues these warnings by default.
+
-Wsizeof-bool
Warn when checking the sizeof a _Bool.
- C99 does not specify the sizeof a _Bool. gcc uses 1.
+ C99 does not specify the size of a _Bool. GCC, by default, uses
+ 1.
Sparse does not issue these warnings by default.
-Wtransparent-union
Warn about any declaration using the GCC extension
@@ -395,39 +423,59 @@
Look for system headers in the multiarch subdirectory dir. The
dir name would normally take the form of the target's normalized
GNU triplet. (e.g. i386-linux-gnu).
DEBUG OPTIONS
- -fdump-linearize[=only]
- Dump the IR code of a function directly after its linearization,
- before any simplifications are made. If the argument =only is
- also given no further processing is done on the function.
- -fmem-report Report some statistics about memory allocation used
- by the tool.
+ -fmem-report
+ Report some statistics about memory allocation used by the tool.
OTHER OPTIONS
+ -fdiagnostic-prefix[=PREFIX]
+ Prefix all diagnostics by the given PREFIX, followed by ": ".
+ If no one is given "sparse" is used. The default is to not use
+ a prefix at all.
+
-fmemcpy-max-count=COUNT
Set the limit for the warnings given by -Wmemcpy-max-count. A
- COUNT of 0, useless in itself, will effectively disable the
+ COUNT of 'unlimited' or '0' will effectively disable the
warning. The default limit is 100000.
-ftabstop=WIDTH
Set the distance between tab stops. This helps sparse report
correct column numbers in warnings or errors. If the value is
less than 1 or greater than 100, the option is ignored. The
default is 8.
+ -f[no-]unsigned-char, -f[no-]signed-char
+ Let plain 'char' be unsigned or signed. By default chars are
+ signed.
+
SEE ALSO
cgcc(1)
HOMEPAGE
http://www.kernel.org/pub/software/devel/sparse/
MAILING LIST
linux-sparse@vger.kernel.org
-MAINTAINER
- Christopher Li <sparse@chrisli.org>
+CONTRIBUTINGS AND REPORTING BUGS
+ Submission of patches and reporting of bugs, as well as discussions
+ related to Sparse, should be done via the mailing list (linux-
+ sparse@vger.kernel.org) where the development and maintenance is
+ primarily done. You do not have to be subscribed to the list to send a
+ message there.
+ Bugs can also be reported and tracked via the Linux kernel's bugzilla:
+ http://bugzilla.kernel.org/enter_bug.cgi?component=Sparse&product=Tools
+ .
+AUTHORS
+ Sparse was started by Linus Torvalds. The complete list of
+ contributors can be find at
+ https://www.openhub.net/p/sparse/contributors .
+
+ Luc Van Oostenryck is Sparse's current maintainer.
+
+
sparse(1)