diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index 14ac966c1..136bf274b 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -831,10 +831,10 @@ void CheckStl::invalidContainer() return false; if (info.tok->varId() == skipVarId) return false; - if (info.tok->variable()->isReference() && - !isVariableDecl(info.tok) && + if (info.tok->variable()->isReference() && + !isVariableDecl(info.tok) && reaches(info.tok->variable()->nameToken(), tok, library, nullptr)) { - + ErrorPath ep; bool addressOf = false; const Variable* var = getLifetimeVariable(info.tok, ep, &addressOf); diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index 5208fece7..08928f535 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -1364,7 +1364,7 @@ void CheckUninitVar::valueFlowUninit() while (Token::simpleMatch(nextTok->astParent(), ".")) nextTok = nextTok->astParent(); nextTok = nextAfterAstRightmostLeaf(nextTok); - if(nextTok == scope.bodyEnd) + if (nextTok == scope.bodyEnd) break; tok = nextTok ? nextTok : tok; } diff --git a/test/testbool.cpp b/test/testbool.cpp index 58e64a741..e35acb1f6 100644 --- a/test/testbool.cpp +++ b/test/testbool.cpp @@ -1040,14 +1040,14 @@ private: } void comparisonOfBoolWithInt9() { // #9304 - check("bool f(int a, bool b)\n" - "{\n" - " if ((a == 0 ? false : true) != b) {\n" - " b = !b;\n" - " }\n" - " return b;\n" - "}"); - ASSERT_EQUALS("", errout.str()); + check("bool f(int a, bool b)\n" + "{\n" + " if ((a == 0 ? false : true) != b) {\n" + " b = !b;\n" + " }\n" + " return b;\n" + "}"); + ASSERT_EQUALS("", errout.str()); } diff --git a/test/testclass.cpp b/test/testclass.cpp index 48a638240..0e4fb2d0c 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -6695,11 +6695,11 @@ private: // don't warn if some other instance's members are assigned to checkInitializationListUsage("class C {\n" - "public:\n" - " C(C& c) : m_i(c.m_i) { c.m_i = (Foo)-1; }\n" - "private:\n" - " Foo m_i;\n" - "};"); + "public:\n" + " C(C& c) : m_i(c.m_i) { c.m_i = (Foo)-1; }\n" + "private:\n" + " Foo m_i;\n" + "};"); ASSERT_EQUALS("", errout.str()); } diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 824be6e40..67c0c2324 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -7079,17 +7079,17 @@ private: void incomplete_type() { GET_SYMBOL_DB("template>\n" - " class SLSurfaceLayerData\n" - " : public _Vector_alloc<_Vec_base_types<_Ty, _Alloc>>\n" - "{ // varying size array of values\n" - "\n" - " using reverse_iterator = _STD reverse_iterator;\n" - " using const_reverse_iterator = _STD reverse_iterator;\n" - " const_reverse_iterator crend() const noexcept\n" - " { // return iterator for end of reversed nonmutable sequence\n" - " return (rend());\n" - " }\n" - "};"); + " class SLSurfaceLayerData\n" + " : public _Vector_alloc<_Vec_base_types<_Ty, _Alloc>>\n" + "{ // varying size array of values\n" + "\n" + " using reverse_iterator = _STD reverse_iterator;\n" + " using const_reverse_iterator = _STD reverse_iterator;\n" + " const_reverse_iterator crend() const noexcept\n" + " { // return iterator for end of reversed nonmutable sequence\n" + " return (rend());\n" + " }\n" + "};"); (void)db; ASSERT_EQUALS("", errout.str()); diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index c4982854d..a16b59f3d 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -4443,14 +4443,14 @@ private: } void uninitvar_nonmember() { - valueFlowUninit( "struct Foo {\n" - " int bar;\n" - "};\n" - "\n" - "int main() {\n" - " Foo* foo;\n" - " foo.b\n" - "}\n"); + valueFlowUninit("struct Foo {\n" + " int bar;\n" + "};\n" + "\n" + "int main() {\n" + " Foo* foo;\n" + " foo.b\n" + "}\n"); ASSERT_EQUALS("[test.cpp:7]: (error) Uninitialized variable: foo\n", errout.str()); }