cmMakefile: Add filename to ReadListFile auto scopes.

This commit is contained in:
Stephen Kelly 2015-06-21 22:56:15 +02:00
parent 6708d21664
commit b661403177
1 changed files with 6 additions and 6 deletions

View File

@ -408,9 +408,10 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
class cmMakefile::BuildsystemFileScope class cmMakefile::BuildsystemFileScope
{ {
public: public:
BuildsystemFileScope(cmMakefile* mf) BuildsystemFileScope(cmMakefile* mf, std::string const& filename)
: Makefile(mf), ReportError(true) : Makefile(mf), ReportError(true)
{ {
this->Makefile->ListFileStack.push_back(filename);
this->Makefile->PushPolicyBarrier(); this->Makefile->PushPolicyBarrier();
this->Makefile->PushFunctionBlockerBarrier(); this->Makefile->PushFunctionBlockerBarrier();
} }
@ -432,14 +433,13 @@ bool cmMakefile::ProcessBuildsystemFile(const char* filename)
this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename);
std::string curSrc = this->GetCurrentSourceDirectory(); std::string curSrc = this->GetCurrentSourceDirectory();
this->ListFileStack.push_back(filename); BuildsystemFileScope scope(this, filename);
cmListFile listFile; cmListFile listFile;
if (!listFile.ParseFile(filename, curSrc == this->GetHomeDirectory(), this)) if (!listFile.ParseFile(filename, curSrc == this->GetHomeDirectory(), this))
{ {
return false; return false;
} }
BuildsystemFileScope scope(this);
this->ReadListFile(listFile, filename); this->ReadListFile(listFile, filename);
if(cmSystemTools::GetFatalErrorOccured()) if(cmSystemTools::GetFatalErrorOccured())
{ {
@ -604,9 +604,10 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope)
class cmMakefile::ListFileScope class cmMakefile::ListFileScope
{ {
public: public:
ListFileScope(cmMakefile* mf) ListFileScope(cmMakefile* mf, std::string const& filenametoread)
: Makefile(mf), ReportError(true) : Makefile(mf), ReportError(true)
{ {
this->Makefile->ListFileStack.push_back(filenametoread);
this->Makefile->PushPolicyBarrier(); this->Makefile->PushPolicyBarrier();
this->Makefile->PushFunctionBlockerBarrier(); this->Makefile->PushFunctionBlockerBarrier();
} }
@ -630,7 +631,7 @@ bool cmMakefile::ReadListFile(const char* filename)
cmSystemTools::CollapseFullPath(filename, cmSystemTools::CollapseFullPath(filename,
this->GetCurrentSourceDirectory()); this->GetCurrentSourceDirectory());
this->ListFileStack.push_back(filenametoread); ListFileScope scope(this, filenametoread);
cmListFile listFile; cmListFile listFile;
if (!listFile.ParseFile(filenametoread.c_str(), false, this)) if (!listFile.ParseFile(filenametoread.c_str(), false, this))
@ -638,7 +639,6 @@ bool cmMakefile::ReadListFile(const char* filename)
return false; return false;
} }
ListFileScope scope(this);
this->ReadListFile(listFile, filenametoread); this->ReadListFile(listFile, filenametoread);
if(cmSystemTools::GetFatalErrorOccured()) if(cmSystemTools::GetFatalErrorOccured())
{ {