From 67b1698752efe606cdd7871f2e2c78b71ef8f2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 29 Sep 2020 17:20:19 +0200 Subject: [PATCH] daca: suppress variableScope warnings in C code as that is usually suppressed in real world. It should make the daca output more relevant. --- lib/checkother.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 46d4d57ce..d91e14d1d 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -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) - return; - } + if (mSettings->daca && mTokenizer->isC()) + return; for (const Variable* var : symbolDatabase->variableList()) { if (!var || !var->isLocal() || (!var->isPointer() && !var->isReference() && !var->typeStartToken()->isStandardType()))