1 #define __user		__attribute__((address_space(1)))
2 #define __safe		__attribute__((safe))
3 #define __nocast	__attribute__((nocast))
4 #define __bitwise	__attribute__((bitwise))
5 #define __noderef	__attribute__((noderef))
6 
test(void)7 int test(void)
8 {
9 	if ([int] != [int]) return 1;
10 	if (!([int] == [int])) return 1;
11 
12 	if ([int] == [long]) return 1;
13 	if (!([int] != [long])) return 1;
14 
15 	if ([int] == [unsigned int]) return 1;
16 	if (!([int] != [unsigned int])) return 1;
17 
18 	if ([int] != [int]) return 1;
19 	if ([typeof(int)] != [int]) return 1;
20 	if ([int] != [typeof(int)]) return 1;
21 	if ([typeof(int)] != [typeof(int)]) return 1;
22 
23 	if ([char] > [short]) return 1;
24 	if ([short] < [char]) return 1;
25 	if (!([char] <= [short])) return 1;
26 	if (!([short] >= [char])) return 1;
27 
28 	if ([short] > [int]) return 1;
29 	if ([int] < [short]) return 1;
30 	if (!([short] <= [int])) return 1;
31 	if (!([int] >= [short])) return 1;
32 
33 	if ([int] > [long]) return 1;
34 	if ([long] < [int]) return 1;
35 	if (!([int] <= [long])) return 1;
36 	if (!([long] >= [int])) return 1;
37 
38 	if ([long] > [long long]) return 1;
39 	if ([long long] < [long]) return 1;
40 	if (!([long] <= [long long])) return 1;
41 	if (!([long long] >= [long])) return 1;
42 
43 	if ([int *] != [int *]) return 1;
44 	if ([int *] == [void *]) return 1;
45 
46 	// qualifiers are ignored
47 	if ([int] != [const int]) return 1;
48 	if ([int] != [volatile int]) return 1;
49 
50 	// but others modifiers are significant
51 	if ([int] == [int __nocast]) return 1;
52 	if ([int] == [int __bitwise]) return 1;
53 
54 	//
55 	if ([int *] == [const int *]) return 1;
56 	if ([int *] == [volatile int *]) return 1;
57 	if ([int *] == [int __user *]) return 1;
58 	if ([int *] == [int __safe *]) return 1;
59 	if ([int *] == [int __nocast *]) return 1;
60 	if ([int *] == [int __bitwise *]) return 1;
61 	if ([int *] == [int __noderef *]) return 1;
62 
63 	return 0;
64 }
65 
66 /*
67  * check-name: type-as-first-class comparison
68  * check-description: This test the sparse extension making
69  *	types first class citizens which can be compared
70  *	for equality (or size for <, >, <=, >=).
71  *	See expand.c:compare_types().
72  * check-command: test-linearize -Wno-decl $file
73  * check-output-ignore
74  *
75  * check-output-contains: ret\\..*\\$0
76  */
77