daca: suppress variableScope warnings in C code as that is usually suppressed in real world. It should make the daca output more relevant.

This commit is contained in:
Daniel Marjamäki 2020-09-29 17:20:19 +02:00
parent bf3833dad5
commit 67b1698752
1 changed files with 2 additions and 13 deletions

View File

@ -894,19 +894,8 @@ void CheckOther::checkVariableScope()
// In C it is common practice to declare local variables at the
// start of functions.
if (mTokenizer->isC()) {
// Try to autodetect what coding style is used. If a local variable is
// declared in an inner scope then we will warn about all variables.
bool limitScope = false;
for (const Variable* var : symbolDatabase->variableList()) {
if (var && var->isLocal() && var->nameToken()->scope()->type != Scope::ScopeType::eFunction) {
limitScope = true;
break;
}
}
if (!limitScope)
if (mSettings->daca && mTokenizer->isC())
return;
}
for (const Variable* var : symbolDatabase->variableList()) {
if (!var || !var->isLocal() || (!var->isPointer() && !var->isReference() && !var->typeStartToken()->isStandardType()))