| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s -std=c99 |
| 2 |
// PR4287 |
| 3 |
|
| 4 |
#include <stdarg.h> |
| 5 |
char *foo = "test"; |
| 6 |
int test(char*,...); |
| 7 |
|
| 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; |
| 10 |
{ |
| 11 |
va_list ap; |
| 12 |
char*a; |
| 13 |
int x; |
| 14 |
|
| 15 |
va_start(ap,fmt); |
| 16 |
a=va_arg(ap,char*); |
| 17 |
x=(a!=foo); |
| 18 |
va_end(ap); |
| 19 |
return x; |
| 20 |
} |
| 21 |
|
| 22 |
void exit(); // expected-warning {{a function declaration without a prototype is deprecated in all versions of C}} |
| 23 |
|
| 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; |
| 26 |
{ |
| 27 |
exit(test("",foo)); |
| 28 |
} |
| 29 |
|