2011-05-30 Yao Qi <yao@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / cvexpr.c
CommitLineData
7b6bb8da 1/* Copyright (C) 2001, 2004, 2007, 2008, 2009, 2010, 2011
4c38e0a4 2Free 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
26char v_char;
27signed char v_signed_char;
28unsigned char v_unsigned_char;
29
30short v_short;
31signed short v_signed_short;
32unsigned short v_unsigned_short;
33
34int v_int;
35signed int v_signed_int;
36unsigned int v_unsigned_int;
37
38long v_long;
39signed long v_signed_long;
40unsigned long v_unsigned_long;
41
42long long v_long_long;
43signed long long v_signed_long_long;
44unsigned long long v_unsigned_long_long;
45
46float v_float;
47double 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
56char v_char_array[2];
57signed char v_signed_char_array[2];
58unsigned char v_unsigned_char_array[2];
59
60short v_short_array[2];
61signed short v_signed_short_array[2];
62unsigned short v_unsigned_short_array[2];
63
64int v_int_array[2];
65signed int v_signed_int_array[2];
66unsigned int v_unsigned_int_array[2];
67
68long v_long_array[2];
69signed long v_signed_long_array[2];
70unsigned long v_unsigned_long_array[2];
71
72float v_float_array[2];
73double v_double_array[2];
74
75/* PR 3742 */
76typedef char t_char_array[];
77
78/**** pointers *******/
79
80char *v_char_pointer;
81signed char *v_signed_char_pointer;
82unsigned char *v_unsigned_char_pointer;
83
84short *v_short_pointer;
85signed short *v_signed_short_pointer;
86unsigned short *v_unsigned_short_pointer;
87
88int *v_int_pointer;
89signed int *v_signed_int_pointer;
90unsigned int *v_unsigned_int_pointer;
91
92long *v_long_pointer;
93signed long *v_signed_long_pointer;
94unsigned long *v_unsigned_long_pointer;
95
96float *v_float_pointer;
97double *v_double_pointer;
98
99char **v_char_pointer_pointer;
100signed char **v_signed_char_pointer_pointer;
101unsigned char **v_unsigned_char_pointer_pointer;
102
103short **v_short_pointer_pointer;
104signed short **v_signed_short_pointer_pointer;
105unsigned short **v_unsigned_short_pointer_pointer;
106
107int **v_int_pointer_pointer;
108signed int **v_signed_int_pointer_pointer;
109unsigned int **v_unsigned_int_pointer_pointer;
110
111long **v_long_pointer_pointer;
112signed long **v_signed_long_pointer_pointer;
113unsigned long **v_unsigned_long_pointer_pointer;
114
115float **v_float_pointer_pointer;
116double **v_double_pointer_pointer;
117
118/**** pointers to arrays, arrays of pointers *******/
119
120char *v_char_array_pointer[2];
121signed char *v_signed_char_array_pointer[2];
122unsigned char *v_unsigned_char_array_pointer[2];
123
124short *v_short_array_pointer[2];
125signed short *v_signed_short_array_pointer[2];
126unsigned short *v_unsigned_short_array_pointer[2];
127
128int *v_int_array_pointer[2];
129signed int *v_signed_int_array_pointer[2];
130unsigned int *v_unsigned_int_array_pointer[2];
131
132long *v_long_array_pointer[2];
133signed long *v_signed_long_array_pointer[2];
134unsigned long *v_unsigned_long_array_pointer[2];
135
136float *v_float_array_pointer[2];
137double *v_double_array_pointer[2];
138
139char (*v_char_pointer_array)[2];
140signed char (*v_signed_char_pointer_array)[2];
141unsigned char (*v_unsigned_char_pointer_array)[2];
142
143short (*v_short_pointer_array)[2];
144signed short (*v_signed_short_pointer_array)[2];
145unsigned short (*v_unsigned_short_pointer_array)[2];
146
147int (*v_int_pointer_array)[2];
148signed int (*v_signed_int_pointer_array)[2];
149unsigned int (*v_unsigned_int_pointer_array)[2];
150
151long (*v_long_pointer_array)[2];
152signed long (*v_signed_long_pointer_array)[2];
153unsigned long (*v_unsigned_long_pointer_array)[2];
154
155float (*v_float_pointer_array)[2];
156double (*v_double_pointer_array)[2];
157
158
159/**** structs *******/
160
161struct 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
170struct t_struct *v_t_struct_p;
171
172struct {
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. */
182typedef 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. */
188t_struct3 v_struct3;
189
190/**** unions *******/
191
192union 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
201union {
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. */
211typedef 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. */
217t_union3 v_union3;
218
219/**** Enumerations *******/
220
221enum
222/* Work around the bug for compilers which don't put out the right stabs. */
223#if __GNUC__ < 2 && !defined (_AIX)
224primary1_tag
225#endif
226{red1, green1, blue1} primary1;
227
228enum {red, green, blue} primary;
229enum colors {yellow, purple, pink} nonprimary;
230
231enum {chevy, ford} clunker;
232enum cars {bmw, porsche} sportscar;
233
234#undef FALSE
235#undef TRUE
236typedef enum {FALSE, TRUE} boolean;
237boolean v_boolean;
238/*note: aCC has bool type predefined with 'false' and 'true'*/
239typedef enum bvals {my_false, my_true} boolean2;
240boolean2 v_boolean2;
241
242enum 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. */
246enum misordered v_misordered = three;
247
248/**** Function pointers *******/
249
250char (*v_char_func) (int, int*);
251signed char (*v_signed_char_func) (int, int*);
252unsigned char (*v_unsigned_char_func) (int, int*);
253
254short (*v_short_func) (int, int*);
255signed short (*v_signed_short_func) (int, int*);
256unsigned short (*v_unsigned_short_func) (int, int*);
257
258int (*v_int_func) (int, int*);
259signed int (*v_signed_int_func) (int, int*);
260unsigned int (*v_unsigned_int_func) (int, int*);
261
262long (*v_long_func) (int, int*);
263signed long (*v_signed_long_func) (int, int*);
264unsigned long (*v_unsigned_long_func) (int, int*);
265
266long long (*v_long_long_func) (int, int*);
267signed long long (*v_signed_long_long_func) (int, int*);
268unsigned long long (*v_unsigned_long_long_func) (int, int*);
269
270float (*v_float_func) (int, int*);
271double (*v_double_func) (int, int*);
272
e2004992
KB
273void use (void *p)
274{
275}
4749e309
MS
276
277int 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}
This page took 1.019934 seconds and 4 git commands to generate.