[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / knr-variadic-def.c
blobd5b49f51a5697de93b240370e87dda8c3bc75bcc
1 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s -std=c99
2 // PR4287
4 #include <stdarg.h>
5 char *foo = "test";
6 int test(char*,...);
8 int test(fmt) // expected-warning {{a function definition without a prototype is deprecated in all versions of C and is not supported in C23}}
9 char*fmt;
11 va_list ap;
12 char*a;
13 int x;
15 va_start(ap,fmt);
16 a=va_arg(ap,char*);
17 x=(a!=foo);
18 va_end(ap);
19 return x;
22 void exit(); // expected-warning {{a function declaration without a prototype is deprecated in all versions of C}}
24 int main(argc,argv) // expected-warning {{a function definition without a prototype is deprecated in all versions of C and is not supported in C23}}
25 int argc;char**argv;
27 exit(test("",foo));