Display helpful warning for unused function arguments/return parameters

This commit is contained in:
Suman
2017-09-12 15:35:03 +01:00
committed by Alex Beregszaszi
parent f2412da800
commit 10d290cb9b
3 changed files with 18 additions and 8 deletions
+10 -1
View File
@@ -69,7 +69,16 @@ void StaticAnalyzer::endVisit(FunctionDefinition const&)
m_constructor = false;
for (auto const& var: m_localVarUseCount)
if (var.second == 0)
m_errorReporter.warning(var.first->location(), "Unused local variable");
{
if (var.first->isCallableParameter())
m_errorReporter.warning(
var.first->location(),
"Unused function parameter. Remove or comment out the variable name to silence this warning."
);
else
m_errorReporter.warning(var.first->location(), "Unused local variable.");
}
m_localVarUseCount.clear();
}