diff options
| author | Aaron Ballman <aaron@aaronballman.com> | 2012-02-23 01:19:31 +0000 |
|---|---|---|
| committer | Aaron Ballman <aaron@aaronballman.com> | 2012-02-23 01:19:31 +0000 |
| commit | 96e7c09cad057d79689ce60d2652ca29f610c274 (patch) | |
| tree | 3b73f18366186bcbe226093fed0be602490c0436 | |
| parent | e87681cf34fb9ca032f44047aa296b972d026eea (diff) | |
| download | bcm5719-llvm-96e7c09cad057d79689ce60d2652ca29f610c274.tar.gz bcm5719-llvm-96e7c09cad057d79689ce60d2652ca29f610c274.zip | |
Turned on support for __declspec(deprecated) in MS compatibility mode.
llvm-svn: 151225
| -rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 3 | ||||
| -rw-r--r-- | clang/test/Sema/MicrosoftExtensions.c | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index f0830b8861a..daf225978ef 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -3465,7 +3465,8 @@ static void handleObjCPreciseLifetimeAttr(Sema &S, Decl *D, static bool isKnownDeclSpecAttr(const AttributeList &Attr) { return Attr.getKind() == AttributeList::AT_dllimport || Attr.getKind() == AttributeList::AT_dllexport || - Attr.getKind() == AttributeList::AT_uuid; + Attr.getKind() == AttributeList::AT_uuid || + Attr.getKind() == AttributeList::AT_deprecated; } //===----------------------------------------------------------------------===// diff --git a/clang/test/Sema/MicrosoftExtensions.c b/clang/test/Sema/MicrosoftExtensions.c index a4a8acd78e8..fb0c6bde9a5 100644 --- a/clang/test/Sema/MicrosoftExtensions.c +++ b/clang/test/Sema/MicrosoftExtensions.c @@ -86,3 +86,17 @@ typedef struct { typedef struct { AA; // expected-warning {{anonymous structs are a Microsoft extension}} } BB; + +__declspec(deprecated("This is deprecated")) enum DE1 { one, two } e1; +struct __declspec(deprecated) DS1 { int i; float f; }; + +#define MY_TEXT "This is also deprecated" +__declspec(deprecated(MY_TEXT)) void Dfunc1( void ) {} + +void test( void ) { + e1 = one; // expected-warning {{'e1' is deprecated: This is deprecated}} + struct DS1 s = { 0 }; // expected-warning {{'DS1' is deprecated}} + Dfunc1(); // expected-warning {{'Dfunc1' is deprecated: This is also deprecated}} + + enum DE1 no; // no warning because E1 is not deprecated +} |

