summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-19 15:09:36 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-05-19 15:09:36 (GMT)
commit0cbc69b9ea97a44280350a58a365c617896e4589 (patch)
tree0e65541d3986b4b86d3d62fe21545bdf7ad5172a /Source/cmMakefile.cxx
parent56dc91c3adac1abbd2326fe677b6093c997771c1 (diff)
parent61d52e6e77bef903225bd3bad3e381bac73ee557 (diff)
downloadCMake-0cbc69b9ea97a44280350a58a365c617896e4589.zip
CMake-0cbc69b9ea97a44280350a58a365c617896e4589.tar.gz
CMake-0cbc69b9ea97a44280350a58a365c617896e4589.tar.bz2
Merge topic 'minor-cleanups'
61d52e6e cmListFileBacktrace: Hide the context-stack implementation detail. a271f7f1 cmTarget: Simplify CMP0023 message loop. f4300cd4 cmTarget: Simplify output computation. 65a42849 cmTarget: Store context in stack only if different. 9645cba3 cmListFileContext: Implement EqualityComparable. 52a8d19c cmTarget: Store only cmListFileContext for CMP0023 handling. 59ba1215 cmTarget: Remove needless iteration. 18f810a8 cmListFileContext: Sort by line before file. e96b5d14 cmListFileContext: Implement LessThanComparable. 7eb0dfa0 cmMakefile: Use std::set::insert API to simplify CMP0054 handling. f9785e0c cmMakefile: Simplify CMP0054 handling. e17b5e42 cmMakefile: Add access to the top-level execution context. 1ec1bf9f if(): Test the effect of cmMakefileCall use in elseif() handling. 9b4aefad cmMakefile: Replace deques with vectors.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx39
1 files changed, 17 insertions, 22 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 99d22d6..3e19cbb 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -350,7 +350,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
lfc.FilePath = this->ListFileStack.back();
}
lfc.Line = 0;
- backtrace.push_back(lfc);
+ backtrace.Append(lfc);
}
// Issue the message.
@@ -364,12 +364,18 @@ cmListFileBacktrace cmMakefile::GetBacktrace() const
for(CallStackType::const_reverse_iterator i = this->CallStack.rbegin();
i != this->CallStack.rend(); ++i)
{
- backtrace.push_back(*i->Context);
+ backtrace.Append(*i->Context);
}
return backtrace;
}
//----------------------------------------------------------------------------
+cmListFileContext cmMakefile::GetExecutionContext() const
+{
+ return *this->CallStack.back().Context;
+}
+
+//----------------------------------------------------------------------------
void cmMakefile::PrintCommandTrace(const cmListFileFunction& lff) const
{
std::ostringstream msg;
@@ -1929,9 +1935,9 @@ void cmMakefile::CheckForUnused(const char* reason,
cmListFileBacktrace bt(this->GetLocalGenerator());
if (!this->CallStack.empty())
{
- const cmListFileContext* file = this->CallStack.back().Context;
- bt.push_back(*file);
- path = file->FilePath.c_str();
+ cmListFileContext file = this->GetExecutionContext();
+ bt.Append(file);
+ path = file.FilePath;
}
else
{
@@ -1940,7 +1946,7 @@ void cmMakefile::CheckForUnused(const char* reason,
cmListFileContext lfc;
lfc.FilePath = path;
lfc.Line = 0;
- bt.push_back(lfc);
+ bt.Append(lfc);
}
if (this->CheckSystemVars ||
cmSystemTools::IsSubDirectory(path,
@@ -2870,7 +2876,7 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
cmListFileContext lfc;
lfc.FilePath = filename;
lfc.Line = line;
- bt.push_back(lfc);
+ bt.Append(lfc);
msg << "uninitialized variable \'" << lookup << "\'";
this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING,
msg.str(), bt);
@@ -3403,7 +3409,7 @@ void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
if(!this->CallStack.empty())
{
// Record the context in which the blocker is created.
- fb->SetStartingContext(*(this->CallStack.back().Context));
+ fb->SetStartingContext(this->GetExecutionContext());
}
this->FunctionBlockers.push_back(fb);
@@ -4364,7 +4370,7 @@ std::string cmMakefile::GetListFileStack() const
size_t depth = this->ListFileStack.size();
if (depth > 0)
{
- std::deque<std::string>::const_iterator it = this->ListFileStack.end();
+ std::vector<std::string>::const_iterator it = this->ListFileStack.end();
do
{
if (depth != this->ListFileStack.size())
@@ -4928,20 +4934,9 @@ bool cmMakefile::SetPolicyVersion(const char *version)
}
//----------------------------------------------------------------------------
-bool cmMakefile::HasCMP0054AlreadyBeenReported(
- cmListFileContext context) const
+bool cmMakefile::HasCMP0054AlreadyBeenReported() const
{
- cmCMP0054Id id(context);
-
- bool alreadyReported =
- this->CMP0054ReportedIds.find(id) != this->CMP0054ReportedIds.end();
-
- if(!alreadyReported)
- {
- this->CMP0054ReportedIds.insert(id);
- }
-
- return alreadyReported;
+ return !this->CMP0054ReportedIds.insert(this->GetExecutionContext()).second;
}
//----------------------------------------------------------------------------