Fixed #7247 (False positive CastAddressToIntegerAtReturn - returning std::string)
This commit is contained in:
parent
350908d0e9
commit
98756ea7f5
|
@ -53,6 +53,12 @@ void Check64BitPortability::pointerassignment()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
||||||
|
// skip nested functions
|
||||||
|
if (tok->str() == "{") {
|
||||||
|
if (tok->scope()->type == Scope::ScopeType::eFunction)
|
||||||
|
tok = tok->link();
|
||||||
|
}
|
||||||
|
|
||||||
if (tok->str() != "return")
|
if (tok->str() != "return")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -201,6 +201,14 @@ private:
|
||||||
" return mmio + (port_no * 0x80);\n"
|
" return mmio + (port_no * 0x80);\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
// #7247 : dont check return statements in nested functions..
|
||||||
|
check("int foo() {\n"
|
||||||
|
" struct {\n"
|
||||||
|
" const char * name() { return \"abc\"; }\n"
|
||||||
|
" } table;\n"
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue