diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2017-02-14 22:47:20 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2017-02-14 22:47:20 +0000 |
commit | 8e4aad78974956d3cc99409a2567494117611b47 (patch) | |
tree | 4cf66717e910c722c7f84b232922b55719c14bdd /test/Parser | |
parent | 6b15b6d3c1f8274162d5881b05d79aeddd5d6aad (diff) |
Improve diagnostic reporting when using __declspec without enabling __declspec as a keyword.
Fixes PR31936.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295114 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser')
-rw-r--r-- | test/Parser/declspec-recovery.c | 8 | ||||
-rw-r--r-- | test/Parser/declspec-supported.c | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/test/Parser/declspec-recovery.c b/test/Parser/declspec-recovery.c new file mode 100644 index 0000000000..b256861b9f --- /dev/null +++ b/test/Parser/declspec-recovery.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -verify %s + +__declspec(naked) void f(void) {} // expected-error{{'__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes}} + +struct S { + __declspec(property(get=Getter, put=Setter)) int X; // expected-error{{'__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes}} + int Y; +}; diff --git a/test/Parser/declspec-supported.c b/test/Parser/declspec-supported.c new file mode 100644 index 0000000000..f9004893a4 --- /dev/null +++ b/test/Parser/declspec-supported.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -fms-extensions -verify %s +// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -fdeclspec -verify %s +// expected-no-diagnostics + +__declspec(naked) void f(void) {} + +struct S { + __declspec(property(get=Getter, put=Setter)) int X; + int Y; +}; |