db/fixup_kernel.sh: fix clear_user() handling
[smatch.git] / validation / generic-typename.c
blob1e914c5768b3678807ce21682cd707041e655f39
1 #define typename(x) _Generic((x) 0, \
2 _Bool: "_Bool", \
3 char: "char", \
4 unsigned char: "unsigned char", \
5 short: "short", \
6 unsigned short: "unsigned short", \
7 int: "int", \
8 unsigned int: "unsigned int", \
9 long: "long", \
10 unsigned long: "unsigned long", \
11 long long: "long long", \
12 unsigned long long: "unsigned long long", \
13 float: "float", \
14 double: "double", \
15 long double: "long double", \
16 void *: "void *", \
17 char *: "char *", \
18 int *: "int *", \
19 default: "???")
21 #define TEST(name, x) \
22 static const char *test_ ## name(void) { return typename(x); }
24 TEST(bool, _Bool)
25 TEST(char, char)
26 TEST(uchar, unsigned char)
27 TEST(short, short)
28 TEST(ushort, unsigned short)
29 TEST(int, int)
30 TEST(uint, unsigned int)
31 TEST(long, long)
32 TEST(ulong, unsigned long)
33 TEST(llong, long long)
34 TEST(ullong, unsigned long long)
35 TEST(float, float)
36 TEST(double, double)
37 TEST(ldouble, long double)
38 TEST(vptr, void *)
39 TEST(cptr, char *)
40 TEST(iptr, int *)
41 TEST(int128, __int128)
44 * check-name: generic-typename
45 * check-command: test-linearize --arch=i386 -fsigned-char $file
47 * check-output-start
48 test_bool:
49 .L0:
50 <entry-point>
51 ret.32 "_Bool"
54 test_char:
55 .L2:
56 <entry-point>
57 ret.32 "char"
60 test_uchar:
61 .L4:
62 <entry-point>
63 ret.32 "unsigned char"
66 test_short:
67 .L6:
68 <entry-point>
69 ret.32 "short"
72 test_ushort:
73 .L8:
74 <entry-point>
75 ret.32 "unsigned short"
78 test_int:
79 .L10:
80 <entry-point>
81 ret.32 "int"
84 test_uint:
85 .L12:
86 <entry-point>
87 ret.32 "unsigned int"
90 test_long:
91 .L14:
92 <entry-point>
93 ret.32 "long"
96 test_ulong:
97 .L16:
98 <entry-point>
99 ret.32 "unsigned long"
102 test_llong:
103 .L18:
104 <entry-point>
105 ret.32 "long long"
108 test_ullong:
109 .L20:
110 <entry-point>
111 ret.32 "unsigned long long"
114 test_float:
115 .L22:
116 <entry-point>
117 ret.32 "float"
120 test_double:
121 .L24:
122 <entry-point>
123 ret.32 "double"
126 test_ldouble:
127 .L26:
128 <entry-point>
129 ret.32 "long double"
132 test_vptr:
133 .L28:
134 <entry-point>
135 ret.32 "void *"
138 test_cptr:
139 .L30:
140 <entry-point>
141 ret.32 "char *"
144 test_iptr:
145 .L32:
146 <entry-point>
147 ret.32 "int *"
150 test_int128:
151 .L34:
152 <entry-point>
153 ret.32 "???"
156 * check-output-end