1 main (argc
, argv
, envp
)
14 /* We put main() right up front so its line number doesn't keep changing. */
17 * Test file with lots of different types, for testing the
22 * First the basic C types.
25 #if !defined (__STDC__) && !defined (_AIX)
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 *******/
77 signed char *v_signed_char_pointer
;
78 unsigned char *v_unsigned_char_pointer
;
80 short *v_short_pointer
;
81 signed short *v_signed_short_pointer
;
82 unsigned short *v_unsigned_short_pointer
;
85 signed int *v_signed_int_pointer
;
86 unsigned int *v_unsigned_int_pointer
;
89 signed long *v_signed_long_pointer
;
90 unsigned long *v_unsigned_long_pointer
;
92 float *v_float_pointer
;
93 double *v_double_pointer
;
95 /**** structs *******/
102 float v_float_member
;
103 double v_double_member
;
108 short v_short_member
;
111 float v_float_member
;
112 double v_double_member
;
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 /*** Functions returning type ********/
137 char v_char_func () { return(0); }
138 signed char v_signed_char_func () { return (0); }
139 unsigned char v_unsigned_char_func () { return (0); }
141 short v_short_func () { return (0); }
142 signed short v_signed_short_func () { return (0); }
143 unsigned short v_unsigned_short_func () { return (0); }
145 int v_int_func () { return (0); }
146 signed int v_signed_int_func () { return (0); }
147 unsigned int v_unsigned_int_func () { return (0); }
149 long v_long_func () { return (0); }
150 signed long v_signed_long_func () { return (0); }
151 unsigned long v_unsigned_long_func () { return (0); }
153 float v_float_func () { return (0.0); }
154 double v_double_func () { return (0.0); }
156 /**** Some misc more complicated things *******/
161 struct link
*(*linkfunc
) (struct link
*this, int flags
);
163 struct link
*(*linkfunc
) ();
165 struct t_struct stuff
[1][2][3];
171 struct link
*(*linkfunc
) (struct link
*this, int flags
);
173 struct link
*(*linkfunc
) ();
175 struct t_struct stuff
[1][2][3];
178 /**** Enumerations *******/
180 enum colors
{red
, green
, blue
} color
;
181 enum cars
{chevy
, ford
, porsche
} clunker
;
183 /**** Enumeration bitfields, supported by GNU C *******/
186 enum senum
{sm1
= -1, s1
= 1};
187 struct senum_field
{enum senum field
:2; } sef
;
188 enum uenum
{u1
= 1, u2
= 2};
189 struct uenum_field
{enum uenum field
:2; } uef
;
195 /* setvar.exp wants to allocate memory for constants. So make sure malloc
196 gets linked into the program. */
199 /* Some linkers (e.g. on AIX) remove unreferenced variables,
200 so make sure to reference them. */
207 v_unsigned_short
= 5;
215 v_unsigned_long
= 11;
221 v_char_array
[0] = v_char
;
222 v_signed_char_array
[0] = v_signed_char
;
223 v_unsigned_char_array
[0] = v_unsigned_char
;
225 v_short_array
[0] = v_short
;
226 v_signed_short_array
[0] = v_signed_short
;
227 v_unsigned_short_array
[0] = v_unsigned_short
;
229 v_int_array
[0] = v_int
;
230 v_signed_int_array
[0] = v_signed_int
;
231 v_unsigned_int_array
[0] = v_unsigned_int
;
233 v_long_array
[0] = v_long
;
234 v_signed_long_array
[0] = v_signed_long
;
235 v_unsigned_long_array
[0] = v_unsigned_long
;
237 v_float_array
[0] = v_float
;
238 v_double_array
[0] = v_double
;
240 v_char_pointer
= &v_char
;
241 v_signed_char_pointer
= &v_signed_char
;
242 v_unsigned_char_pointer
= &v_unsigned_char
;
244 v_short_pointer
= &v_short
;
245 v_signed_short_pointer
= &v_signed_short
;
246 v_unsigned_short_pointer
= &v_unsigned_short
;
248 v_int_pointer
= &v_int
;
249 v_signed_int_pointer
= &v_signed_int
;
250 v_unsigned_int_pointer
= &v_unsigned_int
;
252 v_long_pointer
= &v_long
;
253 v_signed_long_pointer
= &v_signed_long
;
254 v_unsigned_long_pointer
= &v_unsigned_long
;
256 v_float_pointer
= &v_float
;
257 v_double_pointer
= &v_double
;
262 u_link
.next
= s_link
;
264 v_struct2
.v_int_member
= v_struct1
.v_int_member
;
265 v_union2
.v_short_member
= v_union
.v_short_member
;
This page took 0.040234 seconds and 5 git commands to generate.