aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Sema/knr-variadic-def.c
blob: d5b49f51a5697de93b240370e87dda8c3bc75bcc (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
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s -std=c99
// PR4287

#include <stdarg.h>
char *foo = "test";
int test(char*,...);

int test(fmt) // expected-warning {{a function definition without a prototype is deprecated in all versions of C and is not supported in C23}}
        char*fmt;
{
        va_list ap;
        char*a;
        int x;

        va_start(ap,fmt);
        a=va_arg(ap,char*);
        x=(a!=foo);
        va_end(ap);
        return x;
}

void exit(); // expected-warning {{a function declaration without a prototype is deprecated in all versions of C}}

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}}
        int argc;char**argv;
{
        exit(test("",foo));
}