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>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109033
91177308-0d34-0410-b5e6-
96231b3b80d8
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<
// 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;
}
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}}
}
__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
@protocol FwProto @end // expected-note{{marked unavailable}}
-@interface MyClass2 <FwProto> // expected-warning {{'FwProto' is unavailable}}
+@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 ()
{