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.
This commit is contained in:
Daniel Pfeifer
2016-11-27 20:38:57 +01:00
committed by Brad King
parent 1afbe7d2cc
commit d23a019684
8 changed files with 12 additions and 60 deletions

View File

@@ -3,10 +3,9 @@
#include "cmEndForEachCommand.h"
class cmExecutionStatus;
struct cmListFileArgument;
bool cmEndForEachCommand::InvokeInitialPass(
std::vector<cmListFileArgument> const&, cmExecutionStatus&)
bool cmEndForEachCommand::InitialPass(std::vector<std::string> const&,
cmExecutionStatus&)
{
this->SetError("An ENDFOREACH command was found outside of a proper "
"FOREACH ENDFOREACH structure. Or its arguments did "

View File

@@ -10,7 +10,6 @@
#include "cmCommand.h"
class cmExecutionStatus;
struct cmListFileArgument;
/** \class cmEndForEachCommand
* \brief ends an if block
@@ -25,22 +24,12 @@ public:
*/
cmCommand* Clone() CM_OVERRIDE { return new cmEndForEachCommand; }
/**
* Override cmCommand::InvokeInitialPass to get arguments before
* expansion.
*/
bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
cmExecutionStatus&) CM_OVERRIDE;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool InitialPass(std::vector<std::string> const&,
cmExecutionStatus&) CM_OVERRIDE
{
return false;
}
cmExecutionStatus&) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.

View File

@@ -3,10 +3,9 @@
#include "cmEndFunctionCommand.h"
class cmExecutionStatus;
struct cmListFileArgument;
bool cmEndFunctionCommand::InvokeInitialPass(
std::vector<cmListFileArgument> const&, cmExecutionStatus&)
bool cmEndFunctionCommand::InitialPass(std::vector<std::string> const&,
cmExecutionStatus&)
{
this->SetError("An ENDFUNCTION command was found outside of a proper "
"FUNCTION ENDFUNCTION structure. Or its arguments did not "

View File

@@ -10,7 +10,6 @@
#include "cmCommand.h"
class cmExecutionStatus;
struct cmListFileArgument;
/** \class cmEndFunctionCommand
* \brief ends an if block
@@ -25,22 +24,12 @@ public:
*/
cmCommand* Clone() CM_OVERRIDE { return new cmEndFunctionCommand; }
/**
* Override cmCommand::InvokeInitialPass to get arguments before
* expansion.
*/
bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
cmExecutionStatus&) CM_OVERRIDE;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool InitialPass(std::vector<std::string> const&,
cmExecutionStatus&) CM_OVERRIDE
{
return false;
}
cmExecutionStatus&) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.

View File

@@ -3,10 +3,9 @@
#include "cmEndMacroCommand.h"
class cmExecutionStatus;
struct cmListFileArgument;
bool cmEndMacroCommand::InvokeInitialPass(
std::vector<cmListFileArgument> const&, cmExecutionStatus&)
bool cmEndMacroCommand::InitialPass(std::vector<std::string> const&,
cmExecutionStatus&)
{
this->SetError("An ENDMACRO command was found outside of a proper "
"MACRO ENDMACRO structure. Or its arguments did not "

View File

@@ -10,7 +10,6 @@
#include "cmCommand.h"
class cmExecutionStatus;
struct cmListFileArgument;
/** \class cmEndMacroCommand
* \brief ends an if block
@@ -25,22 +24,12 @@ public:
*/
cmCommand* Clone() CM_OVERRIDE { return new cmEndMacroCommand; }
/**
* Override cmCommand::InvokeInitialPass to get arguments before
* expansion.
*/
bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
cmExecutionStatus&) CM_OVERRIDE;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool InitialPass(std::vector<std::string> const&,
cmExecutionStatus&) CM_OVERRIDE
{
return false;
}
cmExecutionStatus&) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.

View File

@@ -3,10 +3,9 @@
#include "cmEndWhileCommand.h"
class cmExecutionStatus;
struct cmListFileArgument;
bool cmEndWhileCommand::InvokeInitialPass(
std::vector<cmListFileArgument> const&, cmExecutionStatus&)
bool cmEndWhileCommand::InitialPass(std::vector<std::string> const&,
cmExecutionStatus&)
{
this->SetError("An ENDWHILE command was found outside of a proper "
"WHILE ENDWHILE structure. Or its arguments did not "

View File

@@ -10,7 +10,6 @@
#include "cmCommand.h"
class cmExecutionStatus;
struct cmListFileArgument;
/** \class cmEndWhileCommand
* \brief ends a while loop
@@ -25,22 +24,12 @@ public:
*/
cmCommand* Clone() CM_OVERRIDE { return new cmEndWhileCommand; }
/**
* Override cmCommand::InvokeInitialPass to get arguments before
* expansion.
*/
bool InvokeInitialPass(std::vector<cmListFileArgument> const& args,
cmExecutionStatus& status) CM_OVERRIDE;
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool InitialPass(std::vector<std::string> const&,
cmExecutionStatus&) CM_OVERRIDE
{
return false;
}
cmExecutionStatus&) CM_OVERRIDE;
/**
* This determines if the command is invoked when in script mode.