xref: /llvm-project/clang/test/Sema/no_callconv.cpp (revision c166a43c6e6157b1309ea757324cc0a71c078e66)
1 // RUN: %clang_cc1 %s -triple x86_64-scei-ps4 -DPS4 -fsyntax-only -verify
2 // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -fsyntax-only -verify
3 
4 #ifdef PS4
5 
6 // PS4 does not support these.
func_vc()7 void __vectorcall func_vc() {} // expected-error {{'__vectorcall' calling convention is not supported for this target}}
func_rc()8 void __regcall func_rc() {} // expected-error {{'__regcall' calling convention is not supported for this target}}
funcA()9 void __attribute__((vectorcall)) funcA() {} // expected-error {{'vectorcall' calling convention is not supported for this target}}
funcB()10 void __attribute__((regcall)) funcB() {} // expected-error {{'regcall' calling convention is not supported for this target}}
funcH()11 void __attribute__((ms_abi)) funcH() {} // expected-error {{'ms_abi' calling convention is not supported for this target}}
funcJ()12 void __attribute__((intel_ocl_bicc)) funcJ() {} // expected-error {{'intel_ocl_bicc' calling convention is not supported for this target}}
funcK()13 void __attribute__((swiftcall)) funcK() {} // expected-error {{'swiftcall' calling convention is not supported for this target}}
funcKK()14 void __attribute__((swiftasynccall)) funcKK() {} // expected-error {{'swiftasynccall' calling convention is not supported for this target}}
funcG()15 void __attribute__((pascal)) funcG() {} // expected-error {{'pascal' calling convention is not supported for this target}}
funcL()16 void __attribute__((preserve_most)) funcL() {} // expected-error {{'preserve_most' calling convention is not supported for this target}}
funcM()17 void __attribute__((preserve_all)) funcM() {} // expected-error {{'preserve_all' calling convention is not supported for this target}}
funcN()18 void __attribute__((preserve_none)) funcN() {} // expected-error {{'preserve_none' calling convention is not supported for this target}}
funcD()19 void __attribute__((stdcall)) funcD() {} // expected-error {{'stdcall' calling convention is not supported for this target}}
funcE()20 void __attribute__((fastcall)) funcE() {} // expected-error {{'fastcall' calling convention is not supported for this target}}
funcF()21 void __attribute__((thiscall)) funcF() {} // expected-error {{'thiscall' calling convention is not supported for this target}}
22 #else
23 
func_vc()24 void __vectorcall func_vc() {}
func_rc()25 void __regcall func_rc() {}
funcA()26 void __attribute__((vectorcall)) funcA() {}
funcB()27 void __attribute__((regcall)) funcB() {}
funcH()28 void __attribute__((ms_abi)) funcH() {}
funcJ()29 void __attribute__((intel_ocl_bicc)) funcJ() {}
funcK()30 void __attribute__((swiftcall)) funcK() {}
funcKK()31 void __attribute__((swiftasynccall)) funcKK() {}
funcL()32 void __attribute__((preserve_most)) funcL() {}
funcM()33 void __attribute__((preserve_all)) funcM() {}
funcN()34 void __attribute__((preserve_none)) funcN() {}
35 
36 // Same function with different calling conventions. Error with a note pointing to the last decl.
37 void __attribute__((preserve_all)) funcR(); // expected-note {{previous declaration is here}}
38 void __attribute__((preserve_most)) funcR(); // expected-error {{function declared 'preserve_most' here was previously declared 'preserve_all'}}
39 
funcG()40 void __attribute__((pascal)) funcG() {} // expected-warning {{'pascal' calling convention is not supported for this target}}
41 
funcD()42 void __attribute__((stdcall)) funcD() {} // expected-warning {{'stdcall' calling convention is not supported for this target}}
funcE()43 void __attribute__((fastcall)) funcE() {} // expected-warning {{'fastcall' calling convention is not supported for this target}}
funcF()44 void __attribute__((thiscall)) funcF() {} // expected-warning {{'thiscall' calling convention is not supported for this target}}
45 #endif
46 
funcI()47 void __attribute__((sysv_abi)) funcI() {}
funcC()48 void __attribute__((cdecl)) funcC() {}
49