summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-02-12 15:54:59 +0000
committerSteve Naroff <snaroff@apple.com>2009-02-12 15:54:59 +0000
commit0fa412cc6dd9b612eefc2e56aded810425eb9f04 (patch)
treebdf7c4aef8288738fe8075c3677fd889ce9ef72d /clang
parentcf5cd6ecfea21422791347a0be7e6b501e168e96 (diff)
downloadbcm5719-llvm-0fa412cc6dd9b612eefc2e56aded810425eb9f04.tar.gz
bcm5719-llvm-0fa412cc6dd9b612eefc2e56aded810425eb9f04.zip
Turn warning into error. Minor incompatibility with GCC (for scalar types, GCC only produces a warning).
llvm-svn: 64375
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Basic/DiagnosticSemaKinds.def2
-rw-r--r--clang/lib/Sema/SemaStmt.cpp6
-rw-r--r--clang/test/Parser/objc-try-catch-1.m2
-rw-r--r--clang/test/SemaObjC/try-catch.m6
4 files changed, 9 insertions, 7 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.def b/clang/include/clang/Basic/DiagnosticSemaKinds.def
index 9319fb0a4e4..0eddb39e7dd 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.def
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.def
@@ -873,7 +873,7 @@ DIAG(warn_method_not_found_in_protocol, WARNING,
"method %objcinstance0 not found in protocol (return type defaults to 'id')")
DIAG(error_bad_receiver_type, ERROR,
"bad receiver type %0")
-DIAG(warn_objc_throw_expects_object, WARNING,
+DIAG(error_objc_throw_expects_object, ERROR,
"invalid %0 argument (expected an ObjC object type)")
DIAG(error_rethrow_used_outside_catch, ERROR,
"@throw (rethrow) used outside of a @catch block")
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 989de0cdbf7..8b2e088b2e2 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -981,8 +981,7 @@ Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc,
}
Action::OwningStmtResult
-Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, ExprArg expr,
- Scope *CurScope) {
+Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, ExprArg expr,Scope *CurScope) {
Expr *ThrowExpr = static_cast<Expr*>(expr.release());
if (!ThrowExpr) {
// @throw without an expression designates a rethrow (which much occur
@@ -998,8 +997,7 @@ Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, ExprArg expr,
if (!Context.isObjCObjectPointerType(ThrowType)) {
const PointerType *PT = ThrowType->getAsPointerType();
if (!PT || !PT->getPointeeType()->isVoidType())
- // This should be an error, however GCC only yields a warning.
- Diag(AtLoc, diag::warn_objc_throw_expects_object)
+ Diag(AtLoc, diag::error_objc_throw_expects_object)
<< ThrowExpr->getType() << ThrowExpr->getSourceRange();
}
}
diff --git a/clang/test/Parser/objc-try-catch-1.m b/clang/test/Parser/objc-try-catch-1.m
index 0e8a91977d3..255453135b0 100644
--- a/clang/test/Parser/objc-try-catch-1.m
+++ b/clang/test/Parser/objc-try-catch-1.m
@@ -27,7 +27,7 @@ void * foo()
return proc();
}
@catch (Frob* ex) {
- @throw 1,2; // expected-warning {{invalid 'int' argument (expected an ObjC object type)}}
+ @throw 1,2; // expected-error {{invalid 'int' argument (expected an ObjC object type)}}
}
@catch(...) {
@throw (4,3,proc());
diff --git a/clang/test/SemaObjC/try-catch.m b/clang/test/SemaObjC/try-catch.m
index d3be70c74ab..16e119db80c 100644
--- a/clang/test/SemaObjC/try-catch.m
+++ b/clang/test/SemaObjC/try-catch.m
@@ -38,6 +38,10 @@ typedef struct _NSZone NSZone;
@end
int foo() {
- @throw 42; // expected-warning {{invalid 'int' argument (expected an ObjC object type)}}
+ struct s { int a, b; } agg, *pagg;
+
+ @throw 42; // expected-error {{invalid 'int' argument (expected an ObjC object type)}}
+ @throw agg; // expected-error {{invalid 'struct s' argument (expected an ObjC object type)}}
+ @throw pagg; // expected-error {{invalid 'struct s *' argument (expected an ObjC object type)}}
@throw; // expected-error {{@throw (rethrow) used outside of a @catch block}}
}
OpenPOWER on IntegriCloud