callingconv.c revision 04a67a6aa3dfdc92d57f7f8d93ba397348c868a4
1// RUN: %clang_cc1 %s -fsyntax-only -verify
2
3void __attribute__((fastcall)) foo(float *a) {
4}
5
6void __attribute__((stdcall)) bar(float *a) {
7}
8
9void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{attribute requires 0 argument(s)}}
10}
11
12void __attribute__((fastcall)) test0() { // expected-error {{function with no prototype cannot use fastcall calling convention}}
13}
14
15void __attribute__((fastcall)) test1(void) {
16}
17
18void __attribute__((fastcall)) test2(int a, ...) { // expected-error {{variadic function cannot use fastcall calling convention}}
19}
20
21void __attribute__((cdecl)) ctest0() {}
22
23void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{attribute requires 0 argument(s)}}
24
25void (__attribute__((fastcall)) *pfoo)(float*) = foo;
26
27void (__attribute__((stdcall)) *pbar)(float*) = bar;
28
29void (__attribute__((cdecl)) *ptest1)(void) = test1; // expected-warning {{incompatible pointer types}}
30
31void (*pctest0)() = ctest0;
32
33void ctest2() {}
34void (__attribute__((cdecl)) *pctest2)() = ctest2;
35
36typedef void (__attribute__((fastcall)) *Handler) (float *);
37Handler H = foo;
38
39