1 /* This test program is part of GDB, the GNU debugger.
3 Copyright 1992-2013 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * Test file with lots of different types, for testing the
25 * First the basic C types.
29 signed char v_signed_char
;
30 unsigned char v_unsigned_char
;
33 signed short v_signed_short
;
34 unsigned short v_unsigned_short
;
37 signed int v_signed_int
;
38 unsigned int v_unsigned_int
;
41 signed long v_signed_long
;
42 unsigned long v_unsigned_long
;
45 long long v_long_long
;
46 signed long long v_signed_long_long
;
47 unsigned long long v_unsigned_long_long
;
54 * Now some derived types, which are arrays, functions-returning,
55 * pointers, structures, unions, and enumerations.
61 signed char v_signed_char_array
[2];
62 unsigned char v_unsigned_char_array
[2];
64 short v_short_array
[2];
65 signed short v_signed_short_array
[2];
66 unsigned short v_unsigned_short_array
[2];
69 signed int v_signed_int_array
[2];
70 unsigned int v_unsigned_int_array
[2];
73 signed long v_signed_long_array
[2];
74 unsigned long v_unsigned_long_array
[2];
77 long long v_long_long_array
[2];
78 signed long long v_signed_long_long_array
[2];
79 unsigned long long v_unsigned_long_long_array
[2];
82 float v_float_array
[2];
83 double v_double_array
[2];
85 /**** pointers *******/
87 /* Make sure they still print as pointer to foo even there is a typedef
88 for that type. Test this not just for char *, which might be
89 a special case kludge in GDB (Unix system include files like to define
90 caddr_t), but for a variety of types. */
91 typedef char *char_addr
;
92 static char_addr a_char_addr
;
93 typedef unsigned short *ushort_addr
;
94 static ushort_addr a_ushort_addr
;
95 typedef signed long *slong_addr
;
96 static slong_addr a_slong_addr
;
98 typedef signed long long *slong_long_addr
;
99 static slong_long_addr a_slong_long_addr
;
102 char *v_char_pointer
;
103 signed char *v_signed_char_pointer
;
104 unsigned char *v_unsigned_char_pointer
;
106 short *v_short_pointer
;
107 signed short *v_signed_short_pointer
;
108 unsigned short *v_unsigned_short_pointer
;
111 signed int *v_signed_int_pointer
;
112 unsigned int *v_unsigned_int_pointer
;
114 long *v_long_pointer
;
115 signed long *v_signed_long_pointer
;
116 unsigned long *v_unsigned_long_pointer
;
119 long long *v_long_long_pointer
;
120 signed long long *v_signed_long_long_pointer
;
121 unsigned long long *v_unsigned_long_long_pointer
;
124 float *v_float_pointer
;
125 double *v_double_pointer
;
127 /**** structs *******/
131 short v_short_member
;
135 long long v_long_long_member
;
137 float v_float_member
;
138 double v_double_member
;
143 short v_short_member
;
147 long long v_long_long_member
;
149 float v_float_member
;
150 double v_double_member
;
153 /**** unions *******/
157 short v_short_member
;
161 long long v_long_long_member
;
163 float v_float_member
;
164 double v_double_member
;
169 short v_short_member
;
173 long long v_long_long_member
;
175 float v_float_member
;
176 double v_double_member
;
179 /*** Functions returning type ********/
181 char v_char_func () { return(0); }
182 signed char v_signed_char_func () { return (0); }
183 unsigned char v_unsigned_char_func () { return (0); }
185 short v_short_func () { return (0); }
186 signed short v_signed_short_func () { return (0); }
187 unsigned short v_unsigned_short_func () { return (0); }
189 int v_int_func () { return (0); }
190 signed int v_signed_int_func () { return (0); }
191 unsigned int v_unsigned_int_func () { return (0); }
193 long v_long_func () { return (0); }
194 signed long v_signed_long_func () { return (0); }
195 unsigned long v_unsigned_long_func () { return (0); }
198 long long v_long_long_func () { return (0); }
199 signed long long v_signed_long_long_func () { return (0); }
200 unsigned long long v_unsigned_long_long_func () { return (0); }
203 float v_float_func () { return (0.0); }
204 double v_double_func () { return (0.0); }
206 /**** Some misc more complicated things *******/
211 struct link
*(*linkfunc
) (struct link
*this, int flags
);
213 struct link
*(*linkfunc
) ();
215 struct t_struct stuff
[1][2][3];
221 struct link
*(*linkfunc
) (struct link
*this, int flags
);
223 struct link
*(*linkfunc
) ();
225 struct t_struct stuff
[1][2][3];
228 struct outer_struct
{
230 struct inner_struct
{
233 }inner_struct_instance
;
236 long inner_union_long
;
237 }inner_union_instance
;
241 /**** Enumerations *******/
243 enum colors
{red
, green
, blue
} color
;
244 enum cars
{chevy
, ford
, porsche
} clunker
;
250 /* Some linkers (e.g. on AIX) remove unreferenced variables,
251 so make sure to reference them. */
258 v_unsigned_short
= 5;
266 v_unsigned_long
= 11;
270 v_signed_long_long
= 13;
271 v_unsigned_long_long
= 14;
278 v_char_array
[0] = v_char
;
279 v_signed_char_array
[0] = v_signed_char
;
280 v_unsigned_char_array
[0] = v_unsigned_char
;
282 v_short_array
[0] = v_short
;
283 v_signed_short_array
[0] = v_signed_short
;
284 v_unsigned_short_array
[0] = v_unsigned_short
;
286 v_int_array
[0] = v_int
;
287 v_signed_int_array
[0] = v_signed_int
;
288 v_unsigned_int_array
[0] = v_unsigned_int
;
290 v_long_array
[0] = v_long
;
291 v_signed_long_array
[0] = v_signed_long
;
292 v_unsigned_long_array
[0] = v_unsigned_long
;
295 v_long_long_array
[0] = v_long_long
;
296 v_signed_long_long_array
[0] = v_signed_long_long
;
297 v_unsigned_long_long_array
[0] = v_unsigned_long_long
;
300 v_float_array
[0] = v_float
;
301 v_double_array
[0] = v_double
;
303 v_char_pointer
= &v_char
;
304 v_signed_char_pointer
= &v_signed_char
;
305 v_unsigned_char_pointer
= &v_unsigned_char
;
307 v_short_pointer
= &v_short
;
308 v_signed_short_pointer
= &v_signed_short
;
309 v_unsigned_short_pointer
= &v_unsigned_short
;
311 v_int_pointer
= &v_int
;
312 v_signed_int_pointer
= &v_signed_int
;
313 v_unsigned_int_pointer
= &v_unsigned_int
;
315 v_long_pointer
= &v_long
;
316 v_signed_long_pointer
= &v_signed_long
;
317 v_unsigned_long_pointer
= &v_unsigned_long
;
320 v_long_long_pointer
= &v_long_long
;
321 v_signed_long_long_pointer
= &v_signed_long_long
;
322 v_unsigned_long_long_pointer
= &v_unsigned_long_long
;
325 v_float_pointer
= &v_float
;
326 v_double_pointer
= &v_double
;
331 u_link
.next
= s_link
;
333 v_union2
.v_short_member
= v_union
.v_short_member
;
335 v_struct1
.v_char_member
= 0;
336 v_struct2
.v_char_member
= 0;
338 nested_su
.outer_int
= 0;