1 /* This test program is part of GDB, the GNU debugger.
3 Copyright 1992, 1993, 1994, 1997, 1999, 2004
4 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * Test file with lots of different types, for testing the
27 * First the basic C types.
31 signed char v_signed_char
;
32 unsigned char v_unsigned_char
;
35 signed short v_signed_short
;
36 unsigned short v_unsigned_short
;
39 signed int v_signed_int
;
40 unsigned int v_unsigned_int
;
43 signed long v_signed_long
;
44 unsigned long v_unsigned_long
;
50 * Now some derived types, which are arrays, functions-returning,
51 * pointers, structures, unions, and enumerations.
57 signed char v_signed_char_array
[2];
58 unsigned char v_unsigned_char_array
[2];
60 short v_short_array
[2];
61 signed short v_signed_short_array
[2];
62 unsigned short v_unsigned_short_array
[2];
65 signed int v_signed_int_array
[2];
66 unsigned int v_unsigned_int_array
[2];
69 signed long v_signed_long_array
[2];
70 unsigned long v_unsigned_long_array
[2];
72 float v_float_array
[2];
73 double v_double_array
[2];
75 /**** pointers *******/
77 /* Make sure they still print as pointer to foo even there is a typedef
78 for that type. Test this not just for char *, which might be
79 a special case kludge in GDB (Unix system include files like to define
80 caddr_t), but for a variety of types. */
81 typedef char *char_addr
;
82 static char_addr a_char_addr
;
83 typedef unsigned short *ushort_addr
;
84 static ushort_addr a_ushort_addr
;
85 typedef signed long *slong_addr
;
86 static slong_addr a_slong_addr
;
89 signed char *v_signed_char_pointer
;
90 unsigned char *v_unsigned_char_pointer
;
92 short *v_short_pointer
;
93 signed short *v_signed_short_pointer
;
94 unsigned short *v_unsigned_short_pointer
;
97 signed int *v_signed_int_pointer
;
98 unsigned int *v_unsigned_int_pointer
;
100 long *v_long_pointer
;
101 signed long *v_signed_long_pointer
;
102 unsigned long *v_unsigned_long_pointer
;
104 float *v_float_pointer
;
105 double *v_double_pointer
;
107 /**** structs *******/
111 short v_short_member
;
114 float v_float_member
;
115 double v_double_member
;
120 short v_short_member
;
123 float v_float_member
;
124 double v_double_member
;
127 /**** unions *******/
131 short v_short_member
;
134 float v_float_member
;
135 double v_double_member
;
140 short v_short_member
;
143 float v_float_member
;
144 double v_double_member
;
147 /*** Functions returning type ********/
149 char v_char_func () { return(0); }
150 signed char v_signed_char_func () { return (0); }
151 unsigned char v_unsigned_char_func () { return (0); }
153 short v_short_func () { return (0); }
154 signed short v_signed_short_func () { return (0); }
155 unsigned short v_unsigned_short_func () { return (0); }
157 int v_int_func () { return (0); }
158 signed int v_signed_int_func () { return (0); }
159 unsigned int v_unsigned_int_func () { return (0); }
161 long v_long_func () { return (0); }
162 signed long v_signed_long_func () { return (0); }
163 unsigned long v_unsigned_long_func () { return (0); }
165 float v_float_func () { return (0.0); }
166 double v_double_func () { return (0.0); }
168 /**** Some misc more complicated things *******/
173 struct link
*(*linkfunc
) (struct link
*this, int flags
);
175 struct link
*(*linkfunc
) ();
177 struct t_struct stuff
[1][2][3];
183 struct link
*(*linkfunc
) (struct link
*this, int flags
);
185 struct link
*(*linkfunc
) ();
187 struct t_struct stuff
[1][2][3];
190 struct outer_struct
{
192 struct inner_struct
{
195 }inner_struct_instance
;
198 long inner_union_long
;
199 }inner_union_instance
;
203 /**** Enumerations *******/
205 enum colors
{red
, green
, blue
} color
;
206 enum cars
{chevy
, ford
, porsche
} clunker
;
216 /* Some linkers (e.g. on AIX) remove unreferenced variables,
217 so make sure to reference them. */
224 v_unsigned_short
= 5;
232 v_unsigned_long
= 11;
238 v_char_array
[0] = v_char
;
239 v_signed_char_array
[0] = v_signed_char
;
240 v_unsigned_char_array
[0] = v_unsigned_char
;
242 v_short_array
[0] = v_short
;
243 v_signed_short_array
[0] = v_signed_short
;
244 v_unsigned_short_array
[0] = v_unsigned_short
;
246 v_int_array
[0] = v_int
;
247 v_signed_int_array
[0] = v_signed_int
;
248 v_unsigned_int_array
[0] = v_unsigned_int
;
250 v_long_array
[0] = v_long
;
251 v_signed_long_array
[0] = v_signed_long
;
252 v_unsigned_long_array
[0] = v_unsigned_long
;
254 v_float_array
[0] = v_float
;
255 v_double_array
[0] = v_double
;
257 v_char_pointer
= &v_char
;
258 v_signed_char_pointer
= &v_signed_char
;
259 v_unsigned_char_pointer
= &v_unsigned_char
;
261 v_short_pointer
= &v_short
;
262 v_signed_short_pointer
= &v_signed_short
;
263 v_unsigned_short_pointer
= &v_unsigned_short
;
265 v_int_pointer
= &v_int
;
266 v_signed_int_pointer
= &v_signed_int
;
267 v_unsigned_int_pointer
= &v_unsigned_int
;
269 v_long_pointer
= &v_long
;
270 v_signed_long_pointer
= &v_signed_long
;
271 v_unsigned_long_pointer
= &v_unsigned_long
;
273 v_float_pointer
= &v_float
;
274 v_double_pointer
= &v_double
;
279 u_link
.next
= s_link
;
281 v_union2
.v_short_member
= v_union
.v_short_member
;
283 v_struct1
.v_char_member
= 0;
284 v_struct2
.v_char_member
= 0;
286 nested_su
.outer_int
= 0;