Add additional checking to avoid ethernal loops when someone is using incorrect different case for the same file.
It should be unlikely that anyone would actually use different files in the same project and separate them only by casing of some letters.
This commit is contained in:
parent
8d6f41397a
commit
c9133fb85d
|
@ -491,15 +491,17 @@ void Preprocessor::handleIncludes(std::string &code, const std::string &filename
|
||||||
filename = getHeaderFileName(filename);
|
filename = getHeaderFileName(filename);
|
||||||
if (filename.length() == 0)
|
if (filename.length() == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (handledFiles.find(filename) != handledFiles.end())
|
std::string tempFile = filename;
|
||||||
|
std::transform(tempFile.begin(), tempFile.end(), tempFile.begin(), static_cast < int(*)(int) > (std::tolower));
|
||||||
|
if (handledFiles.find(tempFile) != handledFiles.end())
|
||||||
{
|
{
|
||||||
// We have processed this file already once, skip
|
// We have processed this file already once, skip
|
||||||
// it this time to avoid ethernal loop.
|
// it this time to avoid ethernal loop.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
handledFiles[ filename ] = true;
|
handledFiles[ tempFile ] = true;
|
||||||
|
|
||||||
// filename contains now a file name e.g. "menu.h"
|
// filename contains now a file name e.g. "menu.h"
|
||||||
std::string processedFile;
|
std::string processedFile;
|
||||||
|
|
Loading…
Reference in New Issue