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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [va-arg-10.c] - Blame information for rev 297

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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