Skip to content

Commit 67b1698

Browse files
committed
daca: suppress variableScope warnings in C code as that is usually suppressed in real world. It should make the daca output more relevant.
1 parent bf3833d commit 67b1698

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

lib/checkother.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -894,19 +894,8 @@ void CheckOther::checkVariableScope()
894894

895895
// In C it is common practice to declare local variables at the
896896
// start of functions.
897-
if (mTokenizer->isC()) {
898-
// Try to autodetect what coding style is used. If a local variable is
899-
// declared in an inner scope then we will warn about all variables.
900-
bool limitScope = false;
901-
for (const Variable* var : symbolDatabase->variableList()) {
902-
if (var && var->isLocal() && var->nameToken()->scope()->type != Scope::ScopeType::eFunction) {
903-
limitScope = true;
904-
break;
905-
}
906-
}
907-
if (!limitScope)
908-
return;
909-
}
897+
if (mSettings->daca && mTokenizer->isC())
898+
return;
910899

911900
for (const Variable* var : symbolDatabase->variableList()) {
912901
if (!var || !var->isLocal() || (!var->isPointer() && !var->isReference() && !var->typeStartToken()->isStandardType()))

0 commit comments

Comments
 (0)