From bd73d0913fd4c92b9c97b74fed529f9caadc9a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 4 Feb 2009 17:12:53 +0000 Subject: [PATCH] charvar: fixed todo testcase --- src/checkother.cpp | 4 +++- test/testcharvar.cpp | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/checkother.cpp b/src/checkother.cpp index 598e347b9..34f1395cd 100644 --- a/src/checkother.cpp +++ b/src/checkother.cpp @@ -698,10 +698,12 @@ void CheckOther::CheckCharVariable() for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) { // Declaring the variable.. - if (Token::Match(tok, "[{};(,] char %var% [;=,)]")) + if (Token::Match(tok, "[{};(,] signed| char %var% [;=,)]")) { // Set tok to point to the variable name tok = tok->tokAt(2); + if (tok->str() == "char") + tok = tok->next(); // Check usage of char variable.. int indentlevel = 0; diff --git a/test/testcharvar.cpp b/test/testcharvar.cpp index 7f103acaf..aa544ecd4 100644 --- a/test/testcharvar.cpp +++ b/test/testcharvar.cpp @@ -74,14 +74,12 @@ private: "}\n"); ASSERT_EQUALS(std::string("[test.cpp:4]: (style) Warning - using char variable as array index\n"), errout.str()); - /* TODO check("void foo()\n" "{\n" " signed char ch = 0x80;\n" " buf[ch] = 0;\n" "}\n"); ASSERT_EQUALS(std::string("[test.cpp:4]: (style) Warning - using char variable as array index\n"), errout.str()); - */ check("void foo(char ch)\n" "{\n"