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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [funcargs.c] - Blame information for rev 1774

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

Line No. Rev Author Line
1 106 markom
/*  Test passing of arguments to functions.  Use various sorts of arguments,
2
    including basic types, pointers to those types, structures, lots of
3
    args, etc, in various combinations. */
4
 
5
/* AIX requires this to be the first thing in the file.  */
6
#ifdef __GNUC__
7
#  define alloca __builtin_alloca
8
#  define HAVE_STACK_ALLOCA 1
9
#else /* not __GNUC__ */
10
#  ifdef _AIX
11
     #pragma alloca
12
#    define HAVE_STACK_ALLOCA 1
13
#  else /* Not AIX */
14
#    ifdef sparc
15
#      include <alloca.h>
16
#      define HAVE_STACK_ALLOCA 1
17
#      ifdef __STDC__
18
         void *alloca ();
19
#      else
20
         char *alloca ();
21
#      endif /* __STDC__ */
22
#    endif /* sparc */
23
#  endif /* Not AIX */
24
#endif /* not __GNUC__ */
25
 
26
char c = 'a';
27
char *cp = &c;
28
 
29
unsigned char uc = 'b';
30
unsigned char *ucp = &uc;
31
 
32
short s = 1;
33
short *sp = &s;
34
 
35
unsigned short us = 6;
36
unsigned short *usp = &us;
37
 
38
int i = 2;
39
int *ip = &i;
40
 
41
unsigned int ui = 7;
42
unsigned int *uip = &ui;
43
 
44
long l = 3;
45
long *lp = &l;
46
 
47
unsigned long ul = 8;
48
unsigned long *ulp = &ul;
49
 
50
float f = 4.0;
51
float *fp = &f;
52
 
53
double d = 5.0;
54
double *dp = &d;
55
 
56
struct stag {
57
    int s1;
58
    int s2;
59
} st = { 101, 102 };
60
struct stag *stp = &st;
61
 
62
union utag {
63
    int u1;
64
    long u2;
65
} un;
66
union utag *unp = &un;
67
 
68
char carray[] = {'a', 'n', ' ', 'a', 'r', 'r', 'a', 'y', '\0'};
69
 
70
 
71
/* Test various permutations and interleaving of integral arguments */
72
 
73
 
74
#ifdef PROTOTYPES
75
void call0a (char c, short s, int i, long l)
76
#else
77
call0a (c, s, i, l)
78
char c; short s; int i; long l;
79
#endif
80
{
81
  c = 'a';
82
  s = 5;
83
  i = 6;
84
  l = 7;
85
}
86
 
87
#ifdef PROTOTYPES
88
void call0b (short s, int i, long l, char c)
89
#else
90
call0b (s, i, l, c)
91
short s; int i; long l; char c;
92
#endif
93
{
94
  s = 6; i = 7; l = 8; c = 'j';
95
}
96
 
97
#ifdef PROTOTYPES
98
void call0c (int i, long l, char c, short s)
99
#else
100
call0c (i, l, c, s)
101
int i; long l; char c; short s;
102
#endif
103
{
104
  i = 3; l = 4; c = 'k'; s = 5;
105
}
106
 
107
#ifdef PROTOTYPES
108
void call0d (long l, char c, short s, int i)
109
#else
110
call0d (l, c, s, i)
111
long l; char c; short s; int i;
112
#endif
113
{
114
  l = 7; c = 'z'; s = 8; i = 9;
115
}
116
 
117
#ifdef PROTOTYPES
118
void call0e (char c1, long l, char c2, int i, char c3, short s, char c4, char c5)
119
#else
120
call0e (c1, l, c2, i, c3, s, c4, c5)
121
char c1; long l; char c2; int i; char c3; short s; char c4; char c5;
122
#endif
123
{
124
  c1 = 'a'; l = 5; c2 = 'b'; i = 7; c3 = 'c'; s = 7; c4 = 'f'; c5 = 'g';
125
}
126
 
127
 
128
/* Test various permutations and interleaving of unsigned integral arguments */
129
 
130
 
131
#ifdef PROTOTYPES
132
void call1a (unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul)
133
#else
134
call1a (uc, us, ui, ul)
135
unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul;
136
#endif
137
{
138
  uc = 5; us = 6; ui = 7; ul = 8;
139
}
140
 
