charvar: fixed todo testcase
This commit is contained in:
parent
d73e6c398f
commit
bd73d0913f
|
@ -698,10 +698,12 @@ void CheckOther::CheckCharVariable()
|
||||||
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
|
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
|
||||||
{
|
{
|
||||||
// Declaring the variable..
|
// Declaring the variable..
|
||||||
if (Token::Match(tok, "[{};(,] char %var% [;=,)]"))
|
if (Token::Match(tok, "[{};(,] signed| char %var% [;=,)]"))
|
||||||
{
|
{
|
||||||
// Set tok to point to the variable name
|
// Set tok to point to the variable name
|
||||||
tok = tok->tokAt(2);
|
tok = tok->tokAt(2);
|
||||||
|
if (tok->str() == "char")
|
||||||
|
tok = tok->next();
|
||||||
|
|
||||||
// Check usage of char variable..
|
// Check usage of char variable..
|
||||||
int indentlevel = 0;
|
int indentlevel = 0;
|
||||||
|
|
|
@ -74,14 +74,12 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS(std::string("[test.cpp:4]: (style) Warning - using char variable as array index\n"), errout.str());
|
ASSERT_EQUALS(std::string("[test.cpp:4]: (style) Warning - using char variable as array index\n"), errout.str());
|
||||||
|
|
||||||
/* TODO
|
|
||||||
check("void foo()\n"
|
check("void foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" signed char ch = 0x80;\n"
|
" signed char ch = 0x80;\n"
|
||||||
" buf[ch] = 0;\n"
|
" buf[ch] = 0;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS(std::string("[test.cpp:4]: (style) Warning - using char variable as array index\n"), errout.str());
|
ASSERT_EQUALS(std::string("[test.cpp:4]: (style) Warning - using char variable as array index\n"), errout.str());
|
||||||
*/
|
|
||||||
|
|
||||||
check("void foo(char ch)\n"
|
check("void foo(char ch)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue