diff options
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 3 | ||||
-rw-r--r-- | test/Sema/MicrosoftExtensions.c | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index f0830b8861..daf225978e 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/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/test/Sema/MicrosoftExtensions.c b/test/Sema/MicrosoftExtensions.c index a4a8acd78e..fb0c6bde9a 100644 --- a/test/Sema/MicrosoftExtensions.c +++ b/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 +} |