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

Method allocatedButUnusedVariableError

lib/checkunusedvar.cpp:1490–1496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1488}
1489
1490void CheckUnusedVarImpl::allocatedButUnusedVariableError(const Token *tok, const std::string &varname)
1491{
1492 if (!mSettings.severity.isEnabled(Severity::style) && !mSettings.isPremiumEnabled("unusedVariable"))
1493 return;
1494
1495 reportError(tok, Severity::style, "unusedAllocatedMemory", "$symbol:" + varname + "\nVariable '$symbol' is allocated memory that is never used.", CWE563, Certainty::normal);
1496}
1497
1498void CheckUnusedVarImpl::unreadVariableError(const Token *tok, const std::string &varname, bool modified)
1499{

Callers 1

getErrorMessagesMethod · 0.80

Calls 3

isPremiumEnabledMethod · 0.80
reportErrorFunction · 0.70
isEnabledMethod · 0.45

Tested by

no test coverage detected