1 /* Resembles include/linux/compiler_types.h */
2 #define __kernel __attribute__((address_space(0)))
3 #define __user __attribute__((address_space(1)))
4 #define __iomem __attribute__((address_space(2)))
5 #define __percpu __attribute__((address_space(3)))
6 #define __rcu __attribute__((address_space(4)))
7 
8 
9 typedef unsigned long ulong;
10 typedef struct s obj_t;
11 
expl(obj_t __kernel * k,obj_t __iomem * o,obj_t __user * p,obj_t __percpu * pc,obj_t __rcu * r)12 static void expl(obj_t __kernel *k, obj_t __iomem *o,
13 		 obj_t __user *p, obj_t __percpu *pc,
14 		 obj_t __rcu *r)
15 {
16 	(ulong)(k); (__UINTPTR_TYPE__)(k);
17 	(void *)(k);
18 	(obj_t*)(k);
19 	(obj_t __kernel*)(k);
20 
21 	(ulong)(o); (__UINTPTR_TYPE__)(o);
22 	(void *)(o);
23 	(obj_t*)(o);
24 	(obj_t __iomem*)(o);
25 
26 	(ulong)(p); (__UINTPTR_TYPE__)(p);
27 	(void *)(p);
28 	(obj_t*)(p);
29 	(obj_t __user*)(p);
30 
31 	(ulong)(pc); (__UINTPTR_TYPE__)(pc);
32 	(void *)(pc);
33 	(obj_t*)(pc);
34 	(obj_t __percpu*)(pc);
35 
36 	(ulong)(r); (__UINTPTR_TYPE__)(r);
37 	(void *)(r);
38 	(obj_t*)(r);
39 	(obj_t __rcu*)(r);
40 }
41 
42 /*
43  * check-name: Waddress-space-all-attr
44  * check-command: sparse -Wcast-from-as -Wcast-to-as $file
45  *
46  * check-error-start
47 Waddress-space-all-attr.c:21:10: warning: cast removes address space '<asn:2>' of expression
48 Waddress-space-all-attr.c:21:22: warning: cast removes address space '<asn:2>' of expression
49 Waddress-space-all-attr.c:22:10: warning: cast removes address space '<asn:2>' of expression
50 Waddress-space-all-attr.c:23:10: warning: cast removes address space '<asn:2>' of expression
51 Waddress-space-all-attr.c:26:10: warning: cast removes address space '<asn:1>' of expression
52 Waddress-space-all-attr.c:26:22: warning: cast removes address space '<asn:1>' of expression
53 Waddress-space-all-attr.c:27:10: warning: cast removes address space '<asn:1>' of expression
54 Waddress-space-all-attr.c:28:10: warning: cast removes address space '<asn:1>' of expression
55 Waddress-space-all-attr.c:31:10: warning: cast removes address space '<asn:3>' of expression
56 Waddress-space-all-attr.c:31:23: warning: cast removes address space '<asn:3>' of expression
57 Waddress-space-all-attr.c:32:10: warning: cast removes address space '<asn:3>' of expression
58 Waddress-space-all-attr.c:33:10: warning: cast removes address space '<asn:3>' of expression
59 Waddress-space-all-attr.c:36:10: warning: cast removes address space '<asn:4>' of expression
60 Waddress-space-all-attr.c:36:22: warning: cast removes address space '<asn:4>' of expression
61 Waddress-space-all-attr.c:37:10: warning: cast removes address space '<asn:4>' of expression
62 Waddress-space-all-attr.c:38:10: warning: cast removes address space '<asn:4>' of expression
63  * check-error-end
64  */
65