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