• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 %s -fsyntax-only -triple i386-unknown-unknown -verify
2 
foo(float * a)3 void __attribute__((fastcall)) foo(float *a) {
4 }
5 
bar(float * a)6 void __attribute__((stdcall)) bar(float *a) {
7 }
8 
baz(float * a)9 void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{attribute takes no arguments}}
10 }
11 
test0()12 void __attribute__((fastcall)) test0() { // expected-error {{function with no prototype cannot use fastcall calling convention}}
13 }
14 
test1(void)15 void __attribute__((fastcall)) test1(void) {
16 }
17 
test2(int a,...)18 void __attribute__((fastcall)) test2(int a, ...) { // expected-error {{variadic function cannot use fastcall calling convention}}
19 }
20 
ctest0()21 void __attribute__((cdecl)) ctest0() {}
22 
ctest1(float x)23 void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{attribute takes no arguments}}
24 
25 void (__attribute__((fastcall)) *pfoo)(float*) = foo;
26 
27 void (__attribute__((stdcall)) *pbar)(float*) = bar;
28 
29 void (__attribute__((cdecl)) *ptest1)(void) = test1; // expected-warning {{incompatible pointer types}}
30 
31 void (*pctest0)() = ctest0;
32 
ctest2()33 void ctest2() {}
34 void (__attribute__((cdecl)) *pctest2)() = ctest2;
35 
36 typedef void (__attribute__((fastcall)) *Handler) (float *);
37 Handler H = foo;
38 
39 int __attribute__((pcs("aapcs", "aapcs"))) pcs1(void); // expected-error {{attribute takes one argument}}
40 int __attribute__((pcs())) pcs2(void); // expected-error {{attribute takes one argument}}
41 int __attribute__((pcs(pcs1))) pcs3(void); // expected-error {{attribute takes one argument}}
42 int __attribute__((pcs(0))) pcs4(void); // expected-error {{'pcs' attribute requires parameter 1 to be a string}}
43 /* These are ignored because the target is i386 and not ARM */
44 int __attribute__((pcs("aapcs"))) pcs5(void); // expected-warning {{calling convention 'pcs' ignored for this target}}
45 int __attribute__((pcs("aapcs-vfp"))) pcs6(void); // expected-warning {{calling convention 'pcs' ignored for this target}}
46 int __attribute__((pcs("foo"))) pcs7(void); // expected-error {{invalid PCS type}}
47 
48 // PR6361
49 void ctest3();
ctest3()50 void __attribute__((cdecl)) ctest3() {}
51 
52 // PR6408
53 typedef __attribute__((stdcall)) void (*PROC)();
ctest4(const char * x)54 PROC __attribute__((cdecl)) ctest4(const char *x) {}
55 
pnaclfunc(float * a)56 void __attribute__((pnaclcall)) pnaclfunc(float *a) {} // expected-warning {{calling convention 'pnaclcall' ignored for this target}}
57 
inteloclbifunc(float * a)58 void __attribute__((intel_ocl_bicc)) inteloclbifunc(float *a) {}
59