charvar: fixed todo testcase

This commit is contained in:
Daniel Marjamäki 2009-02-04 17:12:53 +00:00
parent d73e6c398f
commit bd73d0913f
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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"