[cfe-commits] r151225 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Sema/MicrosoftExtensions.c
Aaron Ballman
aaron at aaronballman.com
Wed Feb 22 17:19:31 PST 2012
Author: aaronballman
Date: Wed Feb 22 19:19:31 2012
New Revision: 151225
URL: http://llvm.org/viewvc/llvm-project?rev=151225&view=rev
Log:
Turned on support for __declspec(deprecated) in MS compatibility mode.
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Sema/MicrosoftExtensions.c
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=151225&r1=151224&r2=151225&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Feb 22 19:19:31 2012
@@ -3465,7 +3465,8 @@
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;
}
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/test/Sema/MicrosoftExtensions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/MicrosoftExtensions.c?rev=151225&r1=151224&r2=151225&view=diff
==============================================================================
--- cfe/trunk/test/Sema/MicrosoftExtensions.c (original)
+++ cfe/trunk/test/Sema/MicrosoftExtensions.c Wed Feb 22 19:19:31 2012
@@ -86,3 +86,17 @@
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
+}
More information about the cfe-commits
mailing list