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;