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 | 6e127a6d86429e6de573ee10975f4b765095c841 (patch) | |
tree | 40be047984e22b53b7562d7cc83c7089adcb179e /clang/lib/Sema/SemaStmt.cpp | |
parent | c1c2c689458c61d9a04f4d0972dfc24bba348fe0 (diff) | |
download | bcm5719-llvm-6e127a6d86429e6de573ee10975f4b765095c841.tar.gz bcm5719-llvm-6e127a6d86429e6de573ee10975f4b765095c841.zip |
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.
llvm-svn: 72669
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 879d84e36c6..15262e9c3ac 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/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. |