From 7d762ca9f70c8fbf749ffc00b983dfcd5eb833a1 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Fri, 2 May 2014 06:57:23 +0200 Subject: [PATCH] Made 'unhandled exception' inconclusive and style message. #5751 --- lib/checkexceptionsafety.cpp | 2 +- lib/checkexceptionsafety.h | 4 ++-- test/testexceptionsafety.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/checkexceptionsafety.cpp b/lib/checkexceptionsafety.cpp index 4f8a6b948..3e16e390f 100644 --- a/lib/checkexceptionsafety.cpp +++ b/lib/checkexceptionsafety.cpp @@ -261,7 +261,7 @@ void CheckExceptionSafety::nothrowThrows() //-------------------------------------------------------------------------- void CheckExceptionSafety::unhandledExceptionSpecification() { - if (!_settings->isEnabled("warning")) + if (!_settings->isEnabled("style") || !_settings->inconclusive) return; const SymbolDatabase* const symbolDatabase = _tokenizer->getSymbolDatabase(); diff --git a/lib/checkexceptionsafety.h b/lib/checkexceptionsafety.h index 12b5345ed..895283207 100644 --- a/lib/checkexceptionsafety.h +++ b/lib/checkexceptionsafety.h @@ -129,10 +129,10 @@ private: std::list locationList; locationList.push_back(tok1); locationList.push_back(tok2); - reportError(locationList, Severity::warning, "unhandledExceptionSpecification", + reportError(locationList, Severity::style, "unhandledExceptionSpecification", "Unhandled exception specification when calling function " + str1 + "().\n" "Unhandled exception specification when calling function " + str1 + "(). " - "Either use a try/catch around the function call, or add a exception specification for " + funcname + "() also."); + "Either use a try/catch around the function call, or add a exception specification for " + funcname + "() also.", true); } /** Generate all possible errors (for --errorlist) */ diff --git a/test/testexceptionsafety.cpp b/test/testexceptionsafety.cpp index da419b13c..9a22d4511 100644 --- a/test/testexceptionsafety.cpp +++ b/test/testexceptionsafety.cpp @@ -356,8 +356,8 @@ private: " try {\n" " myThrowingFoo();\n" " } catch(MyException &) {}\n" - "}\n"); - ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:1]: (warning) Unhandled exception specification when calling function myThrowingFoo().\n", errout.str()); + "}\n", true); + ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:1]: (style, inconclusive) Unhandled exception specification when calling function myThrowingFoo().\n", errout.str()); } void unhandledExceptionSpecification2() { @@ -365,7 +365,7 @@ private: "int main()\n" "{\n" " f();\n" - "}\n"); + "}\n", true); ASSERT_EQUALS("", errout.str()); }