aboutsummaryrefslogtreecommitdiff
path: root/test/varargs+x86_64-sysv.c
blob: dfa1b98bc3b7483aa4bc07c80ecdc319efda96e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
int f1(int n, __builtin_va_list ap) {
	return __builtin_va_arg(ap, int);
}

int f2(int n, ...) {
	int r;
	__builtin_va_list ap;

	__builtin_va_start(ap, n);
	r = f1(n, ap);
	__builtin_va_end(ap);
	return r;
}

void f3(int n, ...) {
	__builtin_va_list ap;

	__builtin_va_start(ap, n);
	while (n) {
		__builtin_va_arg(ap, int);
		__builtin_va_arg(ap, float);
		__builtin_va_arg(ap, char *);
		--n;
	}
	__builtin_va_end(ap);
}

void f4(...) {
	__builtin_va_list ap;
	__builtin_va_start(ap);
	__builtin_va_arg(ap, double);
	__builtin_va_arg(ap, int);
	__builtin_va_end(ap);
}