Skip to content

Commit b08bd93

Browse files
committed
Honor library ignorefunction() settings when reporting unused functions.
This change updates CheckUnusedFunctions to skip functions explicitly marked as ignored by the library configuration, both during per-file checks and whole-program analysis. This prevents false positives for known framework hooks, callbacks, or externally-used symbols that should be intentionally excluded from unused-function diagnostics. Signed-off-by: Robin Getz <rgetz503@gmail.com>
1 parent a8f83c1 commit b08bd93

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/checkunusedfunctions.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@ bool CheckUnusedFunctions::check(const Settings& settings, ErrorLogger& errorLog
378378
continue;
379379
if (settings.library.isentrypoint(it->first))
380380
continue;
381+
if (settings.library.ignorefunction(it->first))
382+
continue;
381383
if (!func.usedSameFile) {
382384
if (isOperatorFunction(it->first))
383385
continue;
@@ -490,6 +492,9 @@ void CheckUnusedFunctions::analyseWholeProgram(const Settings &settings, ErrorLo
490492
if (settings.library.isentrypoint(functionName))
491493
continue;
492494

495+
if (settings.library.ignorefunction(functionName))
496+
continue;
497+
493498
if (calls.find(functionName) == calls.end() && !isOperatorFunction(functionName)) {
494499
const Location &loc = decl->second;
495500
unusedFunctionError(errorLogger, loc.fileName, /*fileIndex*/ 0, loc.lineNumber, loc.column, functionName);

0 commit comments

Comments
 (0)