Enable useStlAlgorithm in selfcheck (#4725)

This commit is contained in:
chrchr-github 2023-01-17 20:48:26 +01:00 committed by GitHub
parent f8f66aeea9
commit 50d297b309
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View File

@ -2,7 +2,6 @@ shadowFunction
bitwiseOnBoolean
# temporary suppressions - fix the warnings!
useStlAlgorithm
simplifyUsing:lib/valueptr.h
varid0:gui/projectfile.cpp

View File

@ -243,10 +243,11 @@ int CppCheckExecutor::check_wrapper(CppCheck& cppcheck)
}
bool CppCheckExecutor::reportSuppressions(const Settings &settings, bool unusedFunctionCheckEnabled, const std::map<std::string, std::size_t> &files, ErrorLogger& errorLogger) {
for (const Suppressions::Suppression& suppression: settings.nomsg.getSuppressions()) {
if (suppression.errorId == "unmatchedSuppression" && suppression.fileName.empty() && suppression.lineNumber == Suppressions::Suppression::NO_LINE)
return false;
}
const auto& suppressions = settings.nomsg.getSuppressions();
if (std::any_of(suppressions.begin(), suppressions.end(), [](const Suppressions::Suppression& s) {
return s.errorId == "unmatchedSuppression" && s.fileName.empty() && s.lineNumber == Suppressions::Suppression::NO_LINE;
}))
return false;
bool err = false;
if (settings.jointSuppressionReport) {

View File

@ -4633,10 +4633,12 @@ const Token *Scope::checkVariable(const Token *tok, AccessControl varaccess, con
const Variable *Scope::getVariable(const std::string &varname) const
{
for (const Variable& var: varlist) {
if (var.name() == varname)
return &var;
}
auto it = std::find_if(varlist.begin(), varlist.end(), [&varname](const Variable& var) {
return var.name() == varname;
});
if (it != varlist.end())
return &*it;
if (definedType) {
for (const Type::BaseInfo& baseInfo: definedType->derivedFrom) {
if (baseInfo.type && baseInfo.type->classScope) {