Fixed Cppcheck warnings

This commit is contained in:
Daniel Marjamäki 2020-05-19 21:55:28 +02:00
parent dc701276de
commit 299e11c991
3 changed files with 7 additions and 6 deletions

View File

@ -207,7 +207,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
undef = 2 + argv[i];
}
mSettings->userUndefs.emplace(undef);
mSettings->userUndefs.insert(undef);
}
else if (std::strncmp(argv[i], "--addon=", 8) == 0)
@ -231,7 +231,7 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
mSettings->clang = true;
else if (std::strncmp(argv[i], "--config-exclude=",17) ==0) {
mSettings->configExcludePaths.emplace(Path::fromNativeSeparators(argv[i] + 17));
mSettings->configExcludePaths.insert(Path::fromNativeSeparators(argv[i] + 17));
}
else if (std::strncmp(argv[i], "--config-excludes-file=", 23) == 0) {

View File

@ -1166,6 +1166,7 @@ bool CppCheckExecutor::tryLoadLibrary(Library& destination, const char* basepath
/**
* Execute a shell command and read the output from it. Returns true if command terminated successfully.
*/
// cppcheck-suppress passedByValue
bool CppCheckExecutor::executeCommand(std::string exe, std::vector<std::string> args, std::string redirect, std::string *output)
{
output->clear();

View File

@ -2470,9 +2470,9 @@ struct SingleValueFlowForwardAnalyzer : ValueFlowForwardAnalyzer {
if (isConditional())
return false;
const Token* condTok = getCondTokFromEnd(endBlock);
std::set<nonneg int> varids;
std::transform(getVars().begin(), getVars().end(), std::inserter(varids, varids.begin()), SelectMapKeys{});
return bifurcate(condTok, varids, getSettings());
std::set<nonneg int> varids2;
std::transform(getVars().begin(), getVars().end(), std::inserter(varids2, varids2.begin()), SelectMapKeys{});
return bifurcate(condTok, varids2, getSettings());
}
return false;
@ -6176,4 +6176,4 @@ std::string ValueFlow::eitherTheConditionIsRedundant(const Token *condition)
return "Either the switch case '" + expr + "' is redundant";
}
return "Either the condition '" + condition->expressionString() + "' is redundant";
}
}