Fixed #3519 (Wrong line number in warning charBitOpError)

This commit is contained in:
Stefan Weil 2012-01-18 13:09:46 +01:00 committed by Daniel Marjamaki
parent 0be8af5214
commit 7607e4c68d
2 changed files with 4 additions and 4 deletions

View File

@ -1995,7 +1995,7 @@ void CheckOther::checkCharVariable()
continue;
// This is an error..
charBitOpError(tok);
charBitOpError(tok->tokAt(4));
}
else if (Token::Match(tok, "[;{}] %var% = %any% [&|] ( * %var% ) ;")) {
@ -2012,7 +2012,7 @@ void CheckOther::checkCharVariable()
continue;
// This is an error..
charBitOpError(tok);
charBitOpError(tok->tokAt(4));
}
}
}

View File

@ -112,7 +112,7 @@ private:
" char ch;\n"
" result = a | ch;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (warning) When using char variables in bit operations, sign extension can generate unexpected results.\n", errout.str());
ASSERT_EQUALS("[test.cpp:5]: (warning) When using char variables in bit operations, sign extension can generate unexpected results.\n", errout.str());
}
void bitop2() {
@ -159,7 +159,7 @@ private:
" ret |= *p;\n"
" return ret;\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (warning) When using char variables in bit operations, sign extension can generate unexpected results.\n", errout.str());
ASSERT_EQUALS("[test.cpp:3]: (warning) When using char variables in bit operations, sign extension can generate unexpected results.\n", errout.str());
// fixed code
check("void f(char *p) {\n"