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