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
9typedef unsigned long ulong;
10typedef struct s obj_t;
11
12static 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
47Waddress-space-all-attr.c:21:10: warning: cast removes address space '<asn:2>' of expression
48Waddress-space-all-attr.c:21:22: warning: cast removes address space '<asn:2>' of expression
49Waddress-space-all-attr.c:22:10: warning: cast removes address space '<asn:2>' of expression
50Waddress-space-all-attr.c:23:10: warning: cast removes address space '<asn:2>' of expression
51Waddress-space-all-attr.c:26:10: warning: cast removes address space '<asn:1>' of expression
52Waddress-space-all-attr.c:26:22: warning: cast removes address space '<asn:1>' of expression
53Waddress-space-all-attr.c:27:10: warning: cast removes address space '<asn:1>' of expression
54Waddress-space-all-attr.c:28:10: warning: cast removes address space '<asn:1>' of expression
55Waddress-space-all-attr.c:31:10: warning: cast removes address space '<asn:3>' of expression
56Waddress-space-all-attr.c:31:23: warning: cast removes address space '<asn:3>' of expression
57Waddress-space-all-attr.c:32:10: warning: cast removes address space '<asn:3>' of expression
58Waddress-space-all-attr.c:33:10: warning: cast removes address space '<asn:3>' of expression
59Waddress-space-all-attr.c:36:10: warning: cast removes address space '<asn:4>' of expression
60Waddress-space-all-attr.c:36:22: warning: cast removes address space '<asn:4>' of expression
61Waddress-space-all-attr.c:37:10: warning: cast removes address space '<asn:4>' of expression
62Waddress-space-all-attr.c:38:10: warning: cast removes address space '<asn:4>' of expression
63 * check-error-end
64 */
65