OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [exprs.c] - Blame information for rev 816

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
#ifdef PROTOTYPES
2
int main (int argc, char **argv, char **envp)
3
#else
4
main (argc, argv, envp)
5
     int argc;
6
     char **argv;
7
     char **envp;
8
#endif
9
{
10
    extern void dummy();
11
#ifdef usestubs
12
    set_debug_traps();
13
    breakpoint();
14
#endif
15
    dummy();
16
    return 0;
17
 
18
}
19
 
20
/* We put main() right up front so its line number doesn't keep changing.  */
21
 
22
/*
23
 *      Test file with lots of different types, for testing the
24
 *      "whatis" command.
25
 */
26
 
27
/*
28
 *      First the basic C types.
29
 */
30
 
31
#if !defined (__STDC__) && !defined (_AIX)
32
#define signed  /**/
33
#endif
34
 
35
char            v_char;
36
signed char     v_signed_char;
37
unsigned char   v_unsigned_char;
38
 
39
short           v_short;
40
signed short    v_signed_short;
41
unsigned short  v_unsigned_short;
42
 
43
int             v_int;
44
signed int      v_signed_int;
45
unsigned int    v_unsigned_int;
46
 
47
long            v_long;
48
signed long     v_signed_long;
49
unsigned long   v_unsigned_long;
50
 
51
float           v_float;
52
double          v_double;
53
/*
54
 *      Now some derived types, which are arrays, functions-returning,
55
 *      pointers, structures, unions, and enumerations.
56
 */
57
 
58
/**** arrays *******/
59
 
60
char            v_char_array[2];
61
signed char     v_signed_char_array[2];
62
unsigned char   v_unsigned_char_array[2];
63
 
64
short           v_short_array[2];
65
signed short    v_signed_short_array[2];
66
unsigned short  v_unsigned_short_array[2];
67
 
68
int             v_int_array[2];
69
signed int      v_signed_int_array[2];
70
unsigned int    v_unsigned_int_array[2];
71
 
72
long            v_long_array[2];
73
signed long     v_signed_long_array[2];
74
unsigned long   v_unsigned_long_array[2];
75
 
76
float           v_float_array[2];
77
double          v_double_array[2];
78
/**** pointers *******/
79
 
80
char            *v_char_pointer;
81
signed char     *v_signed_char_pointer;
82
unsigned char   *v_unsigned_char_pointer;
83
 
84
short           *v_short_pointer;
85
signed short    *v_signed_short_pointer;
86
unsigned short  *v_unsigned_short_pointer;
87
 
88
int             *v_int_pointer;
89
signed int      *v_signed_int_pointer;
90
unsigned int    *v_unsigned_int_pointer;
91
 
92
long            *v_long_pointer;
93
signed long     *v_signed_long_pointer;
94
unsigned long   *v_unsigned_long_pointer;
95
 
96
float           *v_float_pointer;
97
double          *v_double_pointer;
98
 
99
/**** structs *******/
100
 
101
struct t_struct {
102
    char        v_char_member;
103
    short       v_short_member;
104
    int         v_int_member;
105
    long        v_long_member;
106
    float       v_float_member;
107
    double      v_double_member;
108
} v_struct1;
109
 
110
struct {
111
    char        v_char_member;
112
    short       v_short_member;
113
    int         v_int_member;
114
    long        v_long_member;
115
    float       v_float_member;
116
    double      v_double_member;
117
} v_struct2;
118
 
119
/**** unions *******/
120
 
121
union t_union {
122
    char        v_char_member;
123
    short       v_short_member;
124
    int         v_int_member;
125
    long        v_long_member;
126
    float       v_float_member;
127
    double      v_double_member;
128
} v_union;
129
 
130
union {
131
    char        v_char_member;
132
    short       v_short_member;
133
    int         v_int_member;
134
    long        v_long_member;
135
    float       v_float_member;
136
    double      v_double_member;
137
} v_union2;
138
 
139
/*** Functions returning type ********/
140
 
141
char            v_char_func () { return(0); }
142
signed char     v_signed_char_func () { return (0); }
143
unsigned char   v_unsigned_char_func () { return (0); }
144
 
