Fixed false positives with pointerSize being shown even if no sizeof() is used (#7100).

This commit is contained in:
PKEuS 2015-11-07 13:18:50 +01:00
parent 2554674f4b
commit 9a879fc828
2 changed files with 8 additions and 0 deletions

View File

@ -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 (|&"))

View File

@ -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() {