From 14a8d61fd49a9b990cbef7e1495e4763f31c55f2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 28 Jan 2016 22:10:29 +0100 Subject: [PATCH] cmMakefile: Port nested error logic away from cmExecutionStatus It is no longer needed. --- Source/cmExecutionStatus.h | 4 ---- Source/cmFunctionCommand.cxx | 6 +++--- Source/cmMacroCommand.cxx | 4 ++-- Source/cmMakefile.cxx | 18 +++++++++++------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index 508c6bdfe..800651407 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -38,16 +38,12 @@ public: this->ReturnInvoked = false; this->BreakInvoked = false; this->ContinueInvoked = false; - this->NestedError = false; } - void SetNestedError(bool val) { this->NestedError = val; } - bool GetNestedError() { return this->NestedError; } private: bool ReturnInvoked; bool BreakInvoked; bool ContinueInvoked; - bool NestedError; }; #endif diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 40c54dbdc..f0e4854bf 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -76,7 +76,7 @@ public: }; bool cmFunctionHelperCommand::InvokeInitialPass( - const std::vector& args, cmExecutionStatus& inStatus) + const std::vector& args, cmExecutionStatus&) { // Expand the argument list to the function. std::vector expandedArgs; @@ -129,11 +129,11 @@ bool cmFunctionHelperCommand::InvokeInitialPass( for (unsigned int c = 0; c < this->Functions.size(); ++c) { cmExecutionStatus status; if (!this->Makefile->ExecuteCommand(this->Functions[c], status) || - status.GetNestedError()) { + (cmSystemTools::GetErrorOccuredFlag() && + !cmSystemTools::GetFatalErrorOccured())) { // The error message should have already included the call stack // so we do not need to report an error here. functionScope.Quiet(); - inStatus.SetNestedError(true); return false; } if (status.GetReturnInvoked()) { diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index ee9dc8af7..9d312eebc 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -159,11 +159,11 @@ bool cmMacroHelperCommand::InvokeInitialPass( } cmExecutionStatus status; if (!this->Makefile->ExecuteCommand(newLFF, status) || - status.GetNestedError()) { + (cmSystemTools::GetErrorOccuredFlag() && + !cmSystemTools::GetFatalErrorOccured())) { // The error message should have already included the call stack // so we do not need to report an error here. macroScope.Quiet(); - inStatus.SetNestedError(true); return false; } if (status.GetReturnInvoked()) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d299b8bf7..6c83b0622 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -115,10 +115,6 @@ cmMakefile::~cmMakefile() void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text) const { - assert(!this->ExecutionStatusStack.empty()); - if ((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) { - this->ExecutionStatusStack.back()->SetNestedError(true); - } this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace()); } @@ -279,11 +275,19 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, if (this->GetCMakeInstance()->GetTrace()) { this->PrintCommandTrace(lff); } - // Try invoking the command. + + bool hadPreviousNonFatalError = cmSystemTools::GetErrorOccuredFlag() && + !cmSystemTools::GetFatalErrorOccured(); + cmSystemTools::ResetErrorOccuredFlag(); + bool invokeSucceeded = pcmd->InvokeInitialPass(lff.Arguments, status); - bool hadNestedError = status.GetNestedError(); + bool hadNestedError = cmSystemTools::GetErrorOccuredFlag() && + !cmSystemTools::GetFatalErrorOccured(); + if (hadPreviousNonFatalError) { + cmSystemTools::SetErrorOccured(); + } if (!invokeSucceeded || hadNestedError) { - if (!hadNestedError) { + if (!hadNestedError && !cmSystemTools::GetFatalErrorOccured()) { // The command invocation requested that we report an error. this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError()); }