From 79fcc81b6a031cab21e8bd0e3487cdb542aed7ff Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Wed, 12 May 2004 14:32:25 -0400 Subject: [PATCH] better error checking for FOREACH --- Source/cmEndForEachCommand.cxx | 15 ++------------- Source/cmForEachCommand.cxx | 3 ++- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Source/cmEndForEachCommand.cxx b/Source/cmEndForEachCommand.cxx index f29feb908..6324d118a 100644 --- a/Source/cmEndForEachCommand.cxx +++ b/Source/cmEndForEachCommand.cxx @@ -18,18 +18,7 @@ bool cmEndForEachCommand::InvokeInitialPass(std::vector const& args) { - if(args.size() < 1 ) - { - this->SetError("called with incorrect number of arguments"); - return false; - } - - // remove any function blockers for this define - cmListFileFunction lff; - lff.m_Name = "ENDFOREACH"; - lff.m_Arguments = args; - m_Makefile->RemoveFunctionBlocker(lff); - - return true; + this->SetError("An ENDFOREACH command was found outside of a proper FOREACH ENDFOREACH structure. Or its arguments did not match the opening FOREACH command."); + return false; } diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 24f17fa1a..f8bda28fd 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -63,7 +63,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) mf.ExecuteCommand(newLFF); } } - return false; + mf.RemoveFunctionBlocker(lff); + return true; } }