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