1 /* This test program is part of GDB, the GNU debugger.
3 Copyright 1992, 1993, 1994, 1997, 1999, 2004, 2007
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 3 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, see <http://www.gnu.org/licenses/>.
21 * Test file with lots of different types, for testing the
26 * First the basic C types.
30 signed char v_signed_char
;
31 unsigned char v_unsigned_char
;
34 signed short v_signed_short
;
35 unsigned short v_unsigned_short
;
38 signed int v_signed_int
;
39 unsigned int v_unsigned_int
;
42 signed long v_signed_long
;
43 unsigned long v_unsigned_long
;
49 * Now some derived types, which are arrays, functions-returning,
50 * pointers, structures, unions, and enumerations.
56 signed char v_signed_char_array
[2];
57 unsigned char v_unsigned_char_array
[2];
59 short v_short_array
[2];
60 signed short v_signed_short_array
[2];
61 unsigned short v_unsigned_short_array
[2];
64 signed int v_signed_int_array
[2];
65 unsigned int v_unsigned_int_array
[2];
68 signed long v_signed_long_array
[2];
69 unsigned long v_unsigned_long_array
[2];
71 float v_float_array
[2];
72 double v_double_array
[2];
74 /**** pointers *******/
76 /* Make sure they still print as pointer to foo even there is a typedef
77 for that type. Test this not just for char *, which might be
78 a special case kludge in GDB (Unix system include files like to define
79 caddr_t), but for a variety of types. */
80 typedef char *char_addr
;
81 static char_addr a_char_addr
;
82 typedef unsigned short *ushort_addr
;
83 static ushort_addr a_ushort_addr
;
84 typedef signed long *slong_addr
;
85 static slong_addr a_slong_addr
;
88 signed char *v_signed_char_pointer
;
89 unsigned char *v_unsigned_char_pointer
;
91 short *v_short_pointer
;
92 signed short *v_signed_short_pointer
;
93 unsigned short *v_unsigned_short_pointer
;
96 signed int *v_signed_int_pointer
;
97 unsigned int *v_unsigned_int_pointer
;
100 signed long *v_signed_long_pointer
;
101 unsigned long *v_unsigned_long_pointer
;
103 float *v_float_pointer
;
104 double *v_double_pointer
;
106 /**** structs *******/
110 short v_short_member
;
113 float v_float_member
;
114 double v_double_member
;
119 short v_short_member
;
122 float v_float_member
;
123 double v_double_member
;
126 /**** unions *******/
130 short v_short_member
;
133 float v_float_member
;
134 double v_double_member
;
139 short v_short_member
;
142 float v_float_member
;
143 double v_double_member
;
146 /*** Functions returning type ********/
148 char v_char_func () { return(0); }
149 signed char v_signed_char_func () { return (0); }
150 unsigned char v_unsigned_char_func () { return (0); }
152 short v_short_func () { return (0); }
153 signed short v_signed_short_func () { return (0); }
154 unsigned short v_unsigned_short_func () { return (0); }
156 int v_int_func () { return (0); }
157 signed int v_signed_int_func () { return (0); }
158 unsigned int v_unsigned_int_func () { return (0); }
160 long v_long_func () { return (0); }
161 signed long v_signed_long_func () { return (0); }
162 unsigned long v_unsigned_long_func () { return (0); }
164 float v_float_func () { return (0.0); }
165 double v_double_func () { return (0.0); }
167 /**** Some misc more complicated things *******/
172 struct link
*(*linkfunc
) (struct link
*this, int flags
);
174 struct link
*(*linkfunc
) ();
176 struct t_struct stuff
[1][2][3];
182 struct link
*(*linkfunc
) (struct link
*this, int flags
);
184 struct link
*(*linkfunc
) ();
186 struct t_struct stuff
[1][2][3];
189 struct outer_struct
{
191 struct inner_struct
{
194 }inner_struct_instance
;
197 long inner_union_long
;
198 }inner_union_instance
;
202 /**** Enumerations *******/
204 enum colors
{red
, green
, blue
} color
;
205 enum cars
{chevy
, ford
, porsche
} clunker
;
215 /* Some linkers (e.g. on AIX) remove unreferenced variables,
216 so make sure to reference them. */
223 v_unsigned_short
= 5;
231 v_unsigned_long
= 11;
237 v_char_array
[0] = v_char
;
238 v_signed_char_array
[0] = v_signed_char
;
239 v_unsigned_char_array
[0] = v_unsigned_char
;
241 v_short_array
[0] = v_short
;
242 v_signed_short_array
[0] = v_signed_short
;
243 v_unsigned_short_array
[0] = v_unsigned_short
;
245 v_int_array
[0] = v_int
;
246 v_signed_int_array
[0] = v_signed_int
;
247 v_unsigned_int_array
[0] = v_unsigned_int
;
249 v_long_array
[0] = v_long
;
250 v_signed_long_array
[0] = v_signed_long
;
251 v_unsigned_long_array
[0] = v_unsigned_long
;
253 v_float_array
[0] = v_float
;
254 v_double_array
[0] = v_double
;
256 v_char_pointer
= &v_char
;
257 v_signed_char_pointer
= &v_signed_char
;
258 v_unsigned_char_pointer
= &v_unsigned_char
;
260 v_short_pointer
= &v_short
;
261 v_signed_short_pointer
= &v_signed_short
;
262 v_unsigned_short_pointer
= &v_unsigned_short
;
264 v_int_pointer
= &v_int
;
265 v_signed_int_pointer
= &v_signed_int
;
266 v_unsigned_int_pointer
= &v_unsigned_int
;
268 v_long_pointer
= &v_long
;
269 v_signed_long_pointer
= &v_signed_long
;
270 v_unsigned_long_pointer
= &v_unsigned_long
;
272 v_float_pointer
= &v_float
;
273 v_double_pointer
= &v_double
;
278 u_link
.next
= s_link
;
280 v_union2
.v_short_member
= v_union
.v_short_member
;
282 v_struct1
.v_char_member
= 0;
283 v_struct2
.v_char_member
= 0;
285 nested_su
.outer_int
= 0;