From 586f4992d873ad91da8b6b29641044fc6e886c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 7 Nov 2010 17:42:32 +0100 Subject: [PATCH] Tokenizer::simplifyKnownVariables: Fixed TODO test cases in TestBufferOverrun --- lib/tokenize.cpp | 2 +- test/testbufferoverrun.cpp | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 2135a42a3..4e875899f 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -6095,7 +6095,7 @@ bool Tokenizer::simplifyKnownVariables() } // array usage - if (Token::Match(tok3, "( %varid% [", varid)) + if (Token::Match(tok3, "[(,] %varid% [+-*/[]", varid)) { tok3 = tok3->next(); tok3->str(value); diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index f2dc3bad9..f20499378 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -1359,8 +1359,7 @@ private: "char str[i];\n" "fread(str,sizeof(char),i+1,fd);\n" "}\n"); - ASSERT_EQUALS("", errout.str()); // catch changes - TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds: str\n", errout.str()); check("void f(FILE* fd)\n" "{\n" @@ -1383,8 +1382,7 @@ private: "char str[i];\n" "fwrite(str,sizeof(char),i+1,fd);\n" "}\n"); - ASSERT_EQUALS("", errout.str()); // catch changes - TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds\n", errout.str()); + ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds: str\n", errout.str()); check("void f(FILE* fd)\n" "{\n"