Skip to content

Commit c5263f5

Browse files
fixup! fixup! fixup! Fix #8260 Improve check: Pointer calculation result not null
1 parent 5c247e7 commit c5263f5

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/checkcondition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,7 @@ void CheckConditionImpl::pointerAdditionResultNotNullError(const Token *tok, con
18811881
void CheckConditionImpl::pointerArithmeticAlwaysTrueError(const Token *tok, const Token *calc)
18821882
{
18831883
const std::string s = calc ? calc->expressionString() : "ptr+1";
1884-
reportError(tok, Severity::warning, "pointerAdditionResultNotNull", "Pointer expression '" + s + "' is always true unless there is pointer overflow, and pointer overflow is undefined behaviour.");
1884+
reportError(tok, Severity::warning, "pointerArithmeticAlwaysTrue", "Pointer expression '" + s + "' is always true unless there is pointer overflow, and pointer overflow is undefined behaviour.");
18851885
}
18861886

18871887
void CheckConditionImpl::checkDuplicateConditionalAssign()

test/testcondition.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6259,13 +6259,13 @@ class TestCondition : public TestFixture {
62596259
" int *q = ptr + 1;\n"
62606260
" if (q);\n"
62616261
"}");
6262-
ASSERT_EQUALS("[test.cpp:3:7]: (warning) Pointer expression 'q' is always true unless there is pointer overflow, and pointer overflow is undefined behaviour. [pointerAdditionResultNotNull]\n", errout_str());
6262+
ASSERT_EQUALS("[test.cpp:3:7]: (warning) Pointer expression 'q' is always true unless there is pointer overflow, and pointer overflow is undefined behaviour. [pointerArithmeticAlwaysTrue]\n", errout_str());
62636263

62646264
check("void f(char *ptr) {\n"
62656265
" int *q = ptr + 1;\n"
62666266
" if (!q);\n"
62676267
"}");
6268-
ASSERT_EQUALS("[test.cpp:3:8]: (warning) Pointer expression 'q' is always true unless there is pointer overflow, and pointer overflow is undefined behaviour. [pointerAdditionResultNotNull]\n", errout_str());
6268+
ASSERT_EQUALS("[test.cpp:3:8]: (warning) Pointer expression 'q' is always true unless there is pointer overflow, and pointer overflow is undefined behaviour. [pointerArithmeticAlwaysTrue]\n", errout_str());
62696269

62706270
check("void f(char *ptr) {\n"
62716271
" int *q = ptr + 0;\n"

0 commit comments

Comments
 (0)