From 8841bd7e28b7b5203212f2e7f87af5dd0cc91371 Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 19 Jan 2024 10:16:23 +0100 Subject: [PATCH] CppCheck: no need to preprocess markup files as they are not actual source code --- lib/cppcheck.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 3cff13db735..d587cef15b5 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -632,6 +632,18 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string CheckUnusedFunctions checkUnusedFunctions(nullptr, nullptr, nullptr); try { + if (mSettings.library.markupFile(filename)) { + Tokenizer tokenizer(mSettings, this); + if (fileStream) + tokenizer.list.createTokens(*fileStream, filename); + else { + std::ifstream in(filename); + tokenizer.list.createTokens(in, filename); + } + checkUnusedFunctions.getFileInfo(&tokenizer, &mSettings); + return EXIT_SUCCESS; + } + Preprocessor preprocessor(mSettings, this); std::set configurations; @@ -662,13 +674,6 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string return mExitCode; } - if (mSettings.library.markupFile(filename)) { - Tokenizer tokenizer(mSettings, this, &preprocessor); - tokenizer.createTokens(std::move(tokens1)); - checkUnusedFunctions.getFileInfo(&tokenizer, &mSettings); - return EXIT_SUCCESS; - } - if (!preprocessor.loadFiles(tokens1, files)) return mExitCode;