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