diff options
Diffstat (limited to 'clang/test/Sema')
| -rw-r--r-- | clang/test/Sema/attr-ms-hook-prologue-wrong-arch.c | 6 | ||||
| -rw-r--r-- | clang/test/Sema/attr-ms-hook-prologue.c | 22 |
2 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/Sema/attr-ms-hook-prologue-wrong-arch.c b/clang/test/Sema/attr-ms-hook-prologue-wrong-arch.c new file mode 100644 index 00000000000..cd4b591cbb3 --- /dev/null +++ b/clang/test/Sema/attr-ms-hook-prologue-wrong-arch.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple s390x-unknown-linux -fms-extensions -fsyntax-only -verify %s + +// expected-warning@+1{{unknown attribute 'ms_hook_prologue' ignored}} +int __attribute__((ms_hook_prologue)) foo(int a, int b) { + return a+b; +} diff --git a/clang/test/Sema/attr-ms-hook-prologue.c b/clang/test/Sema/attr-ms-hook-prologue.c new file mode 100644 index 00000000000..5417f4aa59c --- /dev/null +++ b/clang/test/Sema/attr-ms-hook-prologue.c @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -triple i386-pc-linux -fms-extensions -fsyntax-only -verify %s + +int __attribute__((ms_hook_prologue)) foo(int a, int b) { + return a+b; +} + +// expected-note@+2{{conflicting attribute is here}} +// expected-error@+1{{'naked' and 'ms_hook_prologue' attributes are not compatible}} +__declspec(naked) int __attribute__((ms_hook_prologue)) bar(int a, int b) { +} + +// expected-note@+2{{conflicting attribute is here}} +// expected-error@+1{{'__forceinline' and 'ms_hook_prologue' attributes are not compatible}} +__forceinline int __attribute__((ms_hook_prologue)) baz(int a, int b) { + return a-b; +} + +// expected-warning@+1{{'ms_hook_prologue' attribute only applies to functions}} +int x __attribute__((ms_hook_prologue)); + +// expected-error@+1{{'ms_hook_prologue' attribute takes no arguments}} +int f(int a, int b) __attribute__((ms_hook_prologue(2))); |

