2 * Test file with lots of different types, for testing the
7 * First the basic C types.
10 #if !defined (__STDC__) && !defined (_AIX)
15 signed char v_signed_char
;
16 unsigned char v_unsigned_char
;
19 signed short v_signed_short
;
20 unsigned short v_unsigned_short
;
23 signed int v_signed_int
;
24 unsigned int v_unsigned_int
;
27 signed long v_signed_long
;
28 unsigned long v_unsigned_long
;
34 * Now some derived types, which are arrays, functions-returning,
35 * pointers, structures, unions, and enumerations.
41 signed char v_signed_char_array
[2];
42 unsigned char v_unsigned_char_array
[2];
44 short v_short_array
[2];
45 signed short v_signed_short_array
[2];
46 unsigned short v_unsigned_short_array
[2];
49 signed int v_signed_int_array
[2];
50 unsigned int v_unsigned_int_array
[2];
53 signed long v_signed_long_array
[2];
54 unsigned long v_unsigned_long_array
[2];
56 float v_float_array
[2];
57 double v_double_array
[2];
60 typedef char t_char_array
[];
62 /**** pointers *******/
65 signed char *v_signed_char_pointer
;
66 unsigned char *v_unsigned_char_pointer
;
68 short *v_short_pointer
;
69 signed short *v_signed_short_pointer
;
70 unsigned short *v_unsigned_short_pointer
;
73 signed int *v_signed_int_pointer
;
74 unsigned int *v_unsigned_int_pointer
;
77 signed long *v_signed_long_pointer
;
78 unsigned long *v_unsigned_long_pointer
;
80 float *v_float_pointer
;
81 double *v_double_pointer
;
83 /**** structs *******/
91 double v_double_member
;
94 struct t_struct
*v_t_struct_p
;
101 float v_float_member
;
102 double v_double_member
;
105 /* typedef'd struct without a tag. */
107 double v_double_member
;
110 /* GCC seems to want a variable of this type, or else it won't put out
114 /**** unions *******/
118 short v_short_member
;
121 float v_float_member
;
122 double v_double_member
;
127 short v_short_member
;
130 float v_float_member
;
131 double v_double_member
;
134 /* typedef'd union without a tag. */
136 double v_double_member
;
139 /* GCC seems to want a variable of this type, or else it won't put out
143 /*** Functions returning type ********/
145 char v_char_func () { return(0); }
146 signed char v_signed_char_func () { return (0); }
147 unsigned char v_unsigned_char_func () { return (0); }
149 short v_short_func () { return (0); }
150 signed short v_signed_short_func () { return (0); }
151 unsigned short v_unsigned_short_func () { return (0); }
153 int v_int_func () { return (0); }
154 signed int v_signed_int_func () { return (0); }
155 unsigned int v_unsigned_int_func () { return (0); }
157 long v_long_func () { return (0); }
158 signed long v_signed_long_func () { return (0); }
159 unsigned long v_unsigned_long_func () { return (0); }
161 float v_float_func () { return (0.0); }
162 double v_double_func () { return (0.0); }
164 /**** Some misc more complicated things *******/
169 struct link
*(*linkfunc
) (struct link
*this, int flags
);
171 struct link
*(*linkfunc
) ();
173 struct t_struct stuff
[1][2][3];
179 struct link
*(*linkfunc
) (struct link
*this, int flags
);
181 struct link
*(*linkfunc
) ();
183 struct t_struct stuff
[1][2][3];
186 struct outer_struct
{
188 struct inner_struct
{
191 }inner_struct_instance
;
194 long inner_union_long
;
195 }inner_union_instance
;
199 /**** Enumerations *******/
202 /* Work around the bug for compilers which don't put out the right stabs. */
203 #if __GNUC__ < 2 && !defined (_AIX)
206 {red1
, green1
, blue1
} primary1
;
208 enum {red
, green
, blue
} primary
;
209 enum colors
{yellow
, purple
, pink
} nonprimary
;
211 enum {chevy
, ford
} clunker
;
212 enum cars
{bmw
, porsche
} sportscar
;
214 typedef enum {FALSE
, TRUE
} boolean
;
216 typedef enum bvals
{false, true} boolean2
;
219 enum misordered
{two
= 2, one
= 1, zero
= 0, three
= 3};
225 /* Ensure that malloc is a pointer type; avoid use of "void" and any include files. */
226 extern char *malloc();
228 /* Seems like we need a variable of this type to get the type to be put
229 in the executable, at least for AIX xlc. */
230 enum misordered v_misordered
= three
;
232 /* Some of the tests in ptype.exp require invoking malloc, so make
233 sure it is linked in to this program. */
234 v_char_pointer
= (char *) malloc (1);
240 /* Some linkers (e.g. on AIX) remove unreferenced variables,
241 so make sure to reference them. */
247 v_struct1
.v_int_member
= 5;
248 v_struct2
.v_int_member
= 6;
249 v_struct3
.v_int_member
= 7;
257 v_unsigned_short
= 0;
271 v_signed_char_array
[0] = 0;
272 v_unsigned_char_array
[0] = 0;
274 v_short_array
[0] = 0;
275 v_signed_short_array
[0] = 0;
276 v_unsigned_short_array
[0] = 0;
279 v_signed_int_array
[0] = 0;
280 v_unsigned_int_array
[0] = 0;
283 v_signed_long_array
[0] = 0;
284 v_unsigned_long_array
[0] = 0;
286 v_float_array
[0] = 0;
287 v_double_array
[0] = 0;
290 v_signed_char_pointer
= 0;
291 v_unsigned_char_pointer
= 0;
294 v_signed_short_pointer
= 0;
295 v_unsigned_short_pointer
= 0;
298 v_signed_int_pointer
= 0;
299 v_unsigned_int_pointer
= 0;
302 v_signed_long_pointer
= 0;
303 v_unsigned_long_pointer
= 0;
306 v_double_pointer
= 0;
308 nested_su
.outer_int
= 0;
This page took 0.035699 seconds and 4 git commands to generate.