From 2ee9352952c90c0bf1e25a489ee9111d9d32fd7f Mon Sep 17 00:00:00 2001 From: firewave Date: Wed, 11 Sep 2024 11:17:27 +0200 Subject: [PATCH] removed unnecessary checks not detected by tooling --- lib/cppcheck.cpp | 4 ++-- lib/templatesimplifier.cpp | 2 +- lib/tokenize.cpp | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 8668db48a3f..435f1b17ecb 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -1103,8 +1103,8 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer) if (mSettings.useSingleJob() || !mSettings.buildDir.empty()) { // Analyse the tokens.. - - if (CTU::FileInfo * const fi1 = CTU::getFileInfo(tokenizer)) { + { + CTU::FileInfo * const fi1 = CTU::getFileInfo(tokenizer); if (!mSettings.buildDir.empty()) mAnalyzerInformation.setFileInfo("ctu", fi1->toString()); if (mSettings.useSingleJob()) diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index c2067c94a73..4f76648ae92 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -1346,7 +1346,7 @@ void TemplateSimplifier::simplifyTemplateAliases() const Token * const fromStart = args[argnr].first; const Token * const fromEnd = args[argnr].second->previous(); Token *temp = TokenList::copyTokens(tok1, fromStart, fromEnd, true); - const bool tempOK(temp && temp != tok1->next()); + const bool tempOK(temp != tok1->next()); tok1->deleteThis(); if (tempOK) tok1 = temp; // skip over inserted parameters diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index d3211f35d74..e16cd83a681 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2152,9 +2152,6 @@ void Tokenizer::simplifyTypedefCpp() tok2 = TokenList::copyTokens(tok2, argStart, argEnd); if (inTemplate) { - if (!tok2) - syntaxError(nullptr); - tok2 = tok2->next(); }