sparse: use identifiers to define address spaces
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Wed, 17 Jun 2020 22:02:26 +0000 (00:02 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 18 Jun 2020 17:05:23 +0000 (10:05 -0700)
commit670d0a4b10704667765f7d18f7592993d02783aa
tree3ec6a6eb53fde1e6f25fb0c2e85470b54e5615be
parent1b5044021070efa3259f3e9548dc35d1eb6aa844
sparse: use identifiers to define address spaces

Currently, address spaces in warnings are displayed as '<asn:X>' with
'X' being the address space's arbitrary number.

But since sparse v0.6.0-rc1 (late December 2018), sparse allows you to
define the address spaces using an identifier instead of a number.  This
identifier is then directly used in the warnings.

So, use the identifiers '__user', '__iomem', '__percpu' & '__rcu' for
the corresponding address spaces.  The default address space, __kernel,
being not displayed in warnings, stays defined as '0'.

With this change, warnings that used to be displayed as:

cast removes address space '<asn:1>' of expression
... void [noderef] <asn:2> *

will now be displayed as:

cast removes address space '__user' of expression
... void [noderef] __iomem *

This also moves the __kernel annotation to be the first one, since it is
quite different from the others because it's the default one, and so:

 - it's never displayed

 - it's normally not needed, nor in type annotations, nor in cast
   between address spaces. The only time it's needed is when it's
   combined with a typeof to express "the same type as this one but
   without the address space"

 - it can't be defined with a name, '0' must be used.

So, it seemed strange to me to have it in the middle of the other
ones.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Acked-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/compiler_types.h