From 647b533bce48b741a6b048a1e62b24b9bb2f8d23 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 7 Jul 2015 23:37:20 +0200 Subject: cmMakefile: Implement FormatListFileStack in terms of cmState. --- Source/cmMakefile.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 94c77e1..cbaf972 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4439,14 +4439,22 @@ void cmMakefile::AddCMakeDependFilesFromUser() std::string cmMakefile::FormatListFileStack() const { + std::vector listFiles; + cmState::Snapshot snp = this->StateSnapshot; + while (snp.IsValid()) + { + listFiles.push_back(snp.GetExecutionListFile()); + snp = snp.GetCallStackParent(); + } + std::reverse(listFiles.begin(), listFiles.end()); std::ostringstream tmp; - size_t depth = this->ListFileStack.size(); + size_t depth = listFiles.size(); if (depth > 0) { - std::vector::const_iterator it = this->ListFileStack.end(); + std::vector::const_iterator it = listFiles.end(); do { - if (depth != this->ListFileStack.size()) + if (depth != listFiles.size()) { tmp << "\n "; } @@ -4457,7 +4465,7 @@ std::string cmMakefile::FormatListFileStack() const tmp << *it; depth--; } - while (it != this->ListFileStack.begin()); + while (it != listFiles.begin()); } return tmp.str(); } -- cgit v0.12 From 6083ec9a78fd48c66087f9c9e887b9b405c69999 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 7 Jul 2015 23:36:13 +0200 Subject: cmMakefile: Implement LISTFILE_STACK property in terms of cmState. --- Source/cmMakefile.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cbaf972..647caba 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4282,7 +4282,15 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "LISTFILE_STACK") { - output = cmJoin(this->ListFileStack, ";"); + std::vector listFiles; + cmState::Snapshot snp = this->StateSnapshot; + while (snp.IsValid()) + { + listFiles.push_back(snp.GetExecutionListFile()); + snp = snp.GetCallStackParent(); + } + std::reverse(listFiles.begin(), listFiles.end()); + output = cmJoin(listFiles, ";"); return output.c_str(); } else if ( prop == "CACHE_VARIABLES" ) -- cgit v0.12 From 8e7d3030773aae4b1784383abd6af4e5cec087c6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 7 Jul 2015 23:50:54 +0200 Subject: cmMakefile: Simplify setting of current snapshot. --- Source/cmMakefile.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 647caba..bd13a17 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1714,8 +1714,7 @@ public: 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->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot); this->GG->SetCurrentMakefile(mf); #if defined(CMAKE_BUILD_WITH_CMAKE) this->GG->GetFileLockPool().PushFileScope(); -- cgit v0.12 From e77c46664c384211294b6bdfef99c92212826cc6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 13:19:34 +0200 Subject: cmMakefile: Remove obsolete condition. --- Source/cmMakefile.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index bd13a17..0f55017 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3436,10 +3436,6 @@ bool cmMakefile::IsLoopBlock() const std::string cmMakefile::GetExecutionFilePath() const { - if (this->ContextStack.empty()) - { - return std::string(); - } assert(this->StateSnapshot.IsValid()); return this->StateSnapshot.GetExecutionListFile(); } -- cgit v0.12 From 54cc0c0e1f98508892ce653591178c86ff067364 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Jul 2015 13:18:34 +0200 Subject: cmMakefile: Port some users of ListFileStack to cmState. --- Source/cmMakefile.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0f55017..f8ac52e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -260,7 +260,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, cmListFileContext lfc; // We are not currently executing a command. Add whatever context // information we have. - lfc.FilePath = this->ListFileStack.back(); + lfc.FilePath = this->GetExecutionFilePath(); if(!this->GetCMakeInstance()->GetIsInTryCompile()) { @@ -514,7 +514,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011() std::ostringstream w; w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0011) << "\n" << "The included script\n " - << this->Makefile->ListFileStack.back() << "\n" + << this->Makefile->GetExecutionFilePath() << "\n" << "affects policy settings. " << "CMake is implying the NO_POLICY_SCOPE option for compatibility, " << "so the effects are applied to the including context."; @@ -527,7 +527,7 @@ void cmMakefile::IncludeScope::EnforceCMP0011() std::ostringstream e; e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n" << "The included script\n " - << this->Makefile->ListFileStack.back() << "\n" + << this->Makefile->GetExecutionFilePath() << "\n" << "affects policy settings, so it requires this policy to be set."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); } -- cgit v0.12 From 640fc5b54a8e7f9e000d5a661f0656a8701639b5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 7 Jul 2015 23:40:48 +0200 Subject: cmMakefile: Remove unused ListFileStack. --- Source/cmMakefile.cxx | 5 ----- Source/cmMakefile.h | 3 --- 2 files changed, 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f8ac52e..2216264 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -455,7 +455,6 @@ 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(); this->Makefile->StateSnapshot = @@ -498,7 +497,6 @@ cmMakefile::IncludeScope::~IncludeScope() this->EnforceCMP0011(); } } - this->Makefile->ListFileStack.pop_back(); } //---------------------------------------------------------------------------- @@ -593,7 +591,6 @@ public: ListFileScope(cmMakefile* mf, std::string const& filenametoread) : Makefile(mf), ReportError(true) { - this->Makefile->ListFileStack.push_back(filenametoread); this->Makefile->PushPolicyBarrier(); long line = 0; @@ -618,7 +615,6 @@ public: this->Makefile->PopFunctionBlockerBarrier(this->ReportError); this->Makefile->PopPolicyBarrier(this->ReportError); - this->Makefile->ListFileStack.pop_back(); } void Quiet() { this->ReportError = false; } @@ -1707,7 +1703,6 @@ public: this->Makefile->StateSnapshot.GetCurrentSourceDirectory(); currentStart += "/CMakeLists.txt"; this->Makefile->StateSnapshot.SetListFile(currentStart); - this->Makefile->ListFileStack.push_back(currentStart); this->Makefile->PushPolicyBarrier(); this->Makefile->PushFunctionBlockerBarrier(); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 82a2279..415b5fe 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -934,9 +934,6 @@ private: cmPropertyMap Properties; - // stack of list files being read - std::vector ListFileStack; - std::vector ContextStack; std::vector ExecutionStatusStack; friend class cmMakefileCall; -- cgit v0.12