[cfe-commits] r109033 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp test/SemaCXX/attr-unavailable.cpp test/SemaObjC/protocol-attribute.m
Ted Kremenek
kremenek at apple.com
Wed Jul 21 13:43:11 PDT 2010
Author: kremenek
Date: Wed Jul 21 15:43:11 2010
New Revision: 109033
URL: http://llvm.org/viewvc/llvm-project?rev=109033&view=rev
Log:
Upgrade "'X' is unavailable" from a warning to an error. This matches GCC's behavior. Note that
GCC emits a warning instead of an error when using an unavailable Objective-C protocol, so now
Clang's behavior is more strict in this case, but more consistent. We will need to see how much
this fires on real code and determine whether this case should be downgraded to a warning.
Fixes <rdar://problem/8213093>.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCXX/attr-unavailable.cpp
cfe/trunk/test/SemaObjC/protocol-attribute.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=109033&r1=109032&r2=109033&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jul 21 15:43:11 2010
@@ -1685,8 +1685,7 @@
def err_undeclared_use : Error<"use of undeclared %0">;
def warn_deprecated : Warning<"%0 is deprecated">,
InGroup<DeprecatedDeclarations>;
-def warn_unavailable : Warning<"%0 is unavailable">,
- InGroup<DeprecatedDeclarations>;
+def err_unavailable : Error<"%0 is unavailable">;
def note_unavailable_here : Note<
"function has been explicitly marked %select{unavailable|deleted}0 here">;
def warn_not_enough_argument : Warning<
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=109033&r1=109032&r2=109033&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Jul 21 15:43:11 2010
@@ -59,7 +59,7 @@
// See if the decl is unavailable
if (D->getAttr<UnavailableAttr>()) {
- Diag(Loc, diag::warn_unavailable) << D->getDeclName();
+ Diag(Loc, diag::err_unavailable) << D->getDeclName();
Diag(D->getLocation(), diag::note_unavailable_here) << 0;
}
Modified: cfe/trunk/test/SemaCXX/attr-unavailable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-unavailable.cpp?rev=109033&r1=109032&r2=109033&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/attr-unavailable.cpp (original)
+++ cfe/trunk/test/SemaCXX/attr-unavailable.cpp Wed Jul 21 15:43:11 2010
@@ -12,9 +12,9 @@
double &dr = foo(1.0);
foo(sp); // expected-error{{call to unavailable function 'foo'}}
- void (*fp)(...) = &bar; // expected-warning{{'bar' is unavailable}}
- void (*fp2)(...) = bar; // expected-warning{{'bar' is unavailable}}
+ void (*fp)(...) = &bar; // expected-error{{'bar' is unavailable}}
+ void (*fp2)(...) = bar; // expected-error{{'bar' is unavailable}}
int &(*fp3)(int) = foo;
- void (*fp4)(...) = foo; // expected-warning{{'foo' is unavailable}}
+ void (*fp4)(...) = foo; // expected-error{{'foo' is unavailable}}
}
Modified: cfe/trunk/test/SemaObjC/protocol-attribute.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-attribute.m?rev=109033&r1=109032&r2=109033&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-attribute.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-attribute.m Wed Jul 21 15:43:11 2010
@@ -3,7 +3,7 @@
__attribute ((unavailable))
@protocol FwProto; // expected-note{{marked unavailable}}
-Class <FwProto> cFw = 0; // expected-warning {{'FwProto' is unavailable}}
+Class <FwProto> cFw = 0; // expected-error {{'FwProto' is unavailable}}
__attribute ((deprecated)) @protocol MyProto1
@@ -35,12 +35,12 @@
@protocol FwProto @end // expected-note{{marked unavailable}}
- at interface MyClass2 <FwProto> // expected-warning {{'FwProto' is unavailable}}
+ at interface MyClass2 <FwProto> // expected-error {{'FwProto' is unavailable}}
@end
__attribute ((unavailable)) __attribute ((deprecated)) @protocol XProto; // expected-note{{marked unavailable}}
-id <XProto> idX = 0; // expected-warning {{'XProto' is unavailable}} expected-warning {{'XProto' is deprecated}}
+id <XProto> idX = 0; // expected-error {{'XProto' is unavailable}} expected-warning {{'XProto' is deprecated}}
int main ()
{
More information about the cfe-commits
mailing list