missingReturn; ensure Function::returnsVoid returns true when there is unknown macro 'void STDCALL foo() {}'
This commit is contained in:
parent
e4ecfd7be8
commit
24c17916af
|
@ -2689,6 +2689,15 @@ bool Function::returnsVoid(const Function* function, bool unknown)
|
||||||
// Check for unknown types, which could be a void type
|
// Check for unknown types, which could be a void type
|
||||||
if (isUnknownType(function->retDef, defEnd))
|
if (isUnknownType(function->retDef, defEnd))
|
||||||
return unknown;
|
return unknown;
|
||||||
|
if (unknown) {
|
||||||
|
// void STDCALL foo()
|
||||||
|
const Token *def;
|
||||||
|
bool isVoid = false;
|
||||||
|
for (def = function->retDef; def && def->isName(); def = def->next())
|
||||||
|
isVoid |= (def->str() == "void");
|
||||||
|
if (isVoid && def && !Token::Match(def, "*|&|&&"))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1379,6 +1379,9 @@ private:
|
||||||
check("auto foo4() -> void {}");
|
check("auto foo4() -> void {}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("void STDCALL foo() {}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
check("int f() {\n"
|
check("int f() {\n"
|
||||||
"back:\n"
|
"back:\n"
|
||||||
" return 0;\n"
|
" return 0;\n"
|
||||||
|
|
Loading…
Reference in New Issue