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