Skip to content

Commit 7d762ca

Browse files
IOBYTEdanmar
authored andcommitted
Made 'unhandled exception' inconclusive and style message. danmar#5751
1 parent b509005 commit 7d762ca

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/checkexceptionsafety.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ void CheckExceptionSafety::nothrowThrows()
261261
//--------------------------------------------------------------------------
262262
void CheckExceptionSafety::unhandledExceptionSpecification()
263263
{
264-
if (!_settings->isEnabled("warning"))
264+
if (!_settings->isEnabled("style") || !_settings->inconclusive)
265265
return;
266266

267267
const SymbolDatabase* const symbolDatabase = _tokenizer->getSymbolDatabase();

lib/checkexceptionsafety.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ class CPPCHECKLIB CheckExceptionSafety : public Check {
129129
std::list<const Token*> locationList;
130130
locationList.push_back(tok1);
131131
locationList.push_back(tok2);
132-
reportError(locationList, Severity::warning, "unhandledExceptionSpecification",
132+
reportError(locationList, Severity::style, "unhandledExceptionSpecification",
133133
"Unhandled exception specification when calling function " + str1 + "().\n"
134134
"Unhandled exception specification when calling function " + str1 + "(). "
135-
"Either use a try/catch around the function call, or add a exception specification for " + funcname + "() also.");
135+
"Either use a try/catch around the function call, or add a exception specification for " + funcname + "() also.", true);
136136
}
137137

138138
/** Generate all possible errors (for --errorlist) */

test/testexceptionsafety.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,16 @@ class TestExceptionSafety : public TestFixture {
356356
" try {\n"
357357
" myThrowingFoo();\n"
358358
" } catch(MyException &) {}\n"
359-
"}\n");
360-
ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:1]: (warning) Unhandled exception specification when calling function myThrowingFoo().\n", errout.str());
359+
"}\n", true);
360+
ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:1]: (style, inconclusive) Unhandled exception specification when calling function myThrowingFoo().\n", errout.str());
361361
}
362362

363363
void unhandledExceptionSpecification2() {
364364
check("void f() const throw (std::runtime_error);\n"
365365
"int main()\n"
366366
"{\n"
367367
" f();\n"
368-
"}\n");
368+
"}\n", true);
369369
ASSERT_EQUALS("", errout.str());
370370
}
371371

0 commit comments

Comments
 (0)