141
#ifdef PROTOTYPES
142
void call1b (unsigned short us, unsigned int ui, unsigned long ul, unsigned char uc)
143
#else
144
call1b (us, ui, ul, uc)
145
unsigned short us; unsigned int ui; unsigned long ul; unsigned char uc;
146
#endif
147
{
148
  uc = 5; us = 6; ui = 7; ul = 8;
149
}
150
 
151
#ifdef PROTOTYPES
152
void call1c (unsigned int ui, unsigned long ul, unsigned char uc, unsigned short us)
153
#else
154
call1c (ui, ul, uc, us)
155
unsigned int ui; unsigned long ul; unsigned char uc; unsigned short us;
156
#endif
157
{
158
  uc = 5; us = 6; ui = 7; ul = 8;
159
}
160
 
161
#ifdef PROTOTYPES
162
void call1d (unsigned long ul, unsigned char uc, unsigned short us, unsigned int ui)
163
#else
164
call1d (ul, uc, us, ui)
165
unsigned long ul; unsigned char uc; unsigned short us; unsigned int ui;
166
#endif
167
{
168
  uc = 5; us = 6; ui = 7; ul = 8;
169
}
170
 
171
#ifdef PROTOTYPES
172
void call1e (unsigned char uc1, unsigned long ul, unsigned char uc2, unsigned int ui, unsigned char uc3, unsigned short us, unsigned char uc4, unsigned char uc5)
173
#else
174
call1e (uc1, ul, uc2, ui, uc3, us, uc4, uc5)
175
unsigned char uc1; unsigned long ul; unsigned char uc2; unsigned int ui;
176
unsigned char uc3; unsigned short us; unsigned char uc4; unsigned char uc5;
177
#endif
178
{
179
  uc1 = 5; ul = 7; uc2 = 8; ui = 9; uc3 = 10; us = 11; uc4 = 12; uc5 = 55;
180
}
181
 
182
/* Test various permutations and interleaving of integral arguments with
183
   floating point arguments. */
184
 
185
 
186
#ifdef PROTOTYPES
187
void call2a (char c, float f1, short s, double d1, int i, float f2, long l, double d2)
188
#else
189
call2a (c, f1, s, d1, i, f2, l, d2)
190
char c; float f1; short s; double d1; int i; float f2; long l; double d2;
191
#endif
192
{
193
  c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2;
194
}
195
 
196
#ifdef PROTOTYPES
197
void call2b (float f1, short s, double d1, int i, float f2, long l, double d2, char c)
198
#else
199
call2b (f1, s, d1, i, f2, l, d2, c)
200
float f1; short s; double d1; int i; float f2; long l; double d2; char c;
201
#endif
202
{
203
  c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2;
204
}
205
 
206
#ifdef PROTOTYPES
207
void call2c (short s, double d1, int i, float f2, long l, double d2, char c, float f1)
208
#else
209
call2c (s, d1, i, f2, l, d2, c, f1)
210
short s; double d1; int i; float f2; long l; double d2; char c; float f1;
211
#endif
212
{
213
  c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2;
214
}
215
 
216
#ifdef PROTOTYPES
217
void call2d (double d1, int i, float f2, long l, double d2, char c, float f1, short s)
218
#else
219
call2d (d1, i, f2, l, d2, c, f1, s)
220
double d1; int i; float f2; long l; double d2; char c; float f1; short s;
221
#endif
222
{
223
  c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2;
224
}
225
 
226
#ifdef PROTOTYPES
227
void call2e (int i, float f2, long l, double d2, char c, float f1, short s, double d1)
228
#else
229
call2e (i, f2, l, d2, c, f1, s, d1)
230
int i; float f2; long l; double d2; char c; float f1; short s; double d1;
231
#endif
232
{
233
  c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2;
234
}
235
 
236
#ifdef PROTOTYPES
237
void call2f (float f2, long l, double d2, char c, float f1, short s, double d1, int i)
238
#else
239
call2f (f2, l, d2, c, f1, s, d1, i)
240
float f2; long l; double d2; char c; float f1; short s; double d1; int i;
241
#endif
242
{
243
  c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2;
244
}
245
 
246
#ifdef PROTOTYPES
247
void call2g (long l, double d2, char c, float f1, short s, double d1, int i, float f2)
248
#else
249
call2g (l, d2, c, f1, s, d1, i, f2)
250
long l; double d2; char c; float f1; short s; double d1; int i; float f2;
251
#endif
252
{
253
  c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2;
254
}
255
 
256
#ifdef PROTOTYPES
257
void call2h (double d2, char c, float f1, short s, double d1, int i, float f2, long l)
258
#else
259
call2h (d2, c, f1, s, d1, i, f2, l)
260
double d2; char c; float f1; short s; double d1; int i; float f2; long l;
261
#endif
262
{
263
  c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2;
264
}
265
 
266
#ifdef PROTOTYPES
267
void call2i (char c1, float f1, char c2, char c3, double d1, char c4, char c5, char c6, float f2, short s, char c7, double d2)
268
#else
269
call2i (c1, f1, c2, c3, d1, c4, c5, c6, f2, s, c7, d2)
270
char c1; float f1; char c2; char c3; double d1; char c4; char c5; char c6;
271
float f2; short s; char c7; double d2;
272
#endif
273
{
274
  c1 = 'a'; f1 = 0.0; c2 = 5; d1 = 0.0; c3 = 6; f2 = 0.1; c4 = 7; d2 = 0.2;
275
  c5 = 's'; c6 = 'f'; c7 = 'z'; s = 77;
276
}
277
 
278
 
279
/* Test pointers to various integral and floating types. */
280
 
281
 
282
#ifdef PROTOTYPES
283
void call3a (char *cp, short *sp, int *ip, long *lp)
284
#else
285
call3a (cp, sp, ip, lp)
286
char *cp; short *sp; int *ip; long *lp;
287
#endif
288
{
289
  cp = 0; sp = 0; ip = 0; lp = 0;
290
}
291
 
292
#ifdef PROTOTYPES
293
void call3b (unsigned char *ucp, unsigned short *usp, unsigned int *uip, unsigned long *ulp)
294
#else
295
call3b (ucp, usp, uip, ulp)
296
unsigned char *ucp; unsigned short *usp; unsigned int *uip;
297
unsigned long *ulp;
298
#endif
299
{
300
  ucp = 0; usp = 0; uip = 0; ulp = 0;
301
}
302
 
303
#ifdef PROTOTYPES
304
void call3c (float *fp, double *dp)
305
#else
306
call3c (fp, dp)
307
float *fp; double *dp;
308
#endif
309
{
310
  fp = 0; dp = 0;
311
}
312
 
313
 
314
/* Test passing structures and unions by reference. */
315
 
316
 
317
#ifdef PROTOTYPES
318
void call4a (struct stag *stp)
319
#else
320
call4a (stp)
321
struct stag *stp;
322
#endif
323
{stp = 0;}
324
 
325
#ifdef PROTOTYPES
326
void call4b (union utag *unp)
327
#else
328
call4b (unp)
329
union utag *unp;
330
#endif
331
{
332
  unp = 0;
333
}
334
 
335
 
336
/* Test passing structures and unions by value. */
337
 
338
 
339
#ifdef PROTOTYPES
340
void call5a (struct stag st)
341
#else
342
call5a (st)
343
struct stag st;
344
#endif
345
{st.s1 = 5;}
346
 
347
#ifdef PROTOTYPES
348
void call5b (union utag un)
349
#else
350
call5b (un)
351
union utag un;
352
#endif
353
{un.u1 = 7;}
354
 
355
 
356
/* Test shuffling of args */
357
 
358
 
359
void call6k ()
360
{
361
}
362
 
363
#ifdef PROTOTYPES
364
void call6j (unsigned long ul)
365
#else
366
call6j (ul)
367
unsigned long ul;
368
#endif
369
{
370
  ul = ul;
371
    call6k ();
372
}
373
 
374
#ifdef PROTOTYPES
375
void call6i (unsigned int ui, unsigned long ul)
376
#else
377
call6i (ui, ul)
378
unsigned int ui; unsigned long ul;
379
#endif
380
{
381
  ui = ui;
382
    call6j (ul);
383
}
384
 
385
#ifdef PROTOTYPES
386
void call6h (unsigned short us, unsigned int ui, unsigned long ul)
387
#else
388
call6h (us, ui, ul)
389
unsigned short us; unsigned int ui; unsigned long ul;
390
#endif
391
{
392
  us = us;
393
    call6i (ui, ul);
394
}
395
 
396
#ifdef PROTOTYPES
397
void call6g (unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul)
398
#else
399
call6g (uc, us, ui, ul)
400
unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul;
401
#endif
402
{
403
  uc = uc;
404
    call6h (us, ui, ul);
405
}
406
 
407
#ifdef PROTOTYPES
408
void call6f (double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul)
409
#else
410
call6f (d, uc, us, ui, ul)
411
double d;
412
unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul;
413
#endif
414
{
415
  d = d;
416
    call6g (uc, us, ui, ul);
417
}
418
 
419
#ifdef PROTOTYPES
420
void call6e (float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul)
421
#else
422
call6e (f, d, uc, us, ui, ul)
423
float f; double d;
424
unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul;
425
#endif
426
{
427
  f = f;
428
    call6f (d, uc, us, ui, ul);
429
}
430
 
431
#ifdef PROTOTYPES
432
void call6d (long l, float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul)
433
#else
434
call6d (l, f, d, uc, us, ui, ul)
435
long l; float f; double d;
436
unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul;
437
#endif
438
{
439
  l = l;
440
    call6e (f, d, uc, us, ui, ul);
441
}
442
 
443
#ifdef PROTOTYPES
444
void call6c (int i, long l, float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul)
445
#else
446
call6c (i, l, f, d, uc, us, ui, ul)
447
int i; long l; float f; double d;
448
unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul;
449
#endif
450
{
451
  i = i;
452
    call6d (l, f, d, uc, us, ui, ul);
453
}
454
 
455
#ifdef PROTOTYPES
456
void call6b (short s, int i, long l, float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul)
457
#else
458
call6b (s, i, l, f, d, uc, us, ui, ul)
459
short s; int i; long l; float f; double d;
460
unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul;
461
#endif
462
{
463
  s = s;
464
    call6c (i, l, f, d, uc, us, ui, ul);
465
}
466
 
467
#ifdef PROTOTYPES
468
void call6a (char c, short s, int i, long l, float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul)
469
#else
470
call6a (c, s, i, l, f, d, uc, us, ui, ul)
471
char c; short s; int i; long l; float f; double d;
472
unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul;
473
#endif
474
{
475
  c = c;
476
    call6b (s, i, l, f, d, uc, us, ui, ul);
477
}
478
 
479
/*  Test shuffling of args, round robin */
480
 
481
 
482
#ifdef PROTOTYPES
483
void call7k (char c, int i, short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui)
484
#else
485
call7k (c, i, s, l, f, uc, d, us, ul, ui)
486
char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui;
487
#endif
488
{
489
  c = 'a'; i = 7; s = 8; l = 7; f = 0.3; uc = 44; d = 0.44; us = 77;
490
  ul = 43; ui = 33;
491
}
492
 
493
#ifdef PROTOTYPES
494
void call7j (unsigned int ui, char c, int i, short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul)
495
#else
496
call7j (ui, c, i, s, l, f, uc, d, us, ul)
497
unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul;
498
#endif
499
{
500
    call7k (c, i, s, l, f, uc, d, us, ul, ui);
501
}
502
 
503
#ifdef PROTOTYPES
504
void call7i (unsigned long ul, unsigned int ui, char c, int i, short s, long l, float f, unsigned char uc, double d, unsigned short us)
505
#else
506
call7i (ul, ui, c, i, s, l, f, uc, d, us)
507
unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us;
508
#endif
509
{
510
    call7j (ui, c, i, s, l, f, uc, d, us, ul);
511
}
512
 
513
#ifdef PROTOTYPES
514
void call7h (unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s, long l, float f, unsigned char uc, double d)
515
#else
516
call7h (us, ul, ui, c, i, s, l, f, uc, d)
517
unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d;
518
#endif
519
{
520
    call7i (ul, ui, c, i, s, l, f, uc, d, us);
521
}
522
 
523
#ifdef PROTOTYPES
524
void call7g (double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s, long l, float f, unsigned char uc)
525
#else
526
call7g (d, us, ul, ui, c, i, s, l, f, uc)
527
double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc;
528
#endif
529
{
530
    call7h (us, ul, ui, c, i, s, l, f, uc, d);
531
}
532
 
533
#ifdef PROTOTYPES
534
void call7f (unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s, long l, float f)
535
#else
536
call7f (uc, d, us, ul, ui, c, i, s, l, f)
537
unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f;
538
#endif
539
{
540
    call7g (d, us, ul, ui, c, i, s, l, f, uc);
541
}
542
 
543
#ifdef PROTOTYPES
544
void call7e (float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s, long l)
545
#else
546
call7e (f, uc, d, us, ul, ui, c, i, s, l)
547
float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l;
548
#endif
549
{
550
    call7f (uc, d, us, ul, ui, c, i, s, l, f);
551
}
552
 
553
#ifdef PROTOTYPES
554
void call7d (long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s)
555
#else
556
call7d (l, f, uc, d, us, ul, ui, c, i, s)
557
long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s;
558
#endif
559
{
560
    call7e (f, uc, d, us, ul, ui, c, i, s, l);
561
}
562
 
563
#ifdef PROTOTYPES
564
void call7c (short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i)
565
#else
566
call7c (s, l, f, uc, d, us, ul, ui, c, i)
567
short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i;
568
#endif
569
{
570
    call7d (l, f, uc, d, us, ul, ui, c, i, s);
571
}
572
 
573
#ifdef PROTOTYPES
574
void call7b (int i, short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c)
575
#else
576
call7b (i, s, l, f, uc, d, us, ul, ui, c)
577
int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c;
578
#endif
579
{
580
    call7c (s, l, f, uc, d, us, ul, ui, c, i);
581
}
582
 
583
#ifdef PROTOTYPES
584
void call7a (char c, int i, short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui)
585
#else
586
call7a (c, i, s, l, f, uc, d, us, ul, ui)
587
char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui;
588
#endif
589
{
590
    call7b (i, s, l, f, uc, d, us, ul, ui, c);
591
}
592
 
593
 
594
/*  Test printing of structures passed as arguments to recursive functions. */
595
 
596
 
597
typedef struct s
598
{
599
  short s;
600
  int i;
601
  long l;
602
} SVAL;
603
 
604
void hitbottom ()
605
{
606
}
607
 
608
#ifdef PROTOTYPES
609
void recurse (SVAL a, int depth)
610
#else
611
void recurse (a, depth)
612
SVAL a;
613
int depth;
614
#endif
615
{
616
  a.s = a.i = a.l = --depth;
617
  if (depth == 0)
618
    hitbottom ();
619
  else
620
    recurse (a, depth);
621
}
622
 
623
void test_struct_args ()
624
{
625
  SVAL s; s.s = 5; s.i = 5; s.l = 5;
626
 
627
  recurse (s, 5);
628
}
629
 
630
/* On various machines (pa, 29k, and rs/6000, at least), a function which
631
   calls alloca may do things differently with respect to frames.  So give
632
   it a try.  */
633
 
634
#ifdef PROTOTYPES
635
void localvars_after_alloca (char c, short s, int i, long l)
636
#else
637
int
638
localvars_after_alloca (c, s, i, l)
639
     char c;
640
     short s;
641
     int i;
642
     long l;
643
#endif
644
{
645
#ifdef HAVE_STACK_ALLOCA
646
  /* No need to use the alloca.c alloca-on-top-of-malloc; it doesn't
647
     test what we are looking for, so if we don't have an alloca which
648
     allocates on the stack, just don't bother to call alloca at all.  */
649
 
650
  char *z = alloca (s + 50);
651
#endif
652
  c = 'a';
653
  s = 5;
654
  i = 6;
655
  l = 7;
656
}
657
 
658
#ifdef PROTOTYPES
659
void call_after_alloca_subr (char c, short s, int i, long l, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul)
660
#else
661
void
662
call_after_alloca_subr (c, s, i, l, uc, us, ui, ul)
663
char c; int i; short s; long l; unsigned char uc; unsigned short us; unsigned long ul; unsigned int ui;
664
#endif
665
{
666
  c = 'a';
667
  i = 7; s = 8; l = 7; uc = 44; us = 77;
668
  ul = 43; ui = 33;
669
}
670
 
671
#ifdef PROTOTYPES
672
void call_after_alloca (char c, short s, int i, long l)
673
#else
674
int
675
call_after_alloca (c, s, i, l)
676
     char c;
677
     short s;
678
     int i;
679
     long l;
680
#endif
681
{
682
#ifdef HAVE_STACK_ALLOCA
683
  /* No need to use the alloca.c alloca-on-top-of-malloc; it doesn't
684
     test what we are looking for, so if we don't have an alloca which
685
     allocates on the stack, just don't bother to call alloca at all.  */
686
 
687
  char *z = alloca (s + 50);
688
#endif
689
  call_after_alloca_subr (c, s, i, l, 'b', 11, 12, (unsigned long)13);
690
}
691
 
692
 
693
 
694
/* The point behind this test is the PA will call this indirectly
695
   through dyncall.  Unlike the indirect calls to call0a, this test
696
   will require a trampoline between dyncall and this function on the
697
   call path, then another trampoline on between this function and main
698
   on the return path.  */
699
#ifdef PROTOTYPES
700
double call_with_trampolines (double d1)
701
#else
702
double
703
call_with_trampolines (d1)
704
double d1;
705
#endif
706
{
707
  return d1;
708
} /* End of call_with_trampolines, this comment is needed by funcargs.exp */
709
 
710
/* Dummy functions which the testsuite can use to run to, etc.  */
711
 
712
void
713
marker_indirect_call () {}
714
 
715
void
716
marker_call_with_trampolines () {}
717
 
718
int main ()
719
{
720
  void (*pointer_to_call0a) (char, short, int, long) = (void (*)(char, short, int, long))call0a;
721
  double (*pointer_to_call_with_trampolines) (double) = call_with_trampolines;
722
 
723
#ifdef usestubs
724
  set_debug_traps();
725
  breakpoint();
726
#endif
727
  /* Test calling with basic integer types */
728
  call0a (c, s, i, l);
729
  call0b (s, i, l, c);
730
  call0c (i, l, c, s);
731
  call0d (l, c, s, i);
732
  call0e (c, l, c, i, c, s, c, c);
733
 
734
  /* Test calling with unsigned integer types */
735
  call1a (uc, us, ui, ul);
736
  call1b (us, ui, ul, uc);
737
  call1c (ui, ul, uc, us);
738
  call1d (ul, uc, us, ui);
739
  call1e (uc, ul, uc, ui, uc, us, uc, uc);
740
 
741
  /* Test calling with integral types mixed with floating point types */
742
  call2a (c, f, s, d, i, f, l, d);
743
  call2b (f, s, d, i, f, l, d, c);
744
  call2c (s, d, i, f, l, d, c, f);
745
  call2d (d, i, f, l, d, c, f, s);
746
  call2e (i, f, l, d, c, f, s, d);
747
  call2f (f, l, d, c, f, s, d, i);
748
  call2g (l, d, c, f, s, d, i, f);
749
  call2h (d, c, f, s, d, i, f, l);
750
  call2i (c, f, c, c, d, c, c, c, f, s, c, d);;
751
 
752
  /* Test dereferencing pointers to various integral and floating types */
753
 
754
  call3a (cp, sp, ip, lp);
755
  call3b (ucp, usp, uip, ulp);
756
  call3c (fp, dp);
757
 
758
  /* Test dereferencing pointers to structs and unions */
759
 
760
  call4a (stp);
761
  un.u1 = 1;
762
  call4b (unp);
763
 
764
  /* Test calling with structures and unions. */
765
 
766
  call5a (st);
767
  un.u1 = 2;
768
  call5b (un);
769
 
770
  /* Test shuffling of args */
771
 
772
  call6a (c, s, i, l, f, d, uc, us, ui, ul);
773
  call7a (c, i, s, l, f, uc, d, us, ul, ui);
774
 
775
  /* Test passing structures recursively. */
776
 
777
  test_struct_args ();
778
 
779
  localvars_after_alloca (c, s, i, l);
780
 
781
  call_after_alloca (c, s, i, l);
782
 
783
  /* This is for localvars_in_indirect_call.  */
784
  marker_indirect_call ();
785
  /* The comment on the following two lines is used by funcargs.exp,
786
     don't change it.  */
787
  (*pointer_to_call0a) (c, s, i, l);    /* First step into call0a.  */
788
  (*pointer_to_call0a) (c, s, i, l);    /* Second step into call0a.  */
789
  marker_call_with_trampolines ();
790
  (*pointer_to_call_with_trampolines) (d); /* Test multiple trampolines.  */
791
  return 0;
792
}

powered by: WebSVN 2.1.0

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