2 * Test file with lots of different types, for testing the
7 * First the basic C types.
11 #if !defined (__STDC__) && !defined (_AIX)
16 signed char v_signed_char
;
17 unsigned char v_unsigned_char
;
20 signed short v_signed_short
;
21 unsigned short v_unsigned_short
;
24 signed int v_signed_int
;
25 unsigned int v_unsigned_int
;
28 signed long v_signed_long
;
29 unsigned long v_unsigned_long
;
35 * Now some derived types, which are arrays, functions-returning,
36 * pointers, structures, unions, and enumerations.
42 signed char v_signed_char_array
[2];
43 unsigned char v_unsigned_char_array
[2];
45 short v_short_array
[2];
46 signed short v_signed_short_array
[2];
47 unsigned short v_unsigned_short_array
[2];
50 signed int v_signed_int_array
[2];
51 unsigned int v_unsigned_int_array
[2];
54 signed long v_signed_long_array
[2];
55 unsigned long v_unsigned_long_array
[2];
57 float v_float_array
[2];
58 double v_double_array
[2];
61 typedef char t_char_array
[];
63 /**** pointers *******/
66 signed char *v_signed_char_pointer
;
67 unsigned char *v_unsigned_char_pointer
;
69 short *v_short_pointer
;
70 signed short *v_signed_short_pointer
;
71 unsigned short *v_unsigned_short_pointer
;
74 signed int *v_signed_int_pointer
;
75 unsigned int *v_unsigned_int_pointer
;
78 signed long *v_signed_long_pointer
;
79 unsigned long *v_unsigned_long_pointer
;
81 float *v_float_pointer
;
82 double *v_double_pointer
;
84 /**** structs *******/
92 double v_double_member
;
95 struct t_struct
*v_t_struct_p
;
102 float v_float_member
;
103 double v_double_member
;
106 /* typedef'd struct without a tag. */
108 double v_double_member
;
111 /* GCC seems to want a variable of this type, or else it won't put out
115 /**** unions *******/
119 short v_short_member
;
122 float v_float_member
;
123 double v_double_member
;
128 short v_short_member
;
131 float v_float_member
;
132 double v_double_member
;
135 /* typedef'd union without a tag. */
137 double v_double_member
;
140 /* GCC seems to want a variable of this type, or else it won't put out
144 /*** Functions returning type ********/
146 char v_char_func () { return(0); }
147 signed char v_signed_char_func () { return (0); }
148 unsigned char v_unsigned_char_func () { return (0); }
150 short v_short_func () { return (0); }
151 signed short v_signed_short_func () { return (0); }
152 unsigned short v_unsigned_short_func () { return (0); }
154 int v_int_func () { return (0); }
155 signed int v_signed_int_func () { return (0); }
156 unsigned int v_unsigned_int_func () { return (0); }
158 long v_long_func () { return (0); }
159 signed long v_signed_long_func () { return (0); }
160 unsigned long v_unsigned_long_func () { return (0); }
162 float v_float_func () { return (0.0); }
163 double v_double_func () { return (0.0); }
165 /**** Some misc more complicated things *******/
170 struct link
*(*linkfunc
) (struct link
*this, int flags
);
172 struct link
*(*linkfunc
) ();
174 struct t_struct stuff
[1][2][3];
180 struct link
*(*linkfunc
) (struct link
*this, int flags
);
182 struct link
*(*linkfunc
) ();
184 struct t_struct stuff
[1][2][3];
187 struct outer_struct
{
189 struct inner_struct
{
192 }inner_struct_instance
;
195 long inner_union_long
;
196 }inner_union_instance
;
200 /**** Enumerations *******/
203 /* Work around the bug for compilers which don't put out the right stabs. */
204 #if __GNUC__ < 2 && !defined (_AIX)
207 {red1
, green1
, blue1
} primary1
;
209 enum {red
, green
, blue
} primary
;
210 enum colors
{yellow
, purple
, pink
} nonprimary
;
212 enum {chevy
, ford
} clunker
;
213 enum cars
{bmw
, porsche
} sportscar
;
215 typedef enum {FALSE
, TRUE
} boolean
;
217 /*note: aCC has bool type predefined with 'false' and 'true'*/
218 typedef enum bvals
{my_false
, my_true
} boolean2
;
221 enum misordered
{two
= 2, one
= 1, zero
= 0, three
= 3};
223 /* Seems like we need a variable of this type to get the type to be put
224 in the executable, at least for AIX xlc. */
225 enum misordered v_misordered
= three
;
231 /* Ensure that malloc is a pointer type; avoid use of "void" and any include files. */
232 /* extern char *malloc();*/
234 /* Some of the tests in ptype.exp require invoking malloc, so make
235 sure it is linked in to this program. */
236 v_char_pointer
= (char *) malloc (1);
242 /* Some linkers (e.g. on AIX) remove unreferenced variables,
243 so make sure to reference them. */
249 v_struct1
.v_int_member
= 5;
250 v_struct2
.v_int_member
= 6;
251 v_struct3
.v_int_member
= 7;
259 v_unsigned_short
= 0;
273 v_signed_char_array
[0] = 0;
274 v_unsigned_char_array
[0] = 0;
276 v_short_array
[0] = 0;
277 v_signed_short_array
[0] = 0;
278 v_unsigned_short_array
[0] = 0;
281 v_signed_int_array
[0] = 0;
282 v_unsigned_int_array
[0] = 0;
285 v_signed_long_array
[0] = 0;
286 v_unsigned_long_array
[0] = 0;
288 v_float_array
[0] = 0;
289 v_double_array
[0] = 0;
292 v_signed_char_pointer
= 0;
293 v_unsigned_char_pointer
= 0;
296 v_signed_short_pointer
= 0;
297 v_unsigned_short_pointer
= 0;
300 v_signed_int_pointer
= 0;
301 v_unsigned_int_pointer
= 0;
304 v_signed_long_pointer
= 0;
305 v_unsigned_long_pointer
= 0;
308 v_double_pointer
= 0;
310 nested_su
.outer_int
= 0;
314 v_boolean2
= my_false
;
This page took 0.03599 seconds and 4 git commands to generate.