diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 346405b8f..754091c7b 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -6357,7 +6357,7 @@ bool Tokenizer::simplifyKnownVariablesGetData(unsigned int varid, Token **_tok2, bool Tokenizer::simplifyKnownVariablesSimplify(Token **tok2, Token *tok3, unsigned int varid, const std::string &structname, std::string &value, unsigned int valueVarId, bool valueIsPointer, bool pointeralias, int indentlevel) { - bool ret = false;; + bool ret = false; Token* bailOutFromLoop = 0; int indentlevel3 = indentlevel; @@ -6618,10 +6618,10 @@ bool Tokenizer::simplifyKnownVariablesSimplify(Token **tok2, Token *tok3, unsign // Variable is used in calculation.. if (((tok3->previous()->varId() > 0) && Token::Match(tok3, ("& " + structname + " %varid%").c_str(), varid)) || - Token::Match(tok3, ("[=+-*/[] " + structname + " %varid% [=?+-*/;])]").c_str(), varid) || - Token::Match(tok3, ("[(=+-*/[] " + structname + " %varid% <<|>>").c_str(), varid) || - Token::Match(tok3, ("<<|>> " + structname + " %varid% [+-*/;])]").c_str(), varid) || - Token::Match(tok3->previous(), ("[=+-*/[] ( " + structname + " %varid%").c_str(), varid)) + Token::Match(tok3, ("[=+-*/%[] " + structname + " %varid% [=?+-*/%;])]").c_str(), varid) || + Token::Match(tok3, ("[(=+-*/%[] " + structname + " %varid% <<|>>").c_str(), varid) || + Token::Match(tok3, ("<<|>> " + structname + " %varid% [+-*/%;])]").c_str(), varid) || + Token::Match(tok3->previous(), ("[=+-*/%[] ( " + structname + " %varid%").c_str(), varid)) { if (!structname.empty()) { diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index e07d202b0..a768df9a0 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -1685,21 +1685,14 @@ private: " int i = v;\n" " return h % i;\n" "}\n"; - const char wanted[] = "\n\n##file 0\n" - "1: int foo ( int u@1 , int v@2 )\n" - "2: {\n" - "3: ;\n" - "4:\n" - "5: return u@1 % v@2 ;\n" - "6: }\n"; - const char current[] = "\n\n##file 0\n" - "1: int foo ( int u@1 , int v@2 )\n" - "2: {\n" - "3: ;\n" - "4: int i@4 ; i@4 = v@2 ;\n" - "5: return u@1 % i@4 ;\n" - "6: }\n"; - TODO_ASSERT_EQUALS(wanted, current, tokenizeDebugListing(code, true)); + const char expected[] = "\n\n##file 0\n" + "1: int foo ( int u@1 , int v@2 )\n" + "2: {\n" + "3: ;\n" + "4:\n" + "5: return u@1 % v@2 ;\n" + "6: }\n"; + ASSERT_EQUALS(expected, tokenizeDebugListing(code, true)); } {