use inline suppressions for varid0 in selfcheck (#3842)

This commit is contained in:
Oliver Stöneberg 2022-02-21 18:35:02 +01:00 committed by GitHub
parent 0c1aea87fb
commit b6876d22e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 1 deletions

View File

@ -16,7 +16,6 @@ symbolDatabaseWarning:tools/triage/moc_*.cpp
# debug suppressions # debug suppressions
valueFlowBailout valueFlowBailout
valueFlowBailoutIncompleteVar valueFlowBailoutIncompleteVar
varid0
autoNoType autoNoType
bailoutUninitVar bailoutUninitVar

View File

@ -48,6 +48,7 @@ bool isZero(T x)
template<class R, class T> template<class R, class T>
R calculate(const std::string& s, const T& x, const T& y, bool* error = nullptr) R calculate(const std::string& s, const T& x, const T& y, bool* error = nullptr)
{ {
// cppcheck-suppress varid0
auto wrap = [](T z) { auto wrap = [](T z) {
return R{z}; return R{z};
}; };

View File

@ -1161,6 +1161,7 @@ static int estimateSize(const Type* type, const Settings* settings, const Symbol
int cumulatedSize = 0; int cumulatedSize = 0;
const bool isUnion = type->classScope->type == Scope::ScopeType::eUnion; const bool isUnion = type->classScope->type == Scope::ScopeType::eUnion;
// cppcheck-suppress varid0
const auto accumulateSize = [](int& cumulatedSize, int size, bool isUnion) -> void { const auto accumulateSize = [](int& cumulatedSize, int size, bool isUnion) -> void {
if (isUnion) if (isUnion)
cumulatedSize = std::max(cumulatedSize, size); cumulatedSize = std::max(cumulatedSize, size);

View File

@ -58,6 +58,7 @@ std::string Summaries::create(const Tokenizer *tokenizer, const std::string &cfg
} }
// Write summary for function // Write summary for function
// cppcheck-suppress varid0
auto join = [](const std::set<std::string> &data) -> std::string { auto join = [](const std::set<std::string> &data) -> std::string {
std::string ret; std::string ret;
const char *sep = ""; const char *sep = "";

View File

@ -3967,6 +3967,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
argType = findVariableTypeIncludingUsedNamespaces(symbolDatabase, scope, typeTok); argType = findVariableTypeIncludingUsedNamespaces(symbolDatabase, scope, typeTok);
// save type // save type
// cppcheck-suppress varid0
const_cast<Token *>(typeTok)->type(argType); const_cast<Token *>(typeTok)->type(argType);
} }

View File

@ -4138,6 +4138,7 @@ static void valueFlowLifetime(TokenList *tokenlist, SymbolDatabase*, ErrorLogger
}; };
bool update = false; bool update = false;
// cppcheck-suppress varid0
auto captureVariable = [&](const Token* tok2, Lambda::Capture c, std::function<bool(const Token*)> pred) { auto captureVariable = [&](const Token* tok2, Lambda::Capture c, std::function<bool(const Token*)> pred) {
if (varids.count(tok->varId()) > 0) if (varids.count(tok->varId()) > 0)
return; return;