1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 05:26:58 +08:00

cmExecutionStatus: Remove arguments from setters

The setters are only used to set boolean values.  The values are never
reset individually.
This commit is contained in:
Daniel Pfeifer
2016-12-26 10:30:31 +01:00
parent 0c519c7029
commit 67a8d907ad
10 changed files with 32 additions and 25 deletions

View File

@@ -41,7 +41,7 @@ bool cmBreakCommand::InitialPass(std::vector<std::string> const& args,
} }
} }
status.SetBreakInvoked(true); status.SetBreakInvoked();
if (!args.empty()) { if (!args.empty()) {
bool issueMessage = true; bool issueMessage = true;

View File

@@ -19,7 +19,7 @@ bool cmContinueCommand::InitialPass(std::vector<std::string> const& args,
return true; return true;
} }
status.SetContinueInvoked(true); status.SetContinueInvoked();
if (!args.empty()) { if (!args.empty()) {
this->Makefile->IssueMessage(cmake::FATAL_ERROR, this->Makefile->IssueMessage(cmake::FATAL_ERROR,

View File

@@ -11,16 +11,13 @@
class cmExecutionStatus class cmExecutionStatus
{ {
public: public:
cmExecutionStatus() { this->Clear(); } cmExecutionStatus()
: ReturnInvoked(false)
void SetReturnInvoked(bool val) { this->ReturnInvoked = val; } , BreakInvoked(false)
bool GetReturnInvoked() { return this->ReturnInvoked; } , ContinueInvoked(false)
, NestedError(false)
void SetBreakInvoked(bool val) { this->BreakInvoked = val; } {
bool GetBreakInvoked() { return this->BreakInvoked; } }
void SetContinueInvoked(bool val) { this->ContinueInvoked = val; }
bool GetContinueInvoked() { return this->ContinueInvoked; }
void Clear() void Clear()
{ {
@@ -29,8 +26,18 @@ public:
this->ContinueInvoked = false; this->ContinueInvoked = false;
this->NestedError = false; this->NestedError = false;
} }
void SetNestedError(bool val) { this->NestedError = val; }
bool GetNestedError() { return this->NestedError; } void SetReturnInvoked() { this->ReturnInvoked = true; }
bool GetReturnInvoked() const { return this->ReturnInvoked; }
void SetBreakInvoked() { this->BreakInvoked = true; }
bool GetBreakInvoked() const { return this->BreakInvoked; }
void SetContinueInvoked() { this->ContinueInvoked = true; }
bool GetContinueInvoked() const { return this->ContinueInvoked; }
void SetNestedError() { this->NestedError = true; }
bool GetNestedError() const { return this->NestedError; }
private: private:
bool ReturnInvoked; bool ReturnInvoked;

View File

@@ -58,7 +58,7 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
status.Clear(); status.Clear();
mf.ExecuteCommand(this->Functions[c], status); mf.ExecuteCommand(this->Functions[c], status);
if (status.GetReturnInvoked()) { if (status.GetReturnInvoked()) {
inStatus.SetReturnInvoked(true); inStatus.SetReturnInvoked();
// restore the variable to its prior value // restore the variable to its prior value
mf.AddDefinition(this->Args[0], oldDef.c_str()); mf.AddDefinition(this->Args[0], oldDef.c_str());
return true; return true;

View File

@@ -126,7 +126,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass(
// The error message should have already included the call stack // The error message should have already included the call stack
// so we do not need to report an error here. // so we do not need to report an error here.
functionScope.Quiet(); functionScope.Quiet();
inStatus.SetNestedError(true); inStatus.SetNestedError();
return false; return false;
} }
if (status.GetReturnInvoked()) { if (status.GetReturnInvoked()) {

View File

@@ -137,15 +137,15 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
status.Clear(); status.Clear();
mf.ExecuteCommand(this->Functions[c], status); mf.ExecuteCommand(this->Functions[c], status);
if (status.GetReturnInvoked()) { if (status.GetReturnInvoked()) {
inStatus.SetReturnInvoked(true); inStatus.SetReturnInvoked();
return true; return true;
} }
if (status.GetBreakInvoked()) { if (status.GetBreakInvoked()) {
inStatus.SetBreakInvoked(true); inStatus.SetBreakInvoked();
return true; return true;
} }
if (status.GetContinueInvoked()) { if (status.GetContinueInvoked()) {
inStatus.SetContinueInvoked(true); inStatus.SetContinueInvoked();
return true; return true;
} }
} }

View File

@@ -156,15 +156,15 @@ bool cmMacroHelperCommand::InvokeInitialPass(
// The error message should have already included the call stack // The error message should have already included the call stack
// so we do not need to report an error here. // so we do not need to report an error here.
macroScope.Quiet(); macroScope.Quiet();
inStatus.SetNestedError(true); inStatus.SetNestedError();
return false; return false;
} }
if (status.GetReturnInvoked()) { if (status.GetReturnInvoked()) {
inStatus.SetReturnInvoked(true); inStatus.SetReturnInvoked();
return true; return true;
} }
if (status.GetBreakInvoked()) { if (status.GetBreakInvoked()) {
inStatus.SetBreakInvoked(true); inStatus.SetBreakInvoked();
return true; return true;
} }
} }

View File

@@ -118,7 +118,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
{ {
if (!this->ExecutionStatusStack.empty()) { if (!this->ExecutionStatusStack.empty()) {
if ((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) { if ((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) {
this->ExecutionStatusStack.back()->SetNestedError(true); this->ExecutionStatusStack.back()->SetNestedError();
} }
} }
this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace()); this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace());

View File

@@ -8,6 +8,6 @@
bool cmReturnCommand::InitialPass(std::vector<std::string> const&, bool cmReturnCommand::InitialPass(std::vector<std::string> const&,
cmExecutionStatus& status) cmExecutionStatus& status)
{ {
status.SetReturnInvoked(true); status.SetReturnInvoked();
return true; return true;
} }

View File

@@ -82,7 +82,7 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
cmExecutionStatus status; cmExecutionStatus status;
mf.ExecuteCommand(this->Functions[c], status); mf.ExecuteCommand(this->Functions[c], status);
if (status.GetReturnInvoked()) { if (status.GetReturnInvoked()) {
inStatus.SetReturnInvoked(true); inStatus.SetReturnInvoked();
return true; return true;
} }
if (status.GetBreakInvoked()) { if (status.GetBreakInvoked()) {