Removed bailout in case a file (without include guards) is included twice. (#5455)
This commit is contained in:
parent
0370c66e41
commit
34ec1112a9
|
@ -2265,7 +2265,7 @@ void Preprocessor::handleIncludes(std::string &code, const std::string &filePath
|
||||||
if (start != std::string::npos)
|
if (start != std::string::npos)
|
||||||
endfilePos = start;
|
endfilePos = start;
|
||||||
}
|
}
|
||||||
std::set<std::string> handledFiles;
|
|
||||||
while ((pos = code.find("#include", pos)) != std::string::npos) {
|
while ((pos = code.find("#include", pos)) != std::string::npos) {
|
||||||
if (_settings.terminated())
|
if (_settings.terminated())
|
||||||
return;
|
return;
|
||||||
|
@ -2306,14 +2306,6 @@ void Preprocessor::handleIncludes(std::string &code, const std::string &filePath
|
||||||
filename = Path::simplifyPath(filename);
|
filename = Path::simplifyPath(filename);
|
||||||
std::string tempFile = filename;
|
std::string tempFile = filename;
|
||||||
std::transform(tempFile.begin(), tempFile.end(), tempFile.begin(), tolowerWrapper);
|
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);
|
processedFile = Preprocessor::read(fin, filename);
|
||||||
fin.close();
|
fin.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue