Skip to content

Commit

Permalink
Documentation/sparse: add hints about __CHECKER__
Browse files Browse the repository at this point in the history
Several attributes depend on __CHECKER__, but previously there was no
clue in the tree about when __CHECKER__ might be defined.  Add hints at
the most common places (__kernel, __user, __iomem, __bitwise) and in the
sparse documentation.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Bjorn Helgaas <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: "Michael S . Tsirkin" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
bjorn-helgaas authored and torvalds committed Mar 24, 2022
1 parent c724c86 commit 179fd6b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Documentation/dev-tools/sparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ have already built it.

The optional make variable CF can be used to pass arguments to sparse. The
build system passes -Wbitwise to sparse automatically.

Note that sparse defines the __CHECKER__ preprocessor symbol.
1 change: 1 addition & 0 deletions include/linux/compiler_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#ifndef __ASSEMBLY__

/* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */
#ifdef __CHECKER__
/* address spaces */
# define __kernel __attribute__((address_space(0)))
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* any application/library that wants linux/types.h.
*/

/* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */
#ifdef __CHECKER__
#define __bitwise __attribute__((bitwise))
#else
Expand Down

0 comments on commit 179fd6b

Please sign in to comment.