3 int main (int argc
, char **argv
, char **envp
)
10 /* We put main() right up front so its line number doesn't keep changing. */
13 * Test file with lots of different types, for testing the
18 * First the basic C types.
21 #if !defined (__STDC__) && !defined (_AIX)
26 signed char v_signed_char
;
27 unsigned char v_unsigned_char
;
30 signed short v_signed_short
;
31 unsigned short v_unsigned_short
;
34 signed int v_signed_int
;
35 unsigned int v_unsigned_int
;
38 signed long v_signed_long
;
39 unsigned long v_unsigned_long
;
45 * Now some derived types, which are arrays, functions-returning,
46 * pointers, structures, unions, and enumerations.
52 signed char v_signed_char_array
[2];
53 unsigned char v_unsigned_char_array
[2];
55 short v_short_array
[2];
56 signed short v_signed_short_array
[2];
57 unsigned short v_unsigned_short_array
[2];
60 signed int v_signed_int_array
[2];
61 unsigned int v_unsigned_int_array
[2];
64 signed long v_signed_long_array
[2];
65 unsigned long v_unsigned_long_array
[2];
67 float v_float_array
[2];
68 double v_double_array
[2];
70 /**** pointers *******/
73 signed char *v_signed_char_pointer
;
74 unsigned char *v_unsigned_char_pointer
;
76 short *v_short_pointer
;
77 signed short *v_signed_short_pointer
;
78 unsigned short *v_unsigned_short_pointer
;
81 signed int *v_signed_int_pointer
;
82 unsigned int *v_unsigned_int_pointer
;
85 signed long *v_signed_long_pointer
;
86 unsigned long *v_unsigned_long_pointer
;
88 float *v_float_pointer
;
89 double *v_double_pointer
;
91 /**** structs *******/
99 double v_double_member
;
104 short v_short_member
;
107 float v_float_member
;
108 double v_double_member
;
118 /**** unions *******/
122 short v_short_member
;
125 float v_float_member
;
126 double v_double_member
;
131 short v_short_member
;
134 float v_float_member
;
135 double v_double_member
;
138 /*** Functions returning type ********/
140 char v_char_func () { return(0); }
141 signed char v_signed_char_func () { return (0); }
142 unsigned char v_unsigned_char_func () { return (0); }
144 short v_short_func () { return (0); }
145 signed short v_signed_short_func () { return (0); }
146 unsigned short v_unsigned_short_func () { return (0); }
148 int v_int_func () { return (0); }
149 signed int v_signed_int_func () { return (0); }
150 unsigned int v_unsigned_int_func () { return (0); }
152 long v_long_func () { return (0); }
153 signed long v_signed_long_func () { return (0); }
154 unsigned long v_unsigned_long_func () { return (0); }
156 float v_float_func () { return (0.0); }
157 double v_double_func () { return (0.0); }
159 /**** Some misc more complicated things *******/
164 struct link
*(*linkfunc
) (struct link
*this, int flags
);
166 struct link
*(*linkfunc
) ();
168 struct t_struct stuff
[1][2][3];
174 struct link
*(*linkfunc
) (struct link
*this, int flags
);
176 struct link
*(*linkfunc
) ();
178 struct t_struct stuff
[1][2][3];
181 /**** Enumerations *******/
183 enum colors
{red
, green
, blue
} color
;
184 enum cars
{chevy
, ford
, porsche
} clunker
;
186 /**** Enumeration bitfields, supported by GNU C *******/
189 enum senum
{sm1
= -1, s1
= 1};
190 struct senum_field
{enum senum field
:2; } sef
;
191 enum uenum
{u1
= 1, u2
= 2};
192 struct uenum_field
{enum uenum field
:2; } uef
;
198 /* setvar.exp wants to allocate memory for constants. So make sure malloc
199 gets linked into the program. */
200 void *p
= malloc (1);
202 /* Some linkers (e.g. on AIX) remove unreferenced variables,
203 so make sure to reference them. */
210 v_unsigned_short
= 5;
218 v_unsigned_long
= 11;
224 v_char_array
[0] = v_char
;
225 v_signed_char_array
[0] = v_signed_char
;
226 v_unsigned_char_array
[0] = v_unsigned_char
;
228 v_short_array
[0] = v_short
;
229 v_signed_short_array
[0] = v_signed_short
;
230 v_unsigned_short_array
[0] = v_unsigned_short
;
232 v_int_array
[0] = v_int
;
233 v_signed_int_array
[0] = v_signed_int
;
234 v_unsigned_int_array
[0] = v_unsigned_int
;
236 v_long_array
[0] = v_long
;
237 v_signed_long_array
[0] = v_signed_long
;
238 v_unsigned_long_array
[0] = v_unsigned_long
;
240 v_float_array
[0] = v_float
;
241 v_double_array
[0] = v_double
;
243 v_char_pointer
= &v_char
;
244 v_signed_char_pointer
= &v_signed_char
;
245 v_unsigned_char_pointer
= &v_unsigned_char
;
247 v_short_pointer
= &v_short
;
248 v_signed_short_pointer
= &v_signed_short
;
249 v_unsigned_short_pointer
= &v_unsigned_short
;
251 v_int_pointer
= &v_int
;
252 v_signed_int_pointer
= &v_signed_int
;
253 v_unsigned_int_pointer
= &v_unsigned_int
;
255 v_long_pointer
= &v_long
;
256 v_signed_long_pointer
= &v_signed_long
;
257 v_unsigned_long_pointer
= &v_unsigned_long
;
259 v_float_pointer
= &v_float
;
260 v_double_pointer
= &v_double
;
265 u_link
.next
= s_link
;
267 v_struct2
.v_int_member
= v_struct1
.v_int_member
;
268 v_union2
.v_short_member
= v_union
.v_short_member
;