From d23a0196844f066047aa6942b69c6e591462df38 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Sun, 27 Nov 2016 20:38:57 +0100 Subject: Set the error after argument expansion in end commands The current code is optimized for rare error cases. Simplify the code and remove these optimizations. --- Source/cmEndForEachCommand.cxx | 5 ++--- Source/cmEndForEachCommand.h | 13 +------------ Source/cmEndFunctionCommand.cxx | 5 ++--- Source/cmEndFunctionCommand.h | 13 +------------ Source/cmEndMacroCommand.cxx | 5 ++--- Source/cmEndMacroCommand.h | 13 +------------ Source/cmEndWhileCommand.cxx | 5 ++--- Source/cmEndWhileCommand.h | 13 +------------ 8 files changed, 12 insertions(+), 60 deletions(-) diff --git a/Source/cmEndForEachCommand.cxx b/Source/cmEndForEachCommand.cxx index fe6a7f3..81a37c3 100644 --- a/Source/cmEndForEachCommand.cxx +++ b/Source/cmEndForEachCommand.cxx @@ -3,10 +3,9 @@ #include "cmEndForEachCommand.h" class cmExecutionStatus; -struct cmListFileArgument; -bool cmEndForEachCommand::InvokeInitialPass( - std::vector const&, cmExecutionStatus&) +bool cmEndForEachCommand::InitialPass(std::vector const&, + cmExecutionStatus&) { this->SetError("An ENDFOREACH command was found outside of a proper " "FOREACH ENDFOREACH structure. Or its arguments did " diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h index 772a139..e480e72 100644 --- a/Source/cmEndForEachCommand.h +++ b/Source/cmEndForEachCommand.h @@ -10,7 +10,6 @@ #include "cmCommand.h" class cmExecutionStatus; -struct cmListFileArgument; /** \class cmEndForEachCommand * \brief ends an if block @@ -26,21 +25,11 @@ public: cmCommand* Clone() CM_OVERRIDE { return new cmEndForEachCommand; } /** - * Override cmCommand::InvokeInitialPass to get arguments before - * expansion. - */ - bool InvokeInitialPass(std::vector const&, - cmExecutionStatus&) CM_OVERRIDE; - - /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector const&, - cmExecutionStatus&) CM_OVERRIDE - { - return false; - } + cmExecutionStatus&) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndFunctionCommand.cxx b/Source/cmEndFunctionCommand.cxx index 6adb42b..2d6b192 100644 --- a/Source/cmEndFunctionCommand.cxx +++ b/Source/cmEndFunctionCommand.cxx @@ -3,10 +3,9 @@ #include "cmEndFunctionCommand.h" class cmExecutionStatus; -struct cmListFileArgument; -bool cmEndFunctionCommand::InvokeInitialPass( - std::vector const&, cmExecutionStatus&) +bool cmEndFunctionCommand::InitialPass(std::vector const&, + cmExecutionStatus&) { this->SetError("An ENDFUNCTION command was found outside of a proper " "FUNCTION ENDFUNCTION structure. Or its arguments did not " diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h index 2599637..b3cf8e6 100644 --- a/Source/cmEndFunctionCommand.h +++ b/Source/cmEndFunctionCommand.h @@ -10,7 +10,6 @@ #include "cmCommand.h" class cmExecutionStatus; -struct cmListFileArgument; /** \class cmEndFunctionCommand * \brief ends an if block @@ -26,21 +25,11 @@ public: cmCommand* Clone() CM_OVERRIDE { return new cmEndFunctionCommand; } /** - * Override cmCommand::InvokeInitialPass to get arguments before - * expansion. - */ - bool InvokeInitialPass(std::vector const&, - cmExecutionStatus&) CM_OVERRIDE; - - /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector const&, - cmExecutionStatus&) CM_OVERRIDE - { - return false; - } + cmExecutionStatus&) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndMacroCommand.cxx b/Source/cmEndMacroCommand.cxx index 046b0af..6429d7c 100644 --- a/Source/cmEndMacroCommand.cxx +++ b/Source/cmEndMacroCommand.cxx @@ -3,10 +3,9 @@ #include "cmEndMacroCommand.h" class cmExecutionStatus; -struct cmListFileArgument; -bool cmEndMacroCommand::InvokeInitialPass( - std::vector const&, cmExecutionStatus&) +bool cmEndMacroCommand::InitialPass(std::vector const&, + cmExecutionStatus&) { this->SetError("An ENDMACRO command was found outside of a proper " "MACRO ENDMACRO structure. Or its arguments did not " diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h index 3c462d4..bd7cdbd 100644 --- a/Source/cmEndMacroCommand.h +++ b/Source/cmEndMacroCommand.h @@ -10,7 +10,6 @@ #include "cmCommand.h" class cmExecutionStatus; -struct cmListFileArgument; /** \class cmEndMacroCommand * \brief ends an if block @@ -26,21 +25,11 @@ public: cmCommand* Clone() CM_OVERRIDE { return new cmEndMacroCommand; } /** - * Override cmCommand::InvokeInitialPass to get arguments before - * expansion. - */ - bool InvokeInitialPass(std::vector const&, - cmExecutionStatus&) CM_OVERRIDE; - - /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector const&, - cmExecutionStatus&) CM_OVERRIDE - { - return false; - } + cmExecutionStatus&) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndWhileCommand.cxx b/Source/cmEndWhileCommand.cxx index 7201569..9c65bbe 100644 --- a/Source/cmEndWhileCommand.cxx +++ b/Source/cmEndWhileCommand.cxx @@ -3,10 +3,9 @@ #include "cmEndWhileCommand.h" class cmExecutionStatus; -struct cmListFileArgument; -bool cmEndWhileCommand::InvokeInitialPass( - std::vector const&, cmExecutionStatus&) +bool cmEndWhileCommand::InitialPass(std::vector const&, + cmExecutionStatus&) { this->SetError("An ENDWHILE command was found outside of a proper " "WHILE ENDWHILE structure. Or its arguments did not " diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h index d4e97b4..484d7c7 100644 --- a/Source/cmEndWhileCommand.h +++ b/Source/cmEndWhileCommand.h @@ -10,7 +10,6 @@ #include "cmCommand.h" class cmExecutionStatus; -struct cmListFileArgument; /** \class cmEndWhileCommand * \brief ends a while loop @@ -26,21 +25,11 @@ public: cmCommand* Clone() CM_OVERRIDE { return new cmEndWhileCommand; } /** - * Override cmCommand::InvokeInitialPass to get arguments before - * expansion. - */ - bool InvokeInitialPass(std::vector const& args, - cmExecutionStatus& status) CM_OVERRIDE; - - /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ bool InitialPass(std::vector const&, - cmExecutionStatus&) CM_OVERRIDE - { - return false; - } + cmExecutionStatus&) CM_OVERRIDE; /** * This determines if the command is invoked when in script mode. -- cgit v0.12