import gdb-1999-08-02 snapshot
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / structs.c
CommitLineData
74cf1395
JM
1/* Copyright (C) 1996 Free Software Foundation, Inc.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 Please email any bugs, comments, and/or additions to this file to:
18 bug-gdb@prep.ai.mit.edu */
19
20struct struct1 { char a;};
21struct struct2 { char a, b;};
22struct struct3 { char a, b, c; };
23struct struct4 { char a, b, c, d; };
24struct struct5 { char a, b, c, d, e; };
25struct struct6 { char a, b, c, d, e, f; };
26struct struct7 { char a, b, c, d, e, f, g; };
27struct struct8 { char a, b, c, d, e, f, g, h; };
28struct struct9 { char a, b, c, d, e, f, g, h, i; };
29struct struct10 { char a, b, c, d, e, f, g, h, i, j; };
30struct struct11 { char a, b, c, d, e, f, g, h, i, j, k; };
31struct struct12 { char a, b, c, d, e, f, g, h, i, j, k, l; };
32struct struct16 { char a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p; };
33
34struct struct1 foo1 = {'1'}, L1;
35struct struct2 foo2 = { 'a', 'b'}, L2;
36struct struct3 foo3 = { 'A', 'B', 'C'}, L3;
37struct struct4 foo4 = {'1', '2', '3', '4'}, L4;
38struct struct5 foo5 = {'a', 'b', 'c', 'd', 'e'}, L5;
39struct struct6 foo6 = {'A', 'B', 'C', 'D', 'E', 'F'}, L6;
40struct struct7 foo7 = {'1', '2', '3', '4', '5', '6', '7'}, L7;
41struct struct8 foo8 = {'1', '2', '3', '4', '5', '6', '7', '8'}, L8;
42struct struct9 foo9 = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'}, L9;
43struct struct10 foo10 = {
44 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'}, L10;
45struct struct11 foo11 = {
46 '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B'}, L11;
47struct struct12 foo12 = {
48 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'}, L12;
49struct struct16 foo16 = {
50 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p'}, L16;
51
52struct struct1 fun1()
53{
54 return foo1;
55}
56struct struct2 fun2()
57{
58 return foo2;
59}
60struct struct3 fun3()
61{
62 return foo3;
63}
64struct struct4 fun4()
65{
66 return foo4;
67}
68struct struct5 fun5()
69{
70 return foo5;
71}
72struct struct6 fun6()
73{
74 return foo6;
75}
76struct struct7 fun7()
77{
78 return foo7;
79}
80struct struct8 fun8()
81{
82 return foo8;
83}
84struct struct9 fun9()
85{
86 return foo9;
87}
88struct struct10 fun10()
89{
90 return foo10;
91}
92struct struct11 fun11()
93{
94 return foo11;
95}
96struct struct12 fun12()
97{
98 return foo12;
99}
100struct struct16 fun16()
101{
102 return foo16;
103}
104
a0b3c4fd
JM
105#ifdef PROTOTYPES
106void Fun1(struct struct1 foo1)
107#else
74cf1395
JM
108void Fun1(foo1)
109 struct struct1 foo1;
a0b3c4fd 110#endif
74cf1395
JM
111{
112 L1 = foo1;
113}
a0b3c4fd
JM
114#ifdef PROTOTYPES
115void Fun2(struct struct2 foo2)
116#else
74cf1395
JM
117void Fun2(foo2)
118 struct struct2 foo2;
a0b3c4fd 119#endif
74cf1395
JM
120{
121 L2 = foo2;
122}
a0b3c4fd
JM
123#ifdef PROTOTYPES
124void Fun3(struct struct3 foo3)
125#else
74cf1395
JM
126void Fun3(foo3)
127 struct struct3 foo3;
a0b3c4fd 128#endif
74cf1395
JM
129{
130 L3 = foo3;
131}
a0b3c4fd
JM
132#ifdef PROTOTYPES
133void Fun4(struct struct4 foo4)
134#else
74cf1395
JM
135void Fun4(foo4)
136 struct struct4 foo4;
a0b3c4fd 137#endif
74cf1395
JM
138{
139 L4 = foo4;
140}
a0b3c4fd
JM
141#ifdef PROTOTYPES
142void Fun5(struct struct5 foo5)
143#else
74cf1395
JM
144void Fun5(foo5)
145 struct struct5 foo5;
a0b3c4fd 146#endif
74cf1395
JM
147{
148 L5 = foo5;
149}
a0b3c4fd
JM
150#ifdef PROTOTYPES
151void Fun6(struct struct6 foo6)
152#else
74cf1395
JM
153void Fun6(foo6)
154 struct struct6 foo6;
a0b3c4fd 155#endif
74cf1395
JM
156{
157 L6 = foo6;
158}
a0b3c4fd
JM
159#ifdef PROTOTYPES
160void Fun7(struct struct7 foo7)
161#else
74cf1395
JM
162void Fun7(foo7)
163 struct struct7 foo7;
a0b3c4fd 164#endif
74cf1395
JM
165{
166 L7 = foo7;
167}
a0b3c4fd
JM
168#ifdef PROTOTYPES
169void Fun8(struct struct8 foo8)
170#else
74cf1395
JM
171void Fun8(foo8)
172 struct struct8 foo8;
a0b3c4fd 173#endif
74cf1395
JM
174{
175 L8 = foo8;
176}
a0b3c4fd
JM
177#ifdef PROTOTYPES
178void Fun9(struct struct9 foo9)
179#else
74cf1395
JM
180void Fun9(foo9)
181 struct struct9 foo9;
a0b3c4fd 182#endif
74cf1395
JM
183{
184 L9 = foo9;
185}
a0b3c4fd
JM
186#ifdef PROTOTYPES
187void Fun10(struct struct10 foo10)
188#else
74cf1395
JM
189void Fun10(foo10)
190 struct struct10 foo10;
a0b3c4fd 191#endif
74cf1395
JM
192{
193 L10 = foo10;
194}
a0b3c4fd
JM
195#ifdef PROTOTYPES
196void Fun11(struct struct11 foo11)
197#else
74cf1395
JM
198void Fun11(foo11)
199 struct struct11 foo11;
a0b3c4fd 200#endif
74cf1395
JM
201{
202 L11 = foo11;
203}
a0b3c4fd
JM
204#ifdef PROTOTYPES
205void Fun12(struct struct12 foo12)
206#else
74cf1395
JM
207void Fun12(foo12)
208 struct struct12 foo12;
a0b3c4fd 209#endif
74cf1395
JM
210{
211 L12 = foo12;
212}
a0b3c4fd
JM
213#ifdef PROTOTYPES
214void Fun16(struct struct16 foo16)
215#else
74cf1395
JM
216void Fun16(foo16)
217 struct struct16 foo16;
a0b3c4fd 218#endif
74cf1395
JM
219{
220 L16 = foo16;
221}
222
223int main()
224{
225#ifdef usestubs
226 set_debug_traps();
227 breakpoint();
228#endif
229
230 /* TEST C FUNCTIONS */
231 L1 = fun1();
232 L2 = fun2();
233 L3 = fun3();
234 L4 = fun4();
235 L5 = fun5();
236 L6 = fun6();
237 L7 = fun7();
238 L8 = fun8();
239 L9 = fun9();
240 L10 = fun10();
241 L11 = fun11();
242 L12 = fun12();
243 L16 = fun16();
244
245 foo1.a = foo2.a = foo3.a = foo4.a = foo5.a = foo6.a = foo7.a = foo8.a =
246 foo9.a = foo10.a = foo11.a = foo12.a = foo16.a = '$';
247
248 Fun1(foo1);
249 Fun2(foo2);
250 Fun3(foo3);
251 Fun4(foo4);
252 Fun5(foo5);
253 Fun6(foo6);
254 Fun7(foo7);
255 Fun8(foo8);
256 Fun9(foo9);
257 Fun10(foo10);
258 Fun11(foo11);
259 Fun12(foo12);
260 Fun16(foo16);
261
262 return 0;
263}
This page took 0.036319 seconds and 4 git commands to generate.