From f605b92dec414311936ff62afb0ab7847f08974e Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 1 Mar 2012 19:32:38 +0100 Subject: [PATCH] improve error message on a stray "endwhile()" --- Source/cmEndWhileCommand.cxx | 17 +++++++++++++---- Source/cmEndWhileCommand.h | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Source/cmEndWhileCommand.cxx b/Source/cmEndWhileCommand.cxx index bb4d40a47..abb9e5e0b 100644 --- a/Source/cmEndWhileCommand.cxx +++ b/Source/cmEndWhileCommand.cxx @@ -12,12 +12,21 @@ #include "cmEndWhileCommand.h" bool cmEndWhileCommand -::InvokeInitialPass(std::vector const&, +::InvokeInitialPass(std::vector const& args, cmExecutionStatus &) { - this->SetError("An ENDWHILE command was found outside of a proper " - "WHILE ENDWHILE structure. Or its arguments did not " - "match the opening WHILE command."); + if (args.empty()) + { + this->SetError("An ENDWHILE command was found outside of a proper " + "WHILE ENDWHILE structure."); + } + else + { + this->SetError("An ENDWHILE command was found outside of a proper " + "WHILE ENDWHILE structure. Or its arguments did not " + "match the opening WHILE command."); + } + return false; } diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h index 8e0b488f5..61ac7e4e1 100644 --- a/Source/cmEndWhileCommand.h +++ b/Source/cmEndWhileCommand.h @@ -34,7 +34,7 @@ public: * Override cmCommand::InvokeInitialPass to get arguments before * expansion. */ - virtual bool InvokeInitialPass(std::vector const&, + virtual bool InvokeInitialPass(std::vector const& args, cmExecutionStatus &status); /**