From 276c62253e3f25eda4acbf0049a70c7d622c9ea2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 22:46:42 +0200 Subject: [PATCH 01/13] cmMakefile: Move the IncludeScope to where it is used. --- Source/cmMakefile.cxx | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a3ba13461..522560516 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -405,6 +405,26 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, return result; } +bool cmMakefile::ProcessBuildsystemFile(const char* filename) +{ + this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); + std::string curSrc = this->GetCurrentSourceDirectory(); + + this->ListFileStack.push_back(filename); + + cmListFile listFile; + if (!listFile.ParseFile(filename, curSrc == this->GetHomeDirectory(), this)) + { + return false; + } + + this->PushPolicyBarrier(); + this->ReadListFile(listFile, filename); + this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); + this->EnforceDirectoryLevelRules(); + return true; +} + //---------------------------------------------------------------------------- class cmMakefile::IncludeScope { @@ -532,26 +552,6 @@ void cmMakefile::IncludeScope::EnforceCMP0011() } } -bool cmMakefile::ProcessBuildsystemFile(const char* filename) -{ - this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); - std::string curSrc = this->GetCurrentSourceDirectory(); - - this->ListFileStack.push_back(filename); - - cmListFile listFile; - if (!listFile.ParseFile(filename, curSrc == this->GetHomeDirectory(), this)) - { - return false; - } - - this->PushPolicyBarrier(); - this->ReadListFile(listFile, filename); - this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); - this->EnforceDirectoryLevelRules(); - return true; -} - bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", From 92cecd936999f9a4c67332d1aeaba3ff120fbbc2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 22:50:13 +0200 Subject: [PATCH 02/13] cmMakefile: Add automatic scopes to listfile readers. --- Source/cmMakefile.cxx | 57 ++++++++++++++++++++++++++++++++++++++----- Source/cmMakefile.h | 4 +++ 2 files changed, 55 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 522560516..a10f99cd2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -405,6 +405,26 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, return result; } +class cmMakefile::BuildsystemFileScope +{ +public: + BuildsystemFileScope(cmMakefile* mf) + : Makefile(mf), ReportError(true) + { + this->Makefile->PushPolicyBarrier(); + } + + ~BuildsystemFileScope() + { + this->Makefile->PopPolicyBarrier(this->ReportError); + } + + void Quiet() { this->ReportError = false; } +private: + cmMakefile* Makefile; + bool ReportError; +}; + bool cmMakefile::ProcessBuildsystemFile(const char* filename) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); @@ -417,10 +437,12 @@ bool cmMakefile::ProcessBuildsystemFile(const char* filename) { return false; } - - this->PushPolicyBarrier(); + BuildsystemFileScope scope(this); this->ReadListFile(listFile, filename); - this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); + if(cmSystemTools::GetFatalErrorOccured()) + { + scope.Quiet(); + } this->EnforceDirectoryLevelRules(); return true; } @@ -576,6 +598,27 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) return true; } +class cmMakefile::ListFileScope +{ +public: + ListFileScope(cmMakefile* mf) + : Makefile(mf), ReportError(true) + { + this->Makefile->PushPolicyBarrier(); + } + + ~ListFileScope() + { + this->Makefile->PopPolicyBarrier(this->ReportError); + this->Makefile->ListFileStack.pop_back(); + } + + void Quiet() { this->ReportError = false; } +private: + cmMakefile* Makefile; + bool ReportError; +}; + bool cmMakefile::ReadListFile(const char* filename) { std::string filenametoread = @@ -590,10 +633,12 @@ bool cmMakefile::ReadListFile(const char* filename) return false; } - this->PushPolicyBarrier(); + ListFileScope scope(this); this->ReadListFile(listFile, filenametoread); - this->PopPolicyBarrier(!cmSystemTools::GetFatalErrorOccured()); - this->ListFileStack.pop_back(); + if(cmSystemTools::GetFatalErrorOccured()) + { + scope.Quiet(); + } return true; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 85f117bf6..64783e573 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -968,6 +968,10 @@ private: friend class cmCMakePolicyCommand; class IncludeScope; friend class IncludeScope; + class ListFileScope; + friend class ListFileScope; + class BuildsystemFileScope; + friend class BuildsystemFileScope; // stack of policy settings struct PolicyStackEntry: public cmPolicies::PolicyMap From dd7e42758d4874c087bbbc6ae062f36455f6d49c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 22:50:52 +0200 Subject: [PATCH 03/13] cmMakefile: Move the lexical scope. --- Source/cmMakefile.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a10f99cd2..9948ac889 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -645,6 +645,8 @@ bool cmMakefile::ReadListFile(const char* filename) void cmMakefile::ReadListFile(cmListFile const& listFile, std::string const& filenametoread) { + LexicalPushPop lexScope(this); + // add this list file to the list of dependencies this->ListFiles.push_back(filenametoread); @@ -661,9 +663,6 @@ void cmMakefile::ReadListFile(cmListFile const& listFile, this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_FILE"); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - // Enforce balanced blocks (if/endif, function/endfunction, etc.). - LexicalPushPop lexScope(this); - // Run the parsed commands. const size_t numberFunctions = listFile.Functions.size(); for(size_t i =0; i < numberFunctions; ++i) From 0818737c851dce18a6da442ee73029b0de22ad56 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 22:53:16 +0200 Subject: [PATCH 04/13] cmMakefile: Make listfile scopes responsible for logical checks. Remove the LexicalPushPop. --- Source/cmMakefile.cxx | 23 ++++++----------------- Source/cmMakefile.h | 13 ------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9948ac889..d6cf104a5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -412,10 +412,12 @@ public: : Makefile(mf), ReportError(true) { this->Makefile->PushPolicyBarrier(); + this->Makefile->PushFunctionBlockerBarrier(); } ~BuildsystemFileScope() { + this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopPolicyBarrier(this->ReportError); } @@ -502,11 +504,13 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, // The included file cannot pop our policy scope. this->Makefile->PushPolicyBarrier(); this->Makefile->ListFileStack.push_back(filenametoread); + this->Makefile->PushFunctionBlockerBarrier(); } //---------------------------------------------------------------------------- cmMakefile::IncludeScope::~IncludeScope() { + this->Makefile->PopFunctionBlockerBarrier(this->ReportError); // Enforce matching policy scopes inside the included file. this->Makefile->PopPolicyBarrier(this->ReportError); @@ -605,10 +609,12 @@ public: : Makefile(mf), ReportError(true) { this->Makefile->PushPolicyBarrier(); + this->Makefile->PushFunctionBlockerBarrier(); } ~ListFileScope() { + this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopPolicyBarrier(this->ReportError); this->Makefile->ListFileStack.pop_back(); } @@ -645,8 +651,6 @@ bool cmMakefile::ReadListFile(const char* filename) void cmMakefile::ReadListFile(cmListFile const& listFile, std::string const& filenametoread) { - LexicalPushPop lexScope(this); - // add this list file to the list of dependencies this->ListFiles.push_back(filenametoread); @@ -671,8 +675,6 @@ void cmMakefile::ReadListFile(cmListFile const& listFile, this->ExecuteCommand(listFile.Functions[i],status); if(cmSystemTools::GetFatalErrorOccured()) { - // Exit early due to error. - lexScope.Quiet(); break; } if(status.GetReturnInvoked()) @@ -3521,19 +3523,6 @@ cmMakefile::RemoveFunctionBlocker(cmFunctionBlocker* fb, return cmsys::auto_ptr(); } -//---------------------------------------------------------------------------- -cmMakefile::LexicalPushPop::LexicalPushPop(cmMakefile* mf): - Makefile(mf), ReportError(true) -{ - this->Makefile->PushFunctionBlockerBarrier(); -} - -//---------------------------------------------------------------------------- -cmMakefile::LexicalPushPop::~LexicalPushPop() -{ - this->Makefile->PopFunctionBlockerBarrier(this->ReportError); -} - const char* cmMakefile::GetHomeDirectory() const { return this->GetCMakeInstance()->GetHomeDirectory(); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 64783e573..ebf33df62 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -100,19 +100,6 @@ public: cmsys::auto_ptr RemoveFunctionBlocker(cmFunctionBlocker* fb, const cmListFileFunction& lff); - /** Push/pop a lexical (function blocker) barrier automatically. */ - class LexicalPushPop - { - public: - LexicalPushPop(cmMakefile* mf); - ~LexicalPushPop(); - void Quiet() { this->ReportError = false; } - private: - cmMakefile* Makefile; - bool ReportError; - }; - friend class LexicalPushPop; - /** * Try running cmake and building a file. This is used for dynalically * loaded commands, not as part of the usual build process. From 6708d21664baf3bab6f8af143c373de7af84bffc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 23 Jun 2015 09:25:03 +0200 Subject: [PATCH 05/13] cmMakefile: Remove IncludeScope Quiet call. --- Source/cmMakefile.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d6cf104a5..b21e44117 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -591,7 +591,6 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) cmListFile listFile; if (!listFile.ParseFile(filenametoread.c_str(), false, this)) { - incScope.Quiet(); return false; } this->ReadListFile(listFile, filenametoread); From b661403177edb1d22b89cc4a0ea69a8f93ad2ad2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 22:56:15 +0200 Subject: [PATCH 06/13] cmMakefile: Add filename to ReadListFile auto scopes. --- Source/cmMakefile.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b21e44117..b9a66d3ff 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -408,9 +408,10 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, class cmMakefile::BuildsystemFileScope { public: - BuildsystemFileScope(cmMakefile* mf) + BuildsystemFileScope(cmMakefile* mf, std::string const& filename) : Makefile(mf), ReportError(true) { + this->Makefile->ListFileStack.push_back(filename); this->Makefile->PushPolicyBarrier(); this->Makefile->PushFunctionBlockerBarrier(); } @@ -432,14 +433,13 @@ bool cmMakefile::ProcessBuildsystemFile(const char* filename) this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); std::string curSrc = this->GetCurrentSourceDirectory(); - this->ListFileStack.push_back(filename); + BuildsystemFileScope scope(this, filename); cmListFile listFile; if (!listFile.ParseFile(filename, curSrc == this->GetHomeDirectory(), this)) { return false; } - BuildsystemFileScope scope(this); this->ReadListFile(listFile, filename); if(cmSystemTools::GetFatalErrorOccured()) { @@ -604,9 +604,10 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope) class cmMakefile::ListFileScope { public: - ListFileScope(cmMakefile* mf) + ListFileScope(cmMakefile* mf, std::string const& filenametoread) : Makefile(mf), ReportError(true) { + this->Makefile->ListFileStack.push_back(filenametoread); this->Makefile->PushPolicyBarrier(); this->Makefile->PushFunctionBlockerBarrier(); } @@ -630,7 +631,7 @@ bool cmMakefile::ReadListFile(const char* filename) cmSystemTools::CollapseFullPath(filename, this->GetCurrentSourceDirectory()); - this->ListFileStack.push_back(filenametoread); + ListFileScope scope(this, filenametoread); cmListFile listFile; if (!listFile.ParseFile(filenametoread.c_str(), false, this)) @@ -638,7 +639,6 @@ bool cmMakefile::ReadListFile(const char* filename) return false; } - ListFileScope scope(this); this->ReadListFile(listFile, filenametoread); if(cmSystemTools::GetFatalErrorOccured()) { From f346d88d102c627e98f630ae1c9d26cc899f76d8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 23:00:44 +0200 Subject: [PATCH 07/13] cmMakefile: Avoid invoking EnforceDirectoryLevelRules. This is part of the CMP0000 implementation and only needs to be invoked for top-level buildsystem files currently. --- Source/cmGlobalGenerator.cxx | 1 + Source/cmMakefile.cxx | 1 - Source/cmMakefile.h | 5 ++--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 23ab93de8..383984d50 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1106,6 +1106,7 @@ void cmGlobalGenerator::Configure() // now do it lg->GetMakefile()->Configure(); + lg->GetMakefile()->EnforceDirectoryLevelRules(); // update the cache entry for the number of local generators, this is used // for progress diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b9a66d3ff..87292ea62 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -445,7 +445,6 @@ bool cmMakefile::ProcessBuildsystemFile(const char* filename) { scope.Quiet(); } - this->EnforceDirectoryLevelRules(); return true; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index ebf33df62..aa70c725b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -825,6 +825,8 @@ public: std::string GetExecutionFilePath() const; + void EnforceDirectoryLevelRules() const; + protected: // add link libraries and directories to the target void AddGlobalLinkInformation(const std::string& name, cmTarget& target); @@ -975,9 +977,6 @@ private: cmPolicies::PolicyStatus GetPolicyStatusInternal(cmPolicies::PolicyID id) const; - // Enforce rules about CMakeLists.txt files. - void EnforceDirectoryLevelRules() const; - // CMP0053 == old cmake::MessageType ExpandVariablesInStringOld( std::string& errorstr, From 5bf9bfda3f364b27ca91eacab18ec4dad2cc59f7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 23:01:13 +0200 Subject: [PATCH 08/13] cmMakefile: Don't use string comparison to check directory level. --- Source/cmMakefile.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 87292ea62..53c2d4c71 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -431,12 +431,11 @@ private: bool cmMakefile::ProcessBuildsystemFile(const char* filename) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); - std::string curSrc = this->GetCurrentSourceDirectory(); BuildsystemFileScope scope(this, filename); cmListFile listFile; - if (!listFile.ParseFile(filename, curSrc == this->GetHomeDirectory(), this)) + if (!listFile.ParseFile(filename, this->IsRootMakefile(), this)) { return false; } From be5997ef77dccc866ddb96bdfd2f529f74988eef Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 23:13:24 +0200 Subject: [PATCH 09/13] cmMakefile: Inline ProcessBuildsystemFile into only caller. --- Source/cmMakefile.cxx | 82 ++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 53c2d4c71..32dd8f53c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -405,48 +405,6 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, return result; } -class cmMakefile::BuildsystemFileScope -{ -public: - BuildsystemFileScope(cmMakefile* mf, std::string const& filename) - : Makefile(mf), ReportError(true) - { - this->Makefile->ListFileStack.push_back(filename); - this->Makefile->PushPolicyBarrier(); - this->Makefile->PushFunctionBlockerBarrier(); - } - - ~BuildsystemFileScope() - { - this->Makefile->PopFunctionBlockerBarrier(this->ReportError); - this->Makefile->PopPolicyBarrier(this->ReportError); - } - - void Quiet() { this->ReportError = false; } -private: - cmMakefile* Makefile; - bool ReportError; -}; - -bool cmMakefile::ProcessBuildsystemFile(const char* filename) -{ - this->AddDefinition("CMAKE_PARENT_LIST_FILE", filename); - - BuildsystemFileScope scope(this, filename); - - cmListFile listFile; - if (!listFile.ParseFile(filename, this->IsRootMakefile(), this)) - { - return false; - } - this->ReadListFile(listFile, filename); - if(cmSystemTools::GetFatalErrorOccured()) - { - scope.Quiet(); - } - return true; -} - //---------------------------------------------------------------------------- class cmMakefile::IncludeScope { @@ -1697,6 +1655,29 @@ public: } }; +class cmMakefile::BuildsystemFileScope +{ +public: + BuildsystemFileScope(cmMakefile* mf, std::string const& filename) + : Makefile(mf), ReportError(true) + { + this->Makefile->ListFileStack.push_back(filename); + this->Makefile->PushPolicyBarrier(); + this->Makefile->PushFunctionBlockerBarrier(); + } + + ~BuildsystemFileScope() + { + this->Makefile->PopFunctionBlockerBarrier(this->ReportError); + this->Makefile->PopPolicyBarrier(this->ReportError); + } + + void Quiet() { this->ReportError = false; } +private: + cmMakefile* Makefile; + bool ReportError; +}; + //---------------------------------------------------------------------------- void cmMakefile::Configure() { @@ -1710,7 +1691,22 @@ void cmMakefile::Configure() std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory(); currentStart += "/CMakeLists.txt"; assert(cmSystemTools::FileExists(currentStart.c_str(), true)); - this->ProcessBuildsystemFile(currentStart.c_str()); + this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str()); + + { + BuildsystemFileScope scope(this, currentStart); + cmListFile listFile; + if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(), this)) + { + this->SetConfigured(); + return; + } + this->ReadListFile(listFile, currentStart); + if(cmSystemTools::GetFatalErrorOccured()) + { + scope.Quiet(); + } + } // at the end handle any old style subdirs std::vector subdirs = this->UnConfiguredDirectories; From 0a34ea597a954f49335559108bf3fa3382734657 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 21 Jun 2015 23:19:50 +0200 Subject: [PATCH 10/13] cmMakefile: Compute the filename processed in a scope. --- Source/cmMakefile.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 32dd8f53c..3aaf8d0cf 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1658,10 +1658,13 @@ public: class cmMakefile::BuildsystemFileScope { public: - BuildsystemFileScope(cmMakefile* mf, std::string const& filename) + BuildsystemFileScope(cmMakefile* mf) : Makefile(mf), ReportError(true) { - this->Makefile->ListFileStack.push_back(filename); + std::string currentStart = + this->Makefile->StateSnapshot.GetCurrentSourceDirectory(); + currentStart += "/CMakeLists.txt"; + this->Makefile->ListFileStack.push_back(currentStart); this->Makefile->PushPolicyBarrier(); this->Makefile->PushFunctionBlockerBarrier(); } @@ -1694,7 +1697,7 @@ void cmMakefile::Configure() this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str()); { - BuildsystemFileScope scope(this, currentStart); + BuildsystemFileScope scope(this); cmListFile listFile; if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(), this)) { From 3f5200ec5f17de36d0db1729d61e520fb014abe5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 26 Jun 2015 00:11:10 +0200 Subject: [PATCH 11/13] cmMakefile: Expand the scope of scoped buildsystem file state. --- Source/cmMakefile.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3aaf8d0cf..79f4c44d5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1685,6 +1685,7 @@ private: void cmMakefile::Configure() { cmMakefileCurrent cmf(this); + BuildsystemFileScope scope(this); // make sure the CMakeFiles dir is there std::string filesDir = this->StateSnapshot.GetCurrentBinaryDirectory(); @@ -1696,8 +1697,6 @@ void cmMakefile::Configure() assert(cmSystemTools::FileExists(currentStart.c_str(), true)); this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str()); - { - BuildsystemFileScope scope(this); cmListFile listFile; if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(), this)) { @@ -1709,7 +1708,6 @@ void cmMakefile::Configure() { scope.Quiet(); } - } // at the end handle any old style subdirs std::vector subdirs = this->UnConfiguredDirectories; From e28e110d221a50687cc9922743366b2f34ccd852 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 26 Jun 2015 00:11:51 +0200 Subject: [PATCH 12/13] cmMakefile: Rename a variable. --- Source/cmMakefile.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 79f4c44d5..0edced5f6 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1630,13 +1630,13 @@ bool cmMakefile::IsRootMakefile() const class cmMakefileCurrent { cmGlobalGenerator* GG; - cmMakefile* MF; + cmMakefile* CurrentMakefile; cmState::Snapshot Snapshot; public: cmMakefileCurrent(cmMakefile* mf) { this->GG = mf->GetGlobalGenerator(); - this->MF = this->GG->GetCurrentMakefile(); + this->CurrentMakefile = this->GG->GetCurrentMakefile(); this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); this->GG->GetCMakeInstance()->SetCurrentSnapshot( this->GG->GetCMakeInstance()->GetCurrentSnapshot()); @@ -1650,7 +1650,7 @@ public: #if defined(CMAKE_BUILD_WITH_CMAKE) this->GG->GetFileLockPool().PopFileScope(); #endif - this->GG->SetCurrentMakefile(this->MF); + this->GG->SetCurrentMakefile(this->CurrentMakefile); this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); } }; From 48c6a92b286522cf350412d6dd3219b263e9ab5b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 26 Jun 2015 00:13:22 +0200 Subject: [PATCH 13/13] cmMakefile: Merge two Scope types and instances. --- Source/cmMakefile.cxx | 48 ++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0edced5f6..cdcf88c15 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1626,35 +1626,6 @@ bool cmMakefile::IsRootMakefile() const return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid(); } -//---------------------------------------------------------------------------- -class cmMakefileCurrent -{ - cmGlobalGenerator* GG; - cmMakefile* CurrentMakefile; - cmState::Snapshot Snapshot; -public: - cmMakefileCurrent(cmMakefile* mf) - { - this->GG = mf->GetGlobalGenerator(); - this->CurrentMakefile = this->GG->GetCurrentMakefile(); - this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); - this->GG->GetCMakeInstance()->SetCurrentSnapshot( - this->GG->GetCMakeInstance()->GetCurrentSnapshot()); - this->GG->SetCurrentMakefile(mf); -#if defined(CMAKE_BUILD_WITH_CMAKE) - this->GG->GetFileLockPool().PushFileScope(); -#endif - } - ~cmMakefileCurrent() - { -#if defined(CMAKE_BUILD_WITH_CMAKE) - this->GG->GetFileLockPool().PopFileScope(); -#endif - this->GG->SetCurrentMakefile(this->CurrentMakefile); - this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); - } -}; - class cmMakefile::BuildsystemFileScope { public: @@ -1667,24 +1638,41 @@ public: this->Makefile->ListFileStack.push_back(currentStart); this->Makefile->PushPolicyBarrier(); this->Makefile->PushFunctionBlockerBarrier(); + + this->GG = mf->GetGlobalGenerator(); + this->CurrentMakefile = this->GG->GetCurrentMakefile(); + this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot(); + this->GG->GetCMakeInstance()->SetCurrentSnapshot( + this->GG->GetCMakeInstance()->GetCurrentSnapshot()); + this->GG->SetCurrentMakefile(mf); +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GG->GetFileLockPool().PushFileScope(); +#endif } ~BuildsystemFileScope() { this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopPolicyBarrier(this->ReportError); +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GG->GetFileLockPool().PopFileScope(); +#endif + this->GG->SetCurrentMakefile(this->CurrentMakefile); + this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); } void Quiet() { this->ReportError = false; } private: cmMakefile* Makefile; + cmGlobalGenerator* GG; + cmMakefile* CurrentMakefile; + cmState::Snapshot Snapshot; bool ReportError; }; //---------------------------------------------------------------------------- void cmMakefile::Configure() { - cmMakefileCurrent cmf(this); BuildsystemFileScope scope(this); // make sure the CMakeFiles dir is there