[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / mrtd.c
blob0ce08880606435cb2957aaa41411b2c5355489cc
1 // RUN: %clang_cc1 -DMRTD -mrtd -triple i386-unknown-unknown -verify %s
2 // RUN: %clang_cc1 -triple i386-unknown-unknown -verify %s
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);
13 void __attribute__((stdcall)) nonvariadic2(int a, int b, int c) { }
15 // expected-warning@+2 {{stdcall calling convention is not supported on variadic function}}
16 void variadic(int a, ...);
17 void __attribute__((stdcall)) variadic(int a, ...);
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);
26 extern void (*b)(int, ...);
27 __attribute__((cdecl)) extern void (*b)(int, ...);
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);
36 // expected-warning@+2 {{stdcall calling convention is not supported on variadic function}}
37 extern void (*d)(int, ...);
38 __attribute__((stdcall)) extern void (*d)(int, ...);