diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGen/ms_abi.c | 20 | ||||
-rw-r--r-- | clang/test/Sema/callingconv-ms_abi.c | 9 | ||||
-rw-r--r-- | clang/test/Sema/callingconv-sysv_abi.c | 9 | ||||
-rw-r--r-- | clang/test/Sema/ms_abi-sysv_abi.c | 14 |
4 files changed, 52 insertions, 0 deletions
diff --git a/clang/test/CodeGen/ms_abi.c b/clang/test/CodeGen/ms_abi.c new file mode 100644 index 00000000000..7c5c26fc41c --- /dev/null +++ b/clang/test/CodeGen/ms_abi.c @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-freebsd10.0 -emit-llvm < %s | FileCheck -check-prefix=FREEBSD %s +// RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm < %s | FileCheck -check-prefix=WIN64 %s + +void __attribute__((ms_abi)) f1(void); +void __attribute__((sysv_abi)) f2(void); +void f3(void) { +// FREEBSD: define void @f3() +// WIN64: define void @f3() + f1(); +// FREEBSD: call x86_64_win64cc void @f1() +// WIN64: call void @f1() + f2(); +// FREEBSD: call void @f2() +// WIN64: call x86_64_sysvcc void @f2() +} +// FREEBSD: declare x86_64_win64cc void @f1() +// FREEBSD: declare void @f2() +// WIN64: declare void @f1() +// WIN64: declare x86_64_sysvcc void @f2() + diff --git a/clang/test/Sema/callingconv-ms_abi.c b/clang/test/Sema/callingconv-ms_abi.c new file mode 100644 index 00000000000..64c5970adf1 --- /dev/null +++ b/clang/test/Sema/callingconv-ms_abi.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-pc-win32 %s + +void __attribute__((ms_abi)) foo(void); +void (*pfoo)(void) = foo; + +void __attribute__((sysv_abi)) bar(void); +void (*pbar)(void) = bar; // expected-warning{{incompatible pointer types}} + +void (__attribute__((sysv_abi)) *pfoo2)(void) = foo; // expected-warning{{incompatible pointer types}} diff --git a/clang/test/Sema/callingconv-sysv_abi.c b/clang/test/Sema/callingconv-sysv_abi.c new file mode 100644 index 00000000000..015357d054f --- /dev/null +++ b/clang/test/Sema/callingconv-sysv_abi.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-pc-linux-gnu %s + +void __attribute__((ms_abi)) foo(void); +void (*pfoo)(void) = foo; // expected-warning{{incompatible pointer types}} + +void __attribute__((sysv_abi)) bar(void); +void (*pbar)(void) = bar; + +void (__attribute__((ms_abi)) *pbar2)(void) = bar; // expected-warning{{incompatible pointer types}} diff --git a/clang/test/Sema/ms_abi-sysv_abi.c b/clang/test/Sema/ms_abi-sysv_abi.c new file mode 100644 index 00000000000..35a5fad9ceb --- /dev/null +++ b/clang/test/Sema/ms_abi-sysv_abi.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-pc-linux-gnu %s + +// CC qualifier can be applied only to functions +int __attribute__((ms_abi)) var1; // expected-warning{{'ms_abi' only applies to function types; type here is 'int'}} +int __attribute__((sysv_abi)) var2; // expected-warning{{'sysv_abi' only applies to function types; type here is 'int'}} + +// Different CC qualifiers are not compatible +// FIXME: Should say 'sysv_abi' instead of 'cdecl' +void __attribute__((ms_abi, sysv_abi)) foo3(void); // expected-error{{cdecl and ms_abi attributes are not compatible}} +void __attribute__((ms_abi)) foo4(); // expected-note{{previous declaration is here}} +void __attribute__((sysv_abi)) foo4(void); // expected-error{{function declared 'cdecl' here was previously declared 'ms_abi'}} + +void bar(int i, int j) __attribute__((ms_abi, cdecl)); // expected-error{{cdecl and ms_abi attributes are not compatible}} +void bar2(int i, int j) __attribute__((sysv_abi, cdecl)); // no-error |