]> granicus.if.org Git - clang/commitdiff
Turned on support for __declspec(deprecated) in MS compatibility mode.
authorAaron Ballman <aaron@aaronballman.com>
Thu, 23 Feb 2012 01:19:31 +0000 (01:19 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 23 Feb 2012 01:19:31 +0000 (01:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151225 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp
test/Sema/MicrosoftExtensions.c

index f0830b8861a0b1b23d786fb36efe2e511f2130b5..daf225978efa463c2dba559cedc9f79f16c41f5e 100644 (file)
@@ -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;
 }
 
 //===----------------------------------------------------------------------===//
index a4a8acd78e8d98d278b6f9795b94163275410702..fb0c6bde9a50c2568b8ad44a7ca9b3719d56ceca 100644 (file)
@@ -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
+}