From 7607e4c68d00f449b0f5b298483f938c1f91f5c4 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 18 Jan 2012 13:09:46 +0100 Subject: [PATCH] Fixed #3519 (Wrong line number in warning charBitOpError) --- lib/checkother.cpp | 4 ++-- test/testcharvar.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 0b40ef1f7..7e3c8a0f3 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -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)); } } } diff --git a/test/testcharvar.cpp b/test/testcharvar.cpp index 0991f7da1..f5690f832 100644 --- a/test/testcharvar.cpp +++ b/test/testcharvar.cpp @@ -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"