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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [va-arg-9.c] - Blame information for rev 825

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

Line No. Rev Author Line
1 149 jeremybenn
/* This is a modfied version of va-arg-2.c to test passing a va_list as
2
   a parameter to another function.  */
3
 
4
#include <stdarg.h>
5
 
6
extern __SIZE_TYPE__ strlen (const char *);
7
 
8
int
9
to_hex (unsigned int a)
10
{
11
  static char hex[] = "0123456789abcdef";
12
 
13
  if (a > 15)
14
    abort ();
15
  return hex[a];
16
}
17
 
18
void
19
fap (int i, char* format, va_list ap)
20
{
21
  if (strlen (format) != 16 - i)
22
    abort ();
23
  while (*format)
24
    if (*format++ != to_hex (va_arg (ap, int)))
25
      abort ();
26
}
27
 
28
void
29
f0 (char* format, ...)
30
{
31
  va_list ap;
32
 
33
  va_start (ap, format);
34
  fap(0, format, ap);
35
  va_end(ap);
36
}
37
 
38
void
39
f1 (int a1, char* format, ...)
40
{
41
  va_list ap;
42
 
43
  va_start(ap, format);
44
  fap(1, format, ap);
45
  va_end(ap);
46
}
47
 
48
void
49
f2 (int a1, int a2, char* format, ...)
50
{
51
  va_list ap;
52
 
53
  va_start(ap, format);
54
  fap(2, format, ap);
55
  va_end(ap);
56
}
57
 
58
void
59
f3 (int a1, int a2, int a3, char* format, ...)
60
{
61
  va_list ap;
62
 
63
  va_start(ap, format);
64
  fap(3, format, ap);
65
  va_end(ap);
66
}
67
 
68
void
69
f4 (int a1, int a2, int a3, int a4, char* format, ...)
70
{
71
  va_list ap;
72
 
73
  va_start(ap, format);
74
  fap(4, format, ap);
75
  va_end(ap);
76
}
77
 
78
void
79
f5 (int a1, int a2, int a3, int a4, int a5,
80
    char* format, ...)
81
{
82
  va_list ap;
83
 
84
  va_start(ap, format);
85
  fap(5, format, ap);
86
  va_end(ap);
87
}
88
 
89
void
90
f6 (int a1, int a2, int a3, int a4, int a5,
91
    int a6,
92
    char* format, ...)
93
{
94
  va_list ap;
95
 
96
  va_start(ap, format);
97
  fap(6, format, ap);
98
  va_end(ap);
99
}
100
 
101
void
102
f7 (int a1, int a2, int a3, int a4, int a5,
103
    int a6, int a7,
104
    char* format, ...)
105
{
106
  va_list ap;
107
 
108
  va_start(ap, format);
109
  fap(7, format, ap);
110
  va_end(ap);
111
}
112
 
113
void
114
f8 (int a1, int a2, int a3, int a4, int a5,
115
    int a6, int a7, int a8,
116
    char* format, ...)
117
{
118
  va_list ap;
119
 
120
  va_start(ap, format);
121
  fap(8, format, ap);
122
  va_end(ap);
123
}
124
 
125
void
126
f9 (int a1, int a2, int a3, int a4, int a5,
127
    int a6, int a7, int a8, int a9,
128
    char* format, ...)
129
{
130
  va_list ap;
131
 
132
  va_start(ap, format);
133
  fap(9, format, ap);
134
  va_end(ap);
135
}
136
 
137
void
138
f10 (int a1, int a2, int a3, int a4, int a5,
139
     int a6, int a7, int a8, int a9, int a10,
140
     char* format, ...)
141
{
142
  va_list ap;
143
 
144
  va_start(ap, format);
145
  fap(10, format, ap);
146
  va_end(ap);
147
}
148
 
149
void
150
f11 (int a1, int a2, int a3, int a4, int a5,
151
     int a6, int a7, int a8, int a9, int a10,
152
     int a11,
153
     char* format, ...)
154
{
155
  va_list ap;
156
 
157
  va_start(ap, format);
158
  fap(11, format, ap);
159
  va_end(ap);
160
}
161
 
162
void
163
f12 (int a1, int a2, int a3, int a4, int a5,
164
     int a6, int a7, int a8, int a9, int a10,
165
     int a11, int a12,
166
     char* format, ...)
167
{
168
  va_list ap;
169
 
170
  va_start(ap, format);
171
  fap(12, format, ap);
172
  va_end(ap);
173
}
174
 
175
void
176
f13 (int a1, int a2, int a3, int a4, int a5,
177
     int a6, int a7, int a8, int a9, int a10,
178
     int a11, int a12, int a13,
179
     char* format, ...)
180
{
181
  va_list ap;
182
 
183
  va_start(ap, format);
184
  fap(13, format, ap);
185
  va_end(ap);
186
}
187
 
188
void
189
f14 (int a1, int a2, int a3, int a4, int a5,
190
     int a6, int a7, int a8, int a9, int a10,
191
     int a11, int a12, int a13, int a14,
192
     char* format, ...)
193
{
194
  va_list ap;
195
 
196
  va_start(ap, format);
197
  fap(14, format, ap);
198
  va_end(ap);
199
}
200
 
201
void
202
f15 (int a1, int a2, int a3, int a4, int a5,
203
     int a6, int a7, int a8, int a9, int a10,
204
     int a11, int a12, int a13, int a14, int a15,
205
     char* format, ...)
206
{
207
  va_list ap;
208
 
209
  va_start(ap, format);
210
  fap(15, format, ap);
211
  va_end(ap);
212
}
213
 
214
main ()
215
{
216
  char *f = "0123456789abcdef";
217
 
218
  f0 (f+0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
219
  f1 (0, f+1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
220
  f2 (0, 1, f+2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
221
  f3 (0, 1, 2, f+3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
222
  f4 (0, 1, 2, 3, f+4, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
223
  f5 (0, 1, 2, 3, 4, f+5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
224
  f6 (0, 1, 2, 3, 4, 5, f+6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
225
  f7 (0, 1, 2, 3, 4, 5, 6, f+7, 7, 8, 9, 10, 11, 12, 13, 14, 15);
226
  f8 (0, 1, 2, 3, 4, 5, 6, 7, f+8, 8, 9, 10, 11, 12, 13, 14, 15);
227
  f9 (0, 1, 2, 3, 4, 5, 6, 7, 8, f+9, 9, 10, 11, 12, 13, 14, 15);
228
  f10 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, f+10, 10, 11, 12, 13, 14, 15);
229
  f11 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, f+11, 11, 12, 13, 14, 15);
230
  f12 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, f+12, 12, 13, 14, 15);
231
  f13 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, f+13, 13, 14, 15);
232
  f14 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, f+14, 14, 15);
233
  f15 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, f+15, 15);
234
 
235
  exit (0);
236
}

powered by: WebSVN 2.1.0

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