Check64Bit: Fixed false positive about returning integer for 'p+(n*80)'

This commit is contained in:
Daniel Marjamäki 2013-10-08 06:36:45 +02:00
parent 1959377423
commit 4f88fdcf4a
2 changed files with 11 additions and 1 deletions

View File

@ -74,7 +74,11 @@ void Check64BitPortability::pointerassignment()
type = INT;
else if (type == PTR && Token::Match(tok2, "- %var%") && isaddr(tok2->next()->variable()))
type = PTRDIFF;
else if (Token::Match(tok2, "%type% (")) {
else if (Token::Match(tok2, "(")) {
type = NO;
break;
} else if (tok2->str() == "(") {
// TODO: handle parentheses
type = NO;
break;
} else if (type == PTR && Token::simpleMatch(tok2, "."))

View File

@ -193,6 +193,12 @@ private:
" return 1 + p->i;\n"
"}");
ASSERT_EQUALS("", errout.str());
check("static void __iomem *f(unsigned int port_no) {\n"
" void __iomem *mmio = hpriv->mmio;\n"
" return mmio + (port_no * 0x80);\n"
"}");
ASSERT_EQUALS("", errout.str());
}
};