param_key: fix container of when no struct member is referenced
[smatch.git] / validation / type-compare.c
blob1adcd7040f3560e17c210a1f2cd839e67df53a90
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))
7 int test(void)
9 if ([int] != [int]) return 1;
10 if (!([int] == [int])) return 1;
12 if ([int] == [long]) return 1;
13 if (!([int] != [long])) return 1;
15 if ([int] == [unsigned int]) return 1;
16 if (!([int] != [unsigned int])) return 1;
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;
23 if ([char] > [short]) return 1;
24 if ([short] < [char]) return 1;
25 if (!([char] <= [short])) return 1;
26 if (!([short] >= [char])) return 1;
28 if ([short] > [int]) return 1;
29 if ([int] < [short]) return 1;
30 if (!([short] <= [int])) return 1;
31 if (!([int] >= [short])) return 1;
33 if ([int] > [long]) return 1;
34 if ([long] < [int]) return 1;
35 if (!([int] <= [long])) return 1;
36 if (!([long] >= [int])) return 1;
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;
43 if ([int *] != [int *]) return 1;
44 if ([int *] == [void *]) return 1;
46 // qualifiers are ignored
47 if ([int] != [const int]) return 1;
48 if ([int] != [volatile int]) return 1;
50 // but others modifiers are significant
51 if ([int] == [int __nocast]) return 1;
52 if ([int] == [int __bitwise]) return 1;
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;
63 return 0;
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
75 * check-output-contains: ret\\..*\\$0