Commit | Line | Data |
---|---|---|
4c38e0a4 JB |
1 | /* Copyright (C) 2001, 2004, 2007, 2008, 2009, 2010 |
2 | Free Software Foundation, Inc. | |
4749e309 MS |
3 | |
4 | This program is free software; you can redistribute it and/or modify | |
5 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 6 | the Free Software Foundation; either version 3 of the License, or |
4749e309 MS |
7 | (at your option) any later version. |
8 | ||
9 | This program is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU General Public License for more details. | |
a9762ec7 | 13 | |
4749e309 | 14 | You should have received a copy of the GNU General Public License |
c7b778ff | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
4749e309 MS |
16 | |
17 | ||
18 | /* | |
19 | * Initial set of typed variables borrowed from ptype.c | |
20 | */ | |
21 | ||
22 | #if !defined (__STDC__) && !defined (_AIX) | |
23 | #define signed /**/ | |
24 | #endif | |
25 | ||
26 | char v_char; | |
27 | signed char v_signed_char; | |
28 | unsigned char v_unsigned_char; | |
29 | ||
30 | short v_short; | |
31 | signed short v_signed_short; | |
32 | unsigned short v_unsigned_short; | |
33 | ||
34 | int v_int; | |
35 | signed int v_signed_int; | |
36 | unsigned int v_unsigned_int; | |
37 | ||
38 | long v_long; | |
39 | signed long v_signed_long; | |
40 | unsigned long v_unsigned_long; | |
41 | ||
42 | long long v_long_long; | |
43 | signed long long v_signed_long_long; | |
44 | unsigned long long v_unsigned_long_long; | |
45 | ||
46 | float v_float; | |
47 | double v_double; | |
48 | ||
49 | /* | |
50 | * Now some derived types, which are arrays, functions-returning, | |
51 | * pointers, structures, unions, and enumerations. | |
52 | */ | |
53 | ||
54 | /**** arrays *******/ | |
55 | ||
56 | char v_char_array[2]; | |
57 | signed char v_signed_char_array[2]; | |
58 | unsigned char v_unsigned_char_array[2]; | |
59 | ||
60 | short v_short_array[2]; | |
61 | signed short v_signed_short_array[2]; | |
62 | unsigned short v_unsigned_short_array[2]; | |
63 | ||
64 | int v_int_array[2]; | |
65 | signed int v_signed_int_array[2]; | |
66 | unsigned int v_unsigned_int_array[2]; | |
67 | ||
68 | long v_long_array[2]; | |
69 | signed long v_signed_long_array[2]; | |
70 | unsigned long v_unsigned_long_array[2]; | |
71 | ||
72 | float v_float_array[2]; | |
73 | double v_double_array[2]; | |
74 | ||
75 | /* PR 3742 */ | |
76 | typedef char t_char_array[]; | |
77 | ||
78 | /**** pointers *******/ | |
79 | ||
80 | char *v_char_pointer; | |
81 | signed char *v_signed_char_pointer; | |
82 | unsigned char *v_unsigned_char_pointer; | |
83 | ||
84 | short *v_short_pointer; | |
85 | signed short *v_signed_short_pointer; | |
86 | unsigned short *v_unsigned_short_pointer; | |
87 | ||
88 | int *v_int_pointer; | |
89 | signed int *v_signed_int_pointer; | |
90 | unsigned int *v_unsigned_int_pointer; | |
91 | ||
92 | long *v_long_pointer; | |
93 | signed long *v_signed_long_pointer; | |
94 | unsigned long *v_unsigned_long_pointer; | |
95 | ||
96 | float *v_float_pointer; | |
97 | double *v_double_pointer; | |
98 | ||
99 | char **v_char_pointer_pointer; | |
100 | signed char **v_signed_char_pointer_pointer; | |
101 | unsigned char **v_unsigned_char_pointer_pointer; | |
102 | ||
103 | short **v_short_pointer_pointer; | |
104 | signed short **v_signed_short_pointer_pointer; | |
105 | unsigned short **v_unsigned_short_pointer_pointer; | |
106 | ||
107 | int **v_int_pointer_pointer; | |
108 | signed int **v_signed_int_pointer_pointer; | |
109 | unsigned int **v_unsigned_int_pointer_pointer; | |
110 | ||
111 | long **v_long_pointer_pointer; | |
112 | signed long **v_signed_long_pointer_pointer; | |
113 | unsigned long **v_unsigned_long_pointer_pointer; | |
114 | ||
115 | float **v_float_pointer_pointer; | |
116 | double **v_double_pointer_pointer; | |
117 | ||
118 | /**** pointers to arrays, arrays of pointers *******/ | |
119 | ||
120 | char *v_char_array_pointer[2]; | |
121 | signed char *v_signed_char_array_pointer[2]; | |
122 | unsigned char *v_unsigned_char_array_pointer[2]; | |
123 | ||
124 | short *v_short_array_pointer[2]; | |
125 | signed short *v_signed_short_array_pointer[2]; | |
126 | unsigned short *v_unsigned_short_array_pointer[2]; | |
127 | ||
128 | int *v_int_array_pointer[2]; | |
129 | signed int *v_signed_int_array_pointer[2]; | |
130 | unsigned int *v_unsigned_int_array_pointer[2]; | |
131 | ||
132 | long *v_long_array_pointer[2]; | |
133 | signed long *v_signed_long_array_pointer[2]; | |
134 | unsigned long *v_unsigned_long_array_pointer[2]; | |
135 | ||
136 | float *v_float_array_pointer[2]; | |
137 | double *v_double_array_pointer[2]; | |
138 | ||
139 | char (*v_char_pointer_array)[2]; | |
140 | signed char (*v_signed_char_pointer_array)[2]; | |
141 | unsigned char (*v_unsigned_char_pointer_array)[2]; | |
142 | ||
143 | short (*v_short_pointer_array)[2]; | |
144 | signed short (*v_signed_short_pointer_array)[2]; | |
145 | unsigned short (*v_unsigned_short_pointer_array)[2]; | |
146 | ||
147 | int (*v_int_pointer_array)[2]; | |
148 | signed int (*v_signed_int_pointer_array)[2]; | |
149 | unsigned int (*v_unsigned_int_pointer_array)[2]; | |
150 | ||
151 | long (*v_long_pointer_array)[2]; | |
152 | signed long (*v_signed_long_pointer_array)[2]; | |
153 | unsigned long (*v_unsigned_long_pointer_array)[2]; | |
154 | ||
155 | float (*v_float_pointer_array)[2]; | |
156 | double (*v_double_pointer_array)[2]; | |
157 | ||
158 | ||
159 | /**** structs *******/ | |
160 | ||
161 | struct t_struct { | |
162 | char v_char_member; | |
163 | short v_short_member; | |
164 | int v_int_member; | |
165 | long v_long_member; | |
166 | float v_float_member; | |
167 | double v_double_member; | |
168 | } v_struct1; | |
169 | ||
170 | struct t_struct *v_t_struct_p; | |
171 | ||
172 | struct { | |
173 | char v_char_member; | |
174 | short v_short_member; | |
175 | int v_int_member; | |
176 | long v_long_member; | |
177 | float v_float_member; | |
178 | double v_double_member; | |
179 | } v_struct2; | |
180 | ||
181 | /* typedef'd struct without a tag. */ | |
182 | typedef struct { | |
183 | double v_double_member; | |
184 | int v_int_member; | |
185 | } t_struct3; | |
186 | /* GCC seems to want a variable of this type, or else it won't put out | |
187 | a symbol. */ | |
188 | t_struct3 v_struct3; | |
189 | ||
190 | /**** unions *******/ | |
191 | ||
192 | union t_union { | |
193 | char v_char_member; | |
194 | short v_short_member; | |
195 | int v_int_member; | |
196 | long v_long_member; | |
197 | float v_float_member; | |
198 | double v_double_member; | |
199 | } v_union; | |
200 | ||
201 | union { | |
202 | char v_char_member; | |
203 | short v_short_member; | |
204 | int v_int_member; | |
205 | long v_long_member; | |
206 | float v_float_member; | |
207 | double v_double_member; | |
208 | } v_union2; | |
209 | ||
210 | /* typedef'd union without a tag. */ | |
211 | typedef union { | |
212 | double v_double_member; | |
213 | int v_int_member; | |
214 | } t_union3; | |
215 | /* GCC seems to want a variable of this type, or else it won't put out | |
216 | a symbol. */ | |
217 | t_union3 v_union3; | |
218 | ||
219 | /**** Enumerations *******/ | |
220 | ||
221 | enum | |
222 | /* Work around the bug for compilers which don't put out the right stabs. */ | |
223 | #if __GNUC__ < 2 && !defined (_AIX) | |
224 | primary1_tag | |
225 | #endif | |
226 | {red1, green1, blue1} primary1; | |
227 | ||
228 | enum {red, green, blue} primary; | |
229 | enum colors {yellow, purple, pink} nonprimary; | |
230 | ||
231 | enum {chevy, ford} clunker; | |
232 | enum cars {bmw, porsche} sportscar; | |
233 | ||
234 | #undef FALSE | |
235 | #undef TRUE | |
236 | typedef enum {FALSE, TRUE} boolean; | |
237 | boolean v_boolean; | |
238 | /*note: aCC has bool type predefined with 'false' and 'true'*/ | |
239 | typedef enum bvals {my_false, my_true} boolean2; | |
240 | boolean2 v_boolean2; | |
241 | ||
242 | enum misordered {two = 2, one = 1, zero = 0, three = 3}; | |
243 | ||
244 | /* Seems like we need a variable of this type to get the type to be put | |
245 | in the executable, at least for AIX xlc. */ | |
246 | enum misordered v_misordered = three; | |
247 | ||
248 | /**** Function pointers *******/ | |
249 | ||
250 | char (*v_char_func) (int, int*); | |
251 | signed char (*v_signed_char_func) (int, int*); | |
252 | unsigned char (*v_unsigned_char_func) (int, int*); | |
253 | ||
254 | short (*v_short_func) (int, int*); | |
255 | signed short (*v_signed_short_func) (int, int*); | |
256 | unsigned short (*v_unsigned_short_func) (int, int*); | |
257 | ||
258 | int (*v_int_func) (int, int*); | |
259 | signed int (*v_signed_int_func) (int, int*); | |
260 | unsigned int (*v_unsigned_int_func) (int, int*); | |
261 | ||
262 | long (*v_long_func) (int, int*); | |
263 | signed long (*v_signed_long_func) (int, int*); | |
264 | unsigned long (*v_unsigned_long_func) (int, int*); | |
265 | ||
266 | long long (*v_long_long_func) (int, int*); | |
267 | signed long long (*v_signed_long_long_func) (int, int*); | |
268 | unsigned long long (*v_unsigned_long_long_func) (int, int*); | |
269 | ||
270 | float (*v_float_func) (int, int*); | |
271 | double (*v_double_func) (int, int*); | |
272 | ||
e2004992 KB |
273 | void use (void *p) |
274 | { | |
275 | } | |
4749e309 MS |
276 | |
277 | int main () | |
278 | { | |
e2004992 KB |
279 | use (&v_char); |
280 | use (&v_signed_char); | |
281 | use (&v_unsigned_char); | |
282 | ||
283 | use (&v_short); | |
284 | use (&v_signed_short); | |
285 | use (&v_unsigned_short); | |
286 | ||
287 | use (&v_int); | |
288 | use (&v_signed_int); | |
289 | use (&v_unsigned_int); | |
290 | ||
291 | use (&v_long); | |
292 | use (&v_signed_long); | |
293 | use (&v_unsigned_long); | |
294 | ||
295 | use (&v_long_long); | |
296 | use (&v_signed_long_long); | |
297 | use (&v_unsigned_long_long); | |
298 | ||
299 | use (&v_float); | |
300 | use (&v_double); | |
301 | ||
302 | use (v_char_array); | |
303 | use (v_signed_char_array); | |
304 | use (v_unsigned_char_array); | |
305 | ||
306 | use (v_short_array); | |
307 | use (v_signed_short_array); | |
308 | use (v_unsigned_short_array); | |
309 | ||
310 | use (v_int_array); | |
311 | use (v_signed_int_array); | |
312 | use (v_unsigned_int_array); | |
313 | ||
314 | use (v_long_array); | |
315 | use (v_signed_long_array); | |
316 | use (v_unsigned_long_array); | |
317 | ||
318 | use (v_float_array); | |
319 | use (v_double_array); | |
320 | ||
321 | use (v_char_pointer); | |
322 | use (v_signed_char_pointer); | |
323 | use (v_unsigned_char_pointer); | |
324 | ||
325 | use (v_short_pointer); | |
326 | use (v_signed_short_pointer); | |
327 | use (v_unsigned_short_pointer); | |
328 | ||
329 | use (v_int_pointer); | |
330 | use (v_signed_int_pointer); | |
331 | use (v_unsigned_int_pointer); | |
332 | ||
333 | use (v_long_pointer); | |
334 | use (v_signed_long_pointer); | |
335 | use (v_unsigned_long_pointer); | |
336 | ||
337 | use (v_float_pointer); | |
338 | use (v_double_pointer); | |
339 | ||
340 | use (v_char_pointer_pointer); | |
341 | use (v_signed_char_pointer_pointer); | |
342 | use (v_unsigned_char_pointer_pointer); | |
343 | ||
344 | use (v_short_pointer_pointer); | |
345 | use (v_signed_short_pointer_pointer); | |
346 | use (v_unsigned_short_pointer_pointer); | |
347 | ||
348 | use (v_int_pointer_pointer); | |
349 | use (v_signed_int_pointer_pointer); | |
350 | use (v_unsigned_int_pointer_pointer); | |
351 | ||
352 | use (v_long_pointer_pointer); | |
353 | use (v_signed_long_pointer_pointer); | |
354 | use (v_unsigned_long_pointer_pointer); | |
355 | ||
356 | use (v_float_pointer_pointer); | |
357 | use (v_double_pointer_pointer); | |
358 | ||
359 | use (v_char_array_pointer); | |
360 | use (v_signed_char_array_pointer); | |
361 | use (v_unsigned_char_array_pointer); | |
362 | ||
363 | use (v_short_array_pointer); | |
364 | use (v_signed_short_array_pointer); | |
365 | use (v_unsigned_short_array_pointer); | |
366 | ||
367 | use (v_int_array_pointer); | |
368 | use (v_signed_int_array_pointer); | |
369 | use (v_unsigned_int_array_pointer); | |
370 | ||
371 | use (v_long_array_pointer); | |
372 | use (v_signed_long_array_pointer); | |
373 | use (v_unsigned_long_array_pointer); | |
374 | ||
375 | use (v_float_array_pointer); | |
376 | use (v_double_array_pointer); | |
377 | ||
378 | use (v_char_pointer_array); | |
379 | use (v_signed_char_pointer_array); | |
380 | use (v_unsigned_char_pointer_array); | |
381 | ||
382 | use (v_short_pointer_array); | |
383 | use (v_signed_short_pointer_array); | |
384 | use (v_unsigned_short_pointer_array); | |
385 | ||
386 | use (v_int_pointer_array); | |
387 | use (v_signed_int_pointer_array); | |
388 | use (v_unsigned_int_pointer_array); | |
389 | ||
390 | use (v_long_pointer_array); | |
391 | use (v_signed_long_pointer_array); | |
392 | use (v_unsigned_long_pointer_array); | |
393 | ||
394 | use (v_float_pointer_array); | |
395 | use (v_double_pointer_array); | |
396 | ||
397 | use (&v_struct1); | |
398 | use (&v_struct2); | |
399 | use (&v_struct3); | |
400 | ||
401 | use (&v_union); | |
402 | use (&v_union2); | |
403 | use (&v_union3); | |
404 | ||
405 | use (&v_boolean); | |
406 | use (&v_boolean2); | |
407 | use (&v_misordered); | |
408 | ||
eca3e36b MC |
409 | use (&v_char_func); |
410 | use (&v_signed_char_func); | |
411 | use (&v_unsigned_char_func); | |
e2004992 | 412 | |
eca3e36b MC |
413 | use (&v_short_func); |
414 | use (&v_signed_short_func); | |
415 | use (&v_unsigned_short_func); | |
e2004992 | 416 | |
eca3e36b MC |
417 | use (&v_int_func); |
418 | use (&v_signed_int_func); | |
419 | use (&v_unsigned_int_func); | |
e2004992 | 420 | |
eca3e36b MC |
421 | use (&v_long_func); |
422 | use (&v_signed_long_func); | |
423 | use (&v_unsigned_long_func); | |
e2004992 | 424 | |
eca3e36b MC |
425 | use (&v_long_long_func); |
426 | use (&v_signed_long_long_func); | |
427 | use (&v_unsigned_long_long_func); | |
e2004992 | 428 | |
eca3e36b MC |
429 | use (&v_float_func); |
430 | use (&v_double_func); | |
4749e309 | 431 | } |