Fixed #8197 (iscast: '(b)&1' is not a cast)
This commit is contained in:
parent
b81b4fcb78
commit
b9b47809f9
|
@ -644,6 +644,12 @@
|
||||||
<platform type="win32W"/>
|
<platform type="win32W"/>
|
||||||
<platform type="win64"/>
|
<platform type="win64"/>
|
||||||
</platformtype>
|
</platformtype>
|
||||||
|
<platformtype name="PRECT" value="RECT">
|
||||||
|
<pointer/>
|
||||||
|
<platform type="win32A"/>
|
||||||
|
<platform type="win32W"/>
|
||||||
|
<platform type="win64"/>
|
||||||
|
</platformtype>
|
||||||
<platformtype name="PSTR" value="char">
|
<platformtype name="PSTR" value="char">
|
||||||
<pointer/>
|
<pointer/>
|
||||||
<platform type="win32A"/>
|
<platform type="win32A"/>
|
||||||
|
|
|
@ -368,11 +368,12 @@ static bool iscast(const Token *tok)
|
||||||
while (tok2->link() && Token::Match(tok2, "(|[|<"))
|
while (tok2->link() && Token::Match(tok2, "(|[|<"))
|
||||||
tok2 = tok2->link()->next();
|
tok2 = tok2->link()->next();
|
||||||
|
|
||||||
if (tok2->str() == ")")
|
if (tok2->str() == ")") {
|
||||||
return type || tok2->strAt(-1) == "*" || Token::Match(tok2, ") &|~") ||
|
return type || tok2->strAt(-1) == "*" || Token::simpleMatch(tok2, ") ~") ||
|
||||||
(Token::Match(tok2, ") %any%") &&
|
(Token::Match(tok2, ") %any%") &&
|
||||||
!tok2->next()->isOp() &&
|
!tok2->next()->isOp() &&
|
||||||
!Token::Match(tok2->next(), "[[]);,?:.]"));
|
!Token::Match(tok2->next(), "[[]);,?:.]"));
|
||||||
|
}
|
||||||
if (!Token::Match(tok2, "%name%|*|&|::"))
|
if (!Token::Match(tok2, "%name%|*|&|::"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -8334,6 +8334,7 @@ private:
|
||||||
|
|
||||||
// not cast
|
// not cast
|
||||||
ASSERT_EQUALS("AB||", testAst("(A)||(B)"));
|
ASSERT_EQUALS("AB||", testAst("(A)||(B)"));
|
||||||
|
ASSERT_EQUALS("abc[1&=", testAst("a = (b[c]) & 1;"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void astlambda() {
|
void astlambda() {
|
||||||
|
|
|
@ -2553,7 +2553,7 @@ private:
|
||||||
|
|
||||||
checkUninitVar("void f() {\n" // #4439 - cast address of uninitialized variable
|
checkUninitVar("void f() {\n" // #4439 - cast address of uninitialized variable
|
||||||
" int a;\n"
|
" int a;\n"
|
||||||
" x((A)(B)&a);\n"
|
" x((LPARAM)(RECT*)&a);\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue