Skip to content

Fix #13148 FN: constStatement (static_cast<void>(integer|nullptr|NULL))#8694

Open
chrchr-github wants to merge 5 commits into
cppcheck-opensource:mainfrom
chrchr-github:chr_13148
Open

Fix #13148 FN: constStatement (static_cast<void>(integer|nullptr|NULL))#8694
chrchr-github wants to merge 5 commits into
cppcheck-opensource:mainfrom
chrchr-github:chr_13148

Conversation

@chrchr-github

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread test/testincompletestatement.cpp Outdated
Comment thread test/testincompletestatement.cpp Outdated
Comment thread test/testincompletestatement.cpp Outdated
"}\n");
ASSERT_EQUALS("[test.cpp:2:22]: (warning) Redundant code: Found a statement that begins with numeric constant. [constStatement]\n"
"[test.cpp:3:22]: (warning) Redundant code: Found a statement that begins with NULL constant. [constStatement]\n"
"[test.cpp:4:5]: (warning) Redundant code: Found a statement that begins with NULL constant. [constStatement]\n",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this test case it just looks like a redundant statement , I wonder if the severity should be "style" instead. Are there bugs discovered by this checker or just code cleanup?

We could change the severity in a separate PR.

Comment thread lib/checkother.cpp
else if (tok->isCast() && tok->tokType() == Token::Type::eExtendedOp) {
msg = "Redundant code: Found unused cast ";
msg += valueTok ? "of expression '" + valueTok->expressionString() + "'." : "expression.";
msg += tok ? "in expression '" + tok->expressionString() + "'." : "expression.";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants