Skip to content

Commit

Permalink
CppCheck: only invoke CheckUnusedFunctions::check() if `unusedFunct…
Browse files Browse the repository at this point in the history
…ions` is actually enabled
  • Loading branch information
firewave committed Feb 12, 2024
1 parent ff130b9 commit 83e3cca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,8 @@ bool CppCheck::analyseWholeProgram()
for (Check *check : Check::instances())
errors |= check->analyseWholeProgram(&ctu, mFileInfo, mSettings, *this); // TODO: ctu

errors |= CheckUnusedFunctions::check(mSettings, *this);
if (mSettings.checks.isEnabled(Checks::unusedFunction))
errors |= CheckUnusedFunctions::check(mSettings, *this);

return errors && (mExitCode > 0);
}
Expand Down Expand Up @@ -1859,7 +1860,8 @@ void CppCheck::analyseWholeProgram(const std::string &buildDir, const std::list<
for (Check *check : Check::instances())
check->analyseWholeProgram(&ctuFileInfo, fileInfoList, mSettings, *this);

CheckUnusedFunctions::check(mSettings, *this);
if (mSettings.checks.isEnabled(Checks::unusedFunction))
CheckUnusedFunctions::check(mSettings, *this);

for (Check::FileInfo *fi : fileInfoList)
delete fi;
Expand Down

0 comments on commit 83e3cca

Please sign in to comment.