Fixed false positives with pointerSize being shown even if no sizeof() is used (#7100).
This commit is contained in:
parent
2554674f4b
commit
9a879fc828
|
@ -189,6 +189,9 @@ void CheckSizeof::checkSizeofForPointerSize()
|
|||
// This is to allow generic operations with sizeof
|
||||
for (; tokSize && tokSize->str() != ")" && tokSize->str() != "," && tokSize->str() != "sizeof"; tokSize = tokSize->next()) {}
|
||||
|
||||
if (tokSize->str() != "sizeof")
|
||||
continue;
|
||||
|
||||
if (Token::simpleMatch(tokSize, "sizeof ( &"))
|
||||
tokSize = tokSize->tokAt(3);
|
||||
else if (Token::Match(tokSize, "sizeof (|&"))
|
||||
|
|
|
@ -537,6 +537,11 @@ private:
|
|||
" memset(tab + confsize, 0, sizeof(tab[confsize]));\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int f(char* aug) {\n"
|
||||
" memmove(aug + extra_string, aug, buf - (bfd_byte *)aug);\n" // #7100
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void checkPointerSizeofStruct() {
|
||||
|
|
Loading…
Reference in New Issue