aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sparse.1
diff options
authorJoey Pabalinas <joeypabalinas@gmail.com>2018-04-10 12:46:24 -1000
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-04-11 20:43:37 +0200
commit551b85c8a241bd45b267db152eca4cb01eddce39 (patch)
treef317dfe5e9da6ec56e2d4db4b3a2a9eeceb4c026 /sparse.1
parent8d1fb16c9e5f1fd1b3e3b5b39daad85b28b875f7 (diff)
downloadsparse-dev-551b85c8a241bd45b267db152eca4cb01eddce39.tar.gz
sparse: add -Wpointer-arith flag to toggle sizeof(void) warnings
Recent changes to the min()/max() macros in include/linux/kernel.h have added a lot of noise when compiling the kernel with Sparse checking enabled. This mostly is due to the *huge* increase in the number of sizeof(void) warnings, a larger number of which can safely be ignored. Add the -Wpointer-arith flag to enable/disable these warnings (along with the warning when applying sizeof to function types as well as warning about pointer arithmetic on these types exactly like the GCC -Wpointer-arith flag) on demand; the warning itself has been disabled by default to reduce the large influx of noise which was inadvertently added by commit 3c8ba0d61d04ced9f8 (kernel.h: Retain constant expression output for max()/min()). Update the manpage to document the new flag and add a validation case for sizeof(void). CC: Kees Cook <keescook@chromium.org> CC: Linus Torvalds <torvalds@linux-foundation.org> CC: Martin Uecker <Martin.Uecker@med.uni-goettingen.de> CC: Al Viro <viro@ZenIV.linux.org.uk> CC: Christopher Li <sparse@chrisli.org> CC: Joey Pabalinas <joeypabalinas@gmail.com> CC: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Signed-off-by: Joey Pabalinas <joeypabalinas@gmail.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'sparse.1')
-rw-r--r--sparse.113
1 files changed, 13 insertions, 0 deletions
diff --git a/sparse.1 b/sparse.1
index 70f1f55a..a1946c86 100644
--- a/sparse.1
+++ b/sparse.1
@@ -291,6 +291,19 @@ initializer. GCC allows this syntax as an extension. With
Sparse does not issue these warnings by default.
.
.TP
+.B \-Wpointer\-arith
+Warn about anything that depends on the \fBsizeof\fR a void or function type.
+
+C99 does not allow the \fBsizeof\fR operator to be applied to function types
+or to incomplete types such as void. GCC allows \fBsizeof\fR to be applied to
+these types as an extension and assigns these types a size of \fI1\fR. With
+\fB\-pointer\-arith\fR, Sparse will warn about pointer arithmetic on void
+or function pointers, as well as expressions which directly apply the
+\fBsizeof\fR operator to void or function types.
+
+Sparse does not issue these warnings by default.
+.
+.TP
.B \-Wptr\-subtraction\-blows
Warn when subtracting two pointers to a type with a non-power-of-two size.