145
short           v_short_func () { return (0); }
146
signed short    v_signed_short_func () { return (0); }
147
unsigned short  v_unsigned_short_func () { return (0); }
148
 
149
int             v_int_func () { return (0); }
150
signed int      v_signed_int_func () { return (0); }
151
unsigned int    v_unsigned_int_func () { return (0); }
152
 
153
long            v_long_func () { return (0); }
154
signed long     v_signed_long_func () { return (0); }
155
unsigned long   v_unsigned_long_func () { return (0); }
156
 
157
float           v_float_func () { return (0.0); }
158
double          v_double_func () { return (0.0); }
159
 
160
/**** Some misc more complicated things *******/
161
 
162
struct link {
163
        struct link *next;
164
#ifdef __STDC__
165
        struct link *(*linkfunc) (struct link *this, int flags);
166
#else
167
        struct link *(*linkfunc) ();
168
#endif
169
        struct t_struct stuff[1][2][3];
170
} *s_link;
171
 
172
union tu_link {
173
        struct link *next;
174
#ifdef __STDC__
175
        struct link *(*linkfunc) (struct link *this, int flags);
176
#else
177
        struct link *(*linkfunc) ();
178
#endif
179
        struct t_struct stuff[1][2][3];
180
} u_link;
181
 
182
/**** Enumerations *******/
183
 
184
enum colors {red, green, blue} color;
185
enum cars {chevy, ford, porsche} clunker;
186
 
187
 
188
void dummy()
189
{
190
  /* Some linkers (e.g. on AIX) remove unreferenced variables,
191
     so make sure to reference them. */
192
  v_char = 0;
193
  v_signed_char = 1;
194
  v_unsigned_char = 2;
195
 
196
  v_short = 3;
197
  v_signed_short = 4;
198
  v_unsigned_short = 5;
199
 
200
  v_int = 6;
201
  v_signed_int = 7;
202
  v_unsigned_int = 8;
203
 
204
  v_long = 9;
205
  v_signed_long = 10;
206
  v_unsigned_long = 11;
207
 
208
  v_float = 100.0;
209
  v_double = 200.0;
210
  v_char_array[0] = v_char;
211
  v_signed_char_array[0] = v_signed_char;
212
  v_unsigned_char_array[0] = v_unsigned_char;
213
 
214
  v_short_array[0] = v_short;
215
  v_signed_short_array[0] = v_signed_short;
216
  v_unsigned_short_array[0] = v_unsigned_short;
217
 
218
  v_int_array[0] = v_int;
219
  v_signed_int_array[0] = v_signed_int;
220
  v_unsigned_int_array[0] = v_unsigned_int;
221
 
222
  v_long_array[0] = v_long;
223
  v_signed_long_array[0] = v_signed_long;
224
  v_unsigned_long_array[0] = v_unsigned_long;
225
 
226
  v_float_array[0] = v_float;
227
  v_double_array[0] = v_double;
228
  v_char_pointer = &v_char;
229
  v_signed_char_pointer = &v_signed_char;
230
  v_unsigned_char_pointer = &v_unsigned_char;
231
 
232
  v_short_pointer = &v_short;
233
  v_signed_short_pointer = &v_signed_short;
234
  v_unsigned_short_pointer = &v_unsigned_short;
235
 
236
  v_int_pointer = &v_int;
237
  v_signed_int_pointer = &v_signed_int;
238
  v_unsigned_int_pointer = &v_unsigned_int;
239
 
240
  v_long_pointer = &v_long;
241
  v_signed_long_pointer = &v_signed_long;
242
  v_unsigned_long_pointer = &v_unsigned_long;
243
 
244
  v_float_pointer = &v_float;
245
  v_double_pointer = &v_double;
246
 
247
  color = red;
248
  clunker = porsche;
249
 
250
  u_link.next = s_link;
251
 
252
  v_struct2.v_int_member = v_struct1.v_int_member;
253
  v_union2.v_short_member = v_union.v_short_member;
254
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.