xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/mrtd.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -DMRTD -mrtd -triple i386-unknown-unknown -verify %s
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-unknown-unknown -verify %s
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc #ifndef MRTD
5*f4a2713aSLionel Sambuc // expected-note@+5 {{previous declaration is here}}
6*f4a2713aSLionel Sambuc // expected-error@+5 {{function declared 'stdcall' here was previously declared without calling convention}}
7*f4a2713aSLionel Sambuc // expected-note@+5 {{previous declaration is here}}
8*f4a2713aSLionel Sambuc // expected-error@+5 {{function declared 'stdcall' here was previously declared without calling convention}}
9*f4a2713aSLionel Sambuc #endif
10*f4a2713aSLionel Sambuc void nonvariadic1(int a, int b, int c);
11*f4a2713aSLionel Sambuc void __attribute__((stdcall)) nonvariadic1(int a, int b, int c);
12*f4a2713aSLionel Sambuc void nonvariadic2(int a, int b, int c);
nonvariadic2(int a,int b,int c)13*f4a2713aSLionel Sambuc void __attribute__((stdcall)) nonvariadic2(int a, int b, int c) { }
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc // expected-warning@+2 {{stdcall calling convention ignored on variadic function}}
16*f4a2713aSLionel Sambuc void variadic(int a, ...);
17*f4a2713aSLionel Sambuc void __attribute__((stdcall)) variadic(int a, ...);
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc #ifdef MRTD
20*f4a2713aSLionel Sambuc // expected-note@+3 {{previous definition is here}}
21*f4a2713aSLionel Sambuc // expected-error@+3 {{redefinition of 'a' with a different type: 'void ((*))(int, int) __attribute__((cdecl))' vs 'void (*)(int, int) __attribute__((stdcall))'}}
22*f4a2713aSLionel Sambuc #endif
23*f4a2713aSLionel Sambuc extern void (*a)(int, int);
24*f4a2713aSLionel Sambuc __attribute__((cdecl)) extern void (*a)(int, int);
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc extern void (*b)(int, ...);
27*f4a2713aSLionel Sambuc __attribute__((cdecl)) extern void (*b)(int, ...);
28*f4a2713aSLionel Sambuc 
29*f4a2713aSLionel Sambuc #ifndef MRTD
30*f4a2713aSLionel Sambuc // expected-note@+3 {{previous definition is here}}
31*f4a2713aSLionel Sambuc // expected-error@+3 {{redefinition of 'c' with a different type: 'void ((*))(int, int) __attribute__((stdcall))' vs 'void (*)(int, int)'}}
32*f4a2713aSLionel Sambuc #endif
33*f4a2713aSLionel Sambuc extern void (*c)(int, int);
34*f4a2713aSLionel Sambuc __attribute__((stdcall)) extern void (*c)(int, int);
35*f4a2713aSLionel Sambuc 
36*f4a2713aSLionel Sambuc // expected-warning@+2 {{stdcall calling convention ignored on variadic function}}
37*f4a2713aSLionel Sambuc extern void (*d)(int, ...);
38*f4a2713aSLionel Sambuc __attribute__((stdcall)) extern void (*d)(int, ...);
39