Add include directives to 'define' tokenlist (#3337)

This commit is contained in:
Paul Fultz II 2021-07-16 11:47:35 -05:00 committed by GitHub
parent 92597daf8b
commit f5fac96670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -704,7 +704,7 @@ unsigned int CppCheck::checkFile(const std::string& filename, const std::string
std::string code; std::string code;
const std::list<Directive> &directives = preprocessor.getDirectives(); const std::list<Directive> &directives = preprocessor.getDirectives();
for (const Directive &dir : directives) { for (const Directive &dir : directives) {
if (dir.str.compare(0,8,"#define ") == 0) if (dir.str.compare(0,8,"#define ") == 0 || dir.str.compare(0,9,"#include ") == 0)
code += "#line " + MathLib::toString(dir.linenr) + " \"" + dir.file + "\"\n" + dir.str + '\n'; code += "#line " + MathLib::toString(dir.linenr) + " \"" + dir.file + "\"\n" + dir.str + '\n';
} }
Tokenizer tokenizer2(&mSettings, this); Tokenizer tokenizer2(&mSettings, this);