aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorSuman <ssubash@commvault.com>2017-08-29 23:58:38 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-09-12 22:35:03 +0800
commit10d290cb9b131f620c56c0bc84a9ab5bcf50368b (patch)
treeaaa7cab938f3f9ec5376503f93dff09aa649f9b6 /libsolidity
parentf2412da80002ad2ca686b8a64210c933ee2f1942 (diff)
downloaddexon-solidity-10d290cb9b131f620c56c0bc84a9ab5bcf50368b.tar.gz
dexon-solidity-10d290cb9b131f620c56c0bc84a9ab5bcf50368b.tar.zst
dexon-solidity-10d290cb9b131f620c56c0bc84a9ab5bcf50368b.zip
Display helpful warning for unused function arguments/return parameters
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/StaticAnalyzer.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/libsolidity/analysis/StaticAnalyzer.cpp b/libsolidity/analysis/StaticAnalyzer.cpp
index 2f130414..d012c25d 100644
--- a/libsolidity/analysis/StaticAnalyzer.cpp
+++ b/libsolidity/analysis/StaticAnalyzer.cpp
@@ -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();
}