xref: /aosp_15_r20/external/clang/test/Sema/callingconv-iamcu.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 %s -fsyntax-only -triple i686-intel-elfiamcu -verify
2*67e74705SXin Li 
foo(float * a)3*67e74705SXin Li void __attribute__((fastcall)) foo(float *a) { // expected-warning {{calling convention 'fastcall' ignored for this target}}
4*67e74705SXin Li }
5*67e74705SXin Li 
bar(float * a)6*67e74705SXin Li void __attribute__((stdcall)) bar(float *a) { // expected-warning {{calling convention 'stdcall' ignored for this target}}
7*67e74705SXin Li }
8*67e74705SXin Li 
baz(float * a)9*67e74705SXin Li void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{'fastcall' attribute takes no arguments}}
10*67e74705SXin Li }
11*67e74705SXin Li 
test2(int a,...)12*67e74705SXin Li void __attribute__((fastcall)) test2(int a, ...) { // expected-warning {{calling convention 'fastcall' ignored for this target}}
13*67e74705SXin Li }
test3(int a,...)14*67e74705SXin Li void __attribute__((stdcall)) test3(int a, ...) { // expected-warning {{calling convention 'stdcall' ignored for this target}}
15*67e74705SXin Li }
test4(int a,...)16*67e74705SXin Li void __attribute__((thiscall)) test4(int a, ...) { // expected-warning {{calling convention 'thiscall' ignored for this target}}
17*67e74705SXin Li }
18*67e74705SXin Li 
ctest0()19*67e74705SXin Li void __attribute__((cdecl)) ctest0() {}
20*67e74705SXin Li 
ctest1(float x)21*67e74705SXin Li void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{'cdecl' attribute takes no arguments}}
22*67e74705SXin Li 
23*67e74705SXin Li void (__attribute__((fastcall)) *pfoo)(float*) = foo; // expected-warning {{calling convention 'fastcall' ignored for this target}}
24*67e74705SXin Li 
25*67e74705SXin Li void (__attribute__((stdcall)) *pbar)(float*) = bar; // expected-warning {{calling convention 'stdcall' ignored for this target}}
26*67e74705SXin Li 
27*67e74705SXin Li void (*pctest0)() = ctest0;
28*67e74705SXin Li 
ctest2()29*67e74705SXin Li void ctest2() {}
30*67e74705SXin Li void (__attribute__((cdecl)) *pctest2)() = ctest2;
31*67e74705SXin Li 
32*67e74705SXin Li typedef void (__attribute__((fastcall)) *Handler) (float *); // expected-warning {{calling convention 'fastcall' ignored for this target}}
33*67e74705SXin Li Handler H = foo;
34*67e74705SXin Li 
35*67e74705SXin Li int __attribute__((pcs("aapcs", "aapcs"))) pcs1(void); // expected-error {{'pcs' attribute takes one argument}}
36*67e74705SXin Li int __attribute__((pcs())) pcs2(void); // expected-error {{'pcs' attribute takes one argument}}
37*67e74705SXin Li int __attribute__((pcs(pcs1))) pcs3(void); // expected-error {{'pcs' attribute requires a string}} \
38*67e74705SXin Li                                            // expected-error {{invalid PCS type}}
39*67e74705SXin Li int __attribute__((pcs(0))) pcs4(void); // expected-error {{'pcs' attribute requires a string}}
40*67e74705SXin Li /* These are ignored because the target is i386 and not ARM */
41*67e74705SXin Li int __attribute__((pcs("aapcs"))) pcs5(void); // expected-warning {{calling convention 'pcs' ignored for this target}}
42*67e74705SXin Li int __attribute__((pcs("aapcs-vfp"))) pcs6(void); // expected-warning {{calling convention 'pcs' ignored for this target}}
43*67e74705SXin Li int __attribute__((pcs("foo"))) pcs7(void); // expected-error {{invalid PCS type}}
44*67e74705SXin Li 
45*67e74705SXin Li void ctest3();
ctest3()46*67e74705SXin Li void __attribute__((cdecl)) ctest3() {}
47*67e74705SXin Li 
48*67e74705SXin Li typedef __attribute__((stdcall)) void (*PROC)(); // expected-warning {{calling convention 'stdcall' ignored for this target}}
ctest4(const char * x)49*67e74705SXin Li PROC __attribute__((cdecl)) ctest4(const char *x) {}
50*67e74705SXin Li 
inteloclbifunc(float * a)51*67e74705SXin Li void __attribute__((intel_ocl_bicc)) inteloclbifunc(float *a) {} // expected-warning {{calling convention 'intel_ocl_bicc' ignored for this target}}
52*67e74705SXin Li 
53*67e74705SXin Li struct type_test {} __attribute__((stdcall)); // expected-warning {{calling convention 'stdcall' ignored for this target}} expected-warning {{'stdcall' attribute only applies to functions and methods}}
54