Revert "Removed bailout in case a file (without include guards) is included twice. (#5455)"
This reverts commit 34ec1112a9
.
This commit is contained in:
parent
24882fb53a
commit
b775603e93
|
@ -2265,7 +2265,7 @@ void Preprocessor::handleIncludes(std::string &code, const std::string &filePath
|
|||
if (start != std::string::npos)
|
||||
endfilePos = start;
|
||||
}
|
||||
|
||||
std::set<std::string> handledFiles;
|
||||
while ((pos = code.find("#include", pos)) != std::string::npos) {
|
||||
if (_settings.terminated())
|
||||
return;
|
||||
|
@ -2306,6 +2306,14 @@ void Preprocessor::handleIncludes(std::string &code, const std::string &filePath
|
|||
filename = Path::simplifyPath(filename);
|
||||
std::string tempFile = filename;
|
||||
std::transform(tempFile.begin(), tempFile.end(), tempFile.begin(), tolowerWrapper);
|
||||
if (handledFiles.find(tempFile) != handledFiles.end()) {
|
||||
// We have processed this file already once, skip
|
||||
// it this time to avoid eternal loop.
|
||||
fin.close();
|
||||
continue;
|
||||
}
|
||||
|
||||
handledFiles.insert(tempFile);
|
||||
processedFile = Preprocessor::read(fin, filename);
|
||||
fin.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue