blob: 25669f08ae29c30c6a2cc99ad3b492570a97d509 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 %s -fsyntax-only -verify
Nate Begemanb6789ca2008-03-07 20:04:49 +00002
3void __attribute__((fastcall)) foo(float *a) {
4}
5
6void __attribute__((stdcall)) bar(float *a) {
7}
8
John McCallbdc49d32011-03-02 12:15:05 +00009void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{attribute takes no arguments}}
Nate Begemanb6789ca2008-03-07 20:04:49 +000010}
John McCall9112b932009-11-04 03:36:09 +000011
John McCall04a67a62010-02-05 21:31:56 +000012void __attribute__((fastcall)) test0() { // expected-error {{function with no prototype cannot use fastcall calling convention}}
John McCall9112b932009-11-04 03:36:09 +000013}
14
15void __attribute__((fastcall)) test1(void) {
16}
17
John McCall04a67a62010-02-05 21:31:56 +000018void __attribute__((fastcall)) test2(int a, ...) { // expected-error {{variadic function cannot use fastcall calling convention}}
John McCall9112b932009-11-04 03:36:09 +000019}
Eli Friedman8f4c59e2009-11-09 18:38:53 +000020
21void __attribute__((cdecl)) ctest0() {}
22
John McCallbdc49d32011-03-02 12:15:05 +000023void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{attribute takes no arguments}}
John McCallf82b4e82010-02-04 05:44:44 +000024
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
John McCall04a67a62010-02-05 21:31:56 +000036typedef void (__attribute__((fastcall)) *Handler) (float *);
37Handler H = foo;
38
Charles Davis064f7db2010-02-23 06:13:55 +000039// PR6361
40void ctest3();
41void __attribute__((cdecl)) ctest3() {}
42
Charles Davis328ce342010-02-24 02:27:18 +000043// PR6408
44typedef __attribute__((stdcall)) void (*PROC)();
45PROC __attribute__((cdecl)) ctest4(const char *x) {}
46