summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmForEachCommand.cxx9
-rw-r--r--Source/cmForEachCommand.h1
-rw-r--r--Source/cmFunctionBlocker.h16
-rw-r--r--Source/cmFunctionCommand.cxx11
-rw-r--r--Source/cmFunctionCommand.h1
-rw-r--r--Source/cmIfCommand.cxx18
-rw-r--r--Source/cmIfCommand.h1
-rw-r--r--Source/cmMacroCommand.cxx11
-rw-r--r--Source/cmMacroCommand.h1
-rw-r--r--Source/cmMakefile.cxx21
-rw-r--r--Source/cmMakefile.h3
-rw-r--r--Source/cmWhileCommand.cxx9
-rw-r--r--Source/cmWhileCommand.h1
13 files changed, 30 insertions, 73 deletions
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 193f0a0..436a91b 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -107,15 +107,6 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf)
return false;
}
-void cmForEachFunctionBlocker::
-ScopeEnded(cmMakefile &mf)
-{
- cmSystemTools::Error("The end of a CMakeLists file was reached with a "
- "FOREACH statement that was not closed properly. "
- "Within the directory: ",
- mf.GetCurrentDirectory());
-}
-
bool cmForEachCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index 3357ce4..3e03711 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -35,7 +35,6 @@ public:
cmMakefile &mf,
cmExecutionStatus &);
virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf);
- virtual void ScopeEnded(cmMakefile &mf);
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h
index a169cc1..1433759 100644
--- a/Source/cmFunctionBlocker.h
+++ b/Source/cmFunctionBlocker.h
@@ -19,6 +19,7 @@
#include "cmStandardIncludes.h"
#include "cmExecutionStatus.h"
+#include "cmListFileCache.h"
class cmMakefile;
/** \class cmFunctionBlocker
@@ -43,14 +44,15 @@ public:
virtual bool ShouldRemove(const cmListFileFunction&,
cmMakefile&) {return false;}
- /**
- * When the end of a CMakeList file is reached this method is called. It
- * is not called on the end of an INCLUDE cmake file, just at the end of a
- * regular CMakeList file
- */
- virtual void ScopeEnded(cmMakefile&) {}
-
virtual ~cmFunctionBlocker() {}
+
+ /** Set/Get the context in which this blocker is created. */
+ void SetStartingContext(cmListFileContext const& lfc)
+ { this->StartingContext = lfc; }
+ cmListFileContext const& GetStartingContext()
+ { return this->StartingContext; }
+private:
+ cmListFileContext StartingContext;
};
#endif
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index f36eb74..c1ca8aa 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -258,17 +258,6 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf)
return false;
}
-void cmFunctionFunctionBlocker::
-ScopeEnded(cmMakefile &mf)
-{
- // functions should end with an EndFunction
- cmSystemTools::Error(
- "The end of a CMakeLists file was reached with a FUNCTION statement that "
- "was not closed properly. Within the directory: ",
- mf.GetCurrentDirectory(), " with function ",
- this->Args[0].c_str());
-}
-
bool cmFunctionCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index aff4792..b9f9010 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -34,7 +34,6 @@ public:
cmMakefile &mf,
cmExecutionStatus &);
virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf);
- virtual void ScopeEnded(cmMakefile &mf);
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 1a8c810..74576b5 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -158,24 +158,6 @@ bool cmIfFunctionBlocker::ShouldRemove(const cmListFileFunction& lff,
}
//=========================================================================
-void cmIfFunctionBlocker::ScopeEnded(cmMakefile &mf)
-{
- std::string errmsg = "The end of a CMakeLists file was reached with an "
- "IF statement that was not closed properly.\nWithin the directory: ";
- errmsg += mf.GetCurrentDirectory();
- errmsg += "\nThe arguments are: ";
- for(std::vector<cmListFileArgument>::const_iterator j = this->Args.begin();
- j != this->Args.end(); ++j)
- {
- errmsg += (j->Quoted?"\"":"");
- errmsg += j->Value;
- errmsg += (j->Quoted?"\"":"");
- errmsg += " ";
- }
- cmSystemTools::Message(errmsg.c_str(), "Warning");
-}
-
-//=========================================================================
bool cmIfCommand
::InvokeInitialPass(const std::vector<cmListFileArgument>& args,
cmExecutionStatus &)
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index 0d2802a..4148efd 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -36,7 +36,6 @@ public:
cmExecutionStatus &);
virtual bool ShouldRemove(const cmListFileFunction& lff,
cmMakefile &mf);
- virtual void ScopeEnded(cmMakefile &mf);
std::vector<cmListFileArgument> Args;
std::vector<cmListFileFunction> Functions;
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index e7a27e5..8613044 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -302,17 +302,6 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf)
return false;
}
-void cmMacroFunctionBlocker::
-ScopeEnded(cmMakefile &mf)
-{
- // macros should end with an EndMacro
- cmSystemTools::Error(
- "The end of a CMakeLists file was reached with a MACRO statement that "
- "was not closed properly. Within the directory: ",
- mf.GetCurrentDirectory(), " with macro ",
- this->Args[0].c_str());
-}
-
bool cmMacroCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &)
{
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index 4fcd597..3231d71 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -34,7 +34,6 @@ public:
cmMakefile &mf,
cmExecutionStatus &);
virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf);
- virtual void ScopeEnded(cmMakefile &mf);
std::vector<std::string> Args;
std::vector<cmListFileFunction> Functions;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 34b4855..c6bc4f2 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2365,7 +2365,14 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError)
this->FunctionBlockers.pop_back();
if(reportError)
{
- fb->ScopeEnded(*this);
+ // Report the context in which the unclosed block was opened.
+ cmListFileContext const& lfc = fb->GetStartingContext();
+ cmOStringStream e;
+ e << "A logical block opening on the line\n"
+ << " " << lfc << "\n"
+ << "is not closed.";
+ this->IssueMessage(cmake::FATAL_ERROR, e.str());
+ reportError = false;
}
}
@@ -2402,6 +2409,18 @@ bool cmMakefile::ExpandArguments(
return !cmSystemTools::GetFatalErrorOccured();
}
+//----------------------------------------------------------------------------
+void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
+{
+ if(!this->CallStack.empty())
+ {
+ // Record the context in which the blocker is created.
+ fb->SetStartingContext(*(this->CallStack.back().Context));
+ }
+
+ this->FunctionBlockers.push_back(fb);
+}
+
cmsys::auto_ptr<cmFunctionBlocker>
cmMakefile::RemoveFunctionBlocker(const cmListFileFunction& lff)
{
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index c6b332b..d565b29 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -88,8 +88,7 @@ public:
/**
* Add a function blocker to this makefile
*/
- void AddFunctionBlocker(cmFunctionBlocker *fb)
- { this->FunctionBlockers.push_back(fb);}
+ void AddFunctionBlocker(cmFunctionBlocker* fb);
/**
* Remove the function blocker whose scope ends with the given command.
diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx
index 61d5d85..b6d8e36 100644
--- a/Source/cmWhileCommand.cxx
+++ b/Source/cmWhileCommand.cxx
@@ -97,15 +97,6 @@ ShouldRemove(const cmListFileFunction& lff, cmMakefile& )
return false;
}
-void cmWhileFunctionBlocker::
-ScopeEnded(cmMakefile &mf)
-{
- cmSystemTools::Error(
- "The end of a CMakeLists file was reached with a WHILE statement that "
- "was not closed properly. Within the directory: ",
- mf.GetCurrentDirectory());
-}
-
bool cmWhileCommand
::InvokeInitialPass(const std::vector<cmListFileArgument>& args,
cmExecutionStatus &)
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index 39864cd..25b715d 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -35,7 +35,6 @@ public:
cmMakefile &mf,
cmExecutionStatus &);
virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf);
- virtual void ScopeEnded(cmMakefile &mf);
std::vector<cmListFileArgument> Args;
std::vector<cmListFileFunction> Functions;