From d7a1063b209fd2649cca5e98353c71ff560f6e7a Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Tue, 10 Sep 2002 10:16:50 -0400 Subject: [PATCH] better error checking on If statements --- Source/cmEndIfCommand.cxx | 11 ++--------- Source/cmIfCommand.cxx | 7 +++++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Source/cmEndIfCommand.cxx b/Source/cmEndIfCommand.cxx index 7b46eaa8b..f91c38e55 100644 --- a/Source/cmEndIfCommand.cxx +++ b/Source/cmEndIfCommand.cxx @@ -19,14 +19,7 @@ bool cmEndIfCommand::InitialPass(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 - m_Makefile->RemoveFunctionBlocker("ENDIF",args); - - return true; + this->SetError("An ENDIF command was found outside of a proper IF ENDIF structure. Or its arguments did not match the opening IF command."); + return false; } diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 0e2027248..ebac504ee 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -19,7 +19,7 @@ bool cmIfFunctionBlocker:: IsFunctionBlocked(const char *name, const std::vector &args, - cmMakefile &) + cmMakefile &mf) { if (!strcmp(name,"ELSE") || !strcmp(name,"ENDIF")) { @@ -32,7 +32,10 @@ IsFunctionBlocked(const char *name, const std::vector &args, m_IsBlocking = !m_IsBlocking; return true; } - return false; + // otherwise it must be an ENDIF statement, in that case remove the + // function blocker + mf.RemoveFunctionBlocker("ENDIF",args); + return true; } else if(args.empty()) {