2008-09-30 06:28:25 +08:00
|
|
|
// RUN: clang -fsyntax-only -verify %s &&
|
|
|
|
// RUN: clang -fsyntax-only -verify %s -triple x86_64-apple-darwin9
|
2007-10-13 01:48:41 +08:00
|
|
|
|
|
|
|
void f1(int a)
|
|
|
|
{
|
|
|
|
__builtin_va_list ap;
|
|
|
|
|
|
|
|
__builtin_va_start(ap, a, a); // expected-error {{too many arguments to function}}
|
|
|
|
__builtin_va_start(ap, a); // expected-error {{'va_start' used in function with fixed args}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void f2(int a, int b, ...)
|
|
|
|
{
|
|
|
|
__builtin_va_list ap;
|
|
|
|
|
|
|
|
__builtin_va_start(ap, 10); // expected-warning {{second parameter of 'va_start' not last named argument}}
|
|
|
|
__builtin_va_start(ap, a); // expected-warning {{second parameter of 'va_start' not last named argument}}
|
|
|
|
__builtin_va_start(ap, b);
|
|
|
|
}
|
2008-02-11 12:20:54 +08:00
|
|
|
|
|
|
|
void f3(float a, ...)
|
|
|
|
{
|
|
|
|
__builtin_va_list ap;
|
|
|
|
|
|
|
|
__builtin_va_start(ap, a);
|
|
|
|
__builtin_va_start(ap, (a));
|
|
|
|
}
|
2008-11-17 02:43:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
// stdarg: PR3075
|
|
|
|
void f4(const char *msg, ...) {
|
|
|
|
__builtin_va_list ap;
|
|
|
|
__builtin_stdarg_start((ap), (msg));
|
|
|
|
__builtin_va_end (ap);
|
|
|
|
}
|
|
|
|
|
2008-12-16 06:05:35 +08:00
|
|
|
void f5() {
|
|
|
|
__builtin_va_list ap;
|
|
|
|
__builtin_va_start(ap,ap); // expected-error {{'va_start' used in function with fixed args}}
|
|
|
|
}
|
|
|
|
|
|
|
|
void f6(int a, ...) {
|
|
|
|
__builtin_va_list ap;
|
|
|
|
__builtin_va_start(ap); // expected-error {{too few arguments to function}}
|
|
|
|
}
|