diff options
author | Chris Lattner <sabre@nondot.org> | 2009-05-31 19:32:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-05-31 19:32:13 +0000 |
commit | 8662587fa75d3fb04f873e265841c9314c7f5523 (patch) | |
tree | 1193b74d687ac757f2e8b40670818fb14cf1bc8a /lib/Sema/SemaStmt.cpp | |
parent | 3cc9726a493d90bd8faf094986a59352fd3461cb (diff) |
Downgrade an error about "return in a no-return function" from being
an error to being a warning that defaults to error. If you want this to
be a warning, you have to explicitly pass -Winvalid-noreturn to clang to
map it back to a warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72669 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 879d84e36c..15262e9c3a 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -834,11 +834,9 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, FullExprArg rex) { QualType FnRetType; if (const FunctionDecl *FD = getCurFunctionDecl()) { FnRetType = FD->getResultType(); - if (FD->hasAttr<NoReturnAttr>()) { - Diag(ReturnLoc, diag::err_noreturn_function_has_return_expr) + if (FD->hasAttr<NoReturnAttr>()) + Diag(ReturnLoc, diag::warn_noreturn_function_has_return_expr) << getCurFunctionOrMethodDecl()->getDeclName(); - return StmtError(); - } } else if (ObjCMethodDecl *MD = getCurMethodDecl()) FnRetType = MD->getResultType(); else // If we don't have a function/method context, bail. |