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()
|
void CheckExceptionSafety::unhandledExceptionSpecification()
|
||||||
{
|
{
|
||||||
if (!_settings->isEnabled("warning"))
|
if (!_settings->isEnabled("style") || !_settings->inconclusive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const SymbolDatabase* const symbolDatabase = _tokenizer->getSymbolDatabase();
|
const SymbolDatabase* const symbolDatabase = _tokenizer->getSymbolDatabase();
|
||||||
|
|
|
@ -129,10 +129,10 @@ private:
|
||||||
std::list<const Token*> locationList;
|
std::list<const Token*> locationList;
|
||||||
locationList.push_back(tok1);
|
locationList.push_back(tok1);
|
||||||
locationList.push_back(tok2);
|
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 + "().\n"
|
||||||
"Unhandled exception specification when calling function " + str1 + "(). "
|
"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) */
|
/** Generate all possible errors (for --errorlist) */
|
||||||
|
|
|
@ -356,8 +356,8 @@ private:
|
||||||
" try {\n"
|
" try {\n"
|
||||||
" myThrowingFoo();\n"
|
" myThrowingFoo();\n"
|
||||||
" } catch(MyException &) {}\n"
|
" } catch(MyException &) {}\n"
|
||||||
"}\n");
|
"}\n", true);
|
||||||
ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:1]: (warning) Unhandled exception specification when calling function myThrowingFoo().\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:1]: (style, inconclusive) Unhandled exception specification when calling function myThrowingFoo().\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void unhandledExceptionSpecification2() {
|
void unhandledExceptionSpecification2() {
|
||||||
|
@ -365,7 +365,7 @@ private:
|
||||||
"int main()\n"
|
"int main()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" f();\n"
|
" f();\n"
|
||||||
"}\n");
|
"}\n", true);
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue