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