diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 31032639b..afc4cc257 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -394,11 +394,11 @@ void CheckOther::unreachableCode() break; // If there is a statement below the return it is unreachable -/* original: - if (!Token::Match(tok, "; case|default|}|#") && - !Token::Match(tok, "; %var% :") && - !Token::simpleMatch(tok, "; break")) -*/ + /* original: + if (!Token::Match(tok, "; case|default|}|#") && + !Token::Match(tok, "; %var% :") && + !Token::simpleMatch(tok, "; break")) + */ if (Token::simpleMatch(tok, "; break")) { unreachableCodeError(tok->next()); diff --git a/lib/checkother.h b/lib/checkother.h index 325b0d536..243493448 100644 --- a/lib/checkother.h +++ b/lib/checkother.h @@ -103,7 +103,7 @@ public: /** Check for unreachable code */ void unreachableCode(); void unreachableCodeError(const Token *tok); - + /** Check for unused function variables */ void functionVariableUsage(); void unusedVariableError(const Token *tok, const std::string &varname); diff --git a/test/testunusedvar.cpp b/test/testunusedvar.cpp index 5624de3fb..eb616e88f 100644 --- a/test/testunusedvar.cpp +++ b/test/testunusedvar.cpp @@ -58,7 +58,7 @@ private: TEST_CASE(structmember4); TEST_CASE(structmember5); TEST_CASE(structmember6); - + TEST_CASE(localvar1); TEST_CASE(localvar2); TEST_CASE(localvar3); @@ -77,7 +77,7 @@ private: TEST_CASE(localvarIfElse); // return tmp1 ? tmp2 : tmp3; TEST_CASE(localvarOpAssign); // a |= b; TEST_CASE(localvarFor); // for ( ; var; ) - TEST_CASE(localvarShift); // 1 >> var + TEST_CASE(localvarShift); // 1 >> var } void structmember1() @@ -197,10 +197,10 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); } - - - - + + + + @@ -397,8 +397,8 @@ private: " return 1 >> var;\n" "}\n"); ASSERT_EQUALS(std::string(""), errout.str()); - } - + } + }; REGISTER_TEST(TestUnusedVar)