Avoid functionStatic FP when there is #ifdef in function

This commit is contained in:
Daniel Marjamäki 2020-12-04 20:29:10 +01:00
parent 58af3c7ad7
commit 40963100c4
1 changed files with 3 additions and 0 deletions

View File

@ -1985,6 +1985,9 @@ static const std::set<std::string> stl_containers_not_const = { "map", "unordere
bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool& memberAccessed) const
{
if (mTokenizer->hasIfdef(func->functionScope->bodyStart, func->functionScope->bodyEnd))
return false;
// if the function doesn't have any assignment nor function call,
// it can be a const function..
for (const Token *tok1 = func->functionScope->bodyStart; tok1 && tok1 != func->functionScope->bodyEnd; tok1 = tok1->next()) {