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;
|
continue;
|
||||||
|
|
||||||
// This is an error..
|
// This is an error..
|
||||||
charBitOpError(tok);
|
charBitOpError(tok->tokAt(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (Token::Match(tok, "[;{}] %var% = %any% [&|] ( * %var% ) ;")) {
|
else if (Token::Match(tok, "[;{}] %var% = %any% [&|] ( * %var% ) ;")) {
|
||||||
|
@ -2012,7 +2012,7 @@ void CheckOther::checkCharVariable()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// This is an error..
|
// This is an error..
|
||||||
charBitOpError(tok);
|
charBitOpError(tok->tokAt(4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ private:
|
||||||
" char ch;\n"
|
" char ch;\n"
|
||||||
" result = a | ch;\n"
|
" result = a | ch;\n"
|
||||||
"}\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() {
|
void bitop2() {
|
||||||
|
@ -159,7 +159,7 @@ private:
|
||||||
" ret |= *p;\n"
|
" ret |= *p;\n"
|
||||||
" return ret;\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
|
// fixed code
|
||||||
check("void f(char *p) {\n"
|
check("void f(char *p) {\n"
|
||||||
|
|
Loading…
Reference in New Issue