Fixed #3519 (Wrong line number in warning charBitOpError)
This commit is contained in:
parent
0be8af5214
commit
7607e4c68d
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue