Check64Bit: Fixed false positive about returning integer for 'p+(n*80)'
This commit is contained in:
parent
1959377423
commit
4f88fdcf4a
|
@ -74,7 +74,11 @@ void Check64BitPortability::pointerassignment()
|
||||||
type = INT;
|
type = INT;
|
||||||
else if (type == PTR && Token::Match(tok2, "- %var%") && isaddr(tok2->next()->variable()))
|
else if (type == PTR && Token::Match(tok2, "- %var%") && isaddr(tok2->next()->variable()))
|
||||||
type = PTRDIFF;
|
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;
|
type = NO;
|
||||||
break;
|
break;
|
||||||
} else if (type == PTR && Token::simpleMatch(tok2, "."))
|
} else if (type == PTR && Token::simpleMatch(tok2, "."))
|
||||||
|
|
|
@ -193,6 +193,12 @@ private:
|
||||||
" return 1 + p->i;\n"
|
" return 1 + p->i;\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue