MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / unreadVariableError

Method unreadVariableError

lib/checkunusedvar.cpp:1498–1507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1496}
1497
1498void CheckUnusedVarImpl::unreadVariableError(const Token *tok, const std::string &varname, bool modified)
1499{
1500 if (!mSettings.severity.isEnabled(Severity::style) && !mSettings.isPremiumEnabled("unusedVariable"))
1501 return;
1502
1503 if (modified)
1504 reportError(tok, Severity::style, "unreadVariable", "$symbol:" + varname + "\nVariable '$symbol' is modified but its new value is never used.", CWE563, Certainty::normal);
1505 else
1506 reportError(tok, Severity::style, "unreadVariable", "$symbol:" + varname + "\nVariable '$symbol' is assigned a value that is never used.", CWE563, Certainty::normal);
1507}
1508
1509void CheckUnusedVarImpl::unassignedVariableError(const Token *tok, const std::string &varname)
1510{

Callers 1

getErrorMessagesMethod · 0.80

Calls 3

isPremiumEnabledMethod · 0.80
reportErrorFunction · 0.70
isEnabledMethod · 0.45

Tested by

no test coverage detected