Made 'unhandled exception' inconclusive and style message. #5751

This commit is contained in:
Robert Reif 2014-05-02 06:57:23 +02:00 committed by Daniel Marjamäki
parent b50900595c
commit 7d762ca9f7
3 changed files with 6 additions and 6 deletions

View File

@ -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();

View File

@ -129,10 +129,10 @@ private:
std::list<const Token*> 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) */

View File

@ -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());
}