diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index d2671ec92a5..861fd372989 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -1104,7 +1104,7 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer) } } - if (!mSettings.buildDir.empty()) { + if (mSettings.checks.isEnabled(Checks::unusedFunction) && !mSettings.buildDir.empty()) { unusedFunctionsChecker.parseTokens(tokenizer, tokenizer.list.getFiles().front().c_str(), mSettings); } if (mSettings.checks.isEnabled(Checks::unusedFunction) && @@ -1145,7 +1145,7 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer) } } - if (!mSettings.buildDir.empty()) { + if (mSettings.checks.isEnabled(Checks::unusedFunction) && !mSettings.buildDir.empty()) { mAnalyzerInformation.setFileInfo("CheckUnusedFunctions", unusedFunctionsChecker.analyzerInfo()); }