Skip to content

Commit 84bf3bf

Browse files
Update checkother.cpp
1 parent c164444 commit 84bf3bf

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

lib/checkother.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,18 +2323,12 @@ static bool isConstStatement(const Token *tok, const Library& library, bool plat
23232323

23242324
static bool isVoidStmt(const Token *tok)
23252325
{
2326-
if (Token::simpleMatch(tok, "( void"))
2326+
if (Token::simpleMatch(tok, "( void") && !(tok->astOperand1() && (tok->astOperand1()->isLiteral() || isNullOperand(tok->astOperand1()))))
23272327
return true;
2328-
if (isCPPCast(tok) && tok->astOperand1() && Token::Match(tok->astOperand1()->next(), "< void *| >"))
2328+
if (isCPPCast(tok) && tok->astOperand1() && Token::Match(tok->astOperand1()->next(), "< void *| >") &&
2329+
!(tok->astOperand2() && (tok->astOperand2()->isLiteral() || isNullOperand(tok->astOperand2()))))
23292330
return true;
2330-
const Token *tok2 = tok;
2331-
while (tok2->astOperand1())
2332-
tok2 = tok2->astOperand1();
2333-
if (Token::simpleMatch(tok2->previous(), ")") && Token::simpleMatch(tok2->linkAt(-1), "( void"))
2334-
return true;
2335-
if (Token::simpleMatch(tok2, "( void"))
2336-
return true;
2337-
return Token::Match(tok2->previous(), "delete|throw|return");
2331+
return false;
23382332
}
23392333

23402334
static bool isConstTop(const Token *tok)

0 commit comments

Comments
 (0)