Made 'unhandled exception' inconclusive and style message. #5751
This commit is contained in:
parent
b50900595c
commit
7d762ca9f7
|
@ -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();
|
||||
|
|
|
@ -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) */
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue