cmMakefile: Port nested error logic away from cmExecutionStatus

It is no longer needed.
This commit is contained in:
Stephen Kelly 2016-01-28 22:10:29 +01:00 committed by Brad King
parent 2af853deb5
commit 14a8d61fd4
4 changed files with 16 additions and 16 deletions

View File

@ -38,16 +38,12 @@ public:
this->ReturnInvoked = false; this->ReturnInvoked = false;
this->BreakInvoked = false; this->BreakInvoked = false;
this->ContinueInvoked = false; this->ContinueInvoked = false;
this->NestedError = false;
} }
void SetNestedError(bool val) { this->NestedError = val; }
bool GetNestedError() { return this->NestedError; }
private: private:
bool ReturnInvoked; bool ReturnInvoked;
bool BreakInvoked; bool BreakInvoked;
bool ContinueInvoked; bool ContinueInvoked;
bool NestedError;
}; };
#endif #endif

View File

@ -76,7 +76,7 @@ public:
}; };
bool cmFunctionHelperCommand::InvokeInitialPass( bool cmFunctionHelperCommand::InvokeInitialPass(
const std::vector<cmListFileArgument>& args, cmExecutionStatus& inStatus) const std::vector<cmListFileArgument>& args, cmExecutionStatus&)
{ {
// Expand the argument list to the function. // Expand the argument list to the function.
std::vector<std::string> expandedArgs; std::vector<std::string> expandedArgs;
@ -129,11 +129,11 @@ bool cmFunctionHelperCommand::InvokeInitialPass(
for (unsigned int c = 0; c < this->Functions.size(); ++c) { for (unsigned int c = 0; c < this->Functions.size(); ++c) {
cmExecutionStatus status; cmExecutionStatus status;
if (!this->Makefile->ExecuteCommand(this->Functions[c], 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 // 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);
return false; return false;
} }
if (status.GetReturnInvoked()) { if (status.GetReturnInvoked()) {

View File

@ -159,11 +159,11 @@ bool cmMacroHelperCommand::InvokeInitialPass(
} }
cmExecutionStatus status; cmExecutionStatus status;
if (!this->Makefile->ExecuteCommand(newLFF, status) || if (!this->Makefile->ExecuteCommand(newLFF, status) ||
status.GetNestedError()) { (cmSystemTools::GetErrorOccuredFlag() &&
!cmSystemTools::GetFatalErrorOccured())) {
// 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);
return false; return false;
} }
if (status.GetReturnInvoked()) { if (status.GetReturnInvoked()) {

View File

@ -115,10 +115,6 @@ cmMakefile::~cmMakefile()
void cmMakefile::IssueMessage(cmake::MessageType t, void cmMakefile::IssueMessage(cmake::MessageType t,
std::string const& text) const 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()); this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace());
} }
@ -279,11 +275,19 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
if (this->GetCMakeInstance()->GetTrace()) { if (this->GetCMakeInstance()->GetTrace()) {
this->PrintCommandTrace(lff); this->PrintCommandTrace(lff);
} }
// Try invoking the command.
bool hadPreviousNonFatalError = cmSystemTools::GetErrorOccuredFlag() &&
!cmSystemTools::GetFatalErrorOccured();
cmSystemTools::ResetErrorOccuredFlag();
bool invokeSucceeded = pcmd->InvokeInitialPass(lff.Arguments, status); 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 (!invokeSucceeded || hadNestedError) {
if (!hadNestedError) { if (!hadNestedError && !cmSystemTools::GetFatalErrorOccured()) {
// The command invocation requested that we report an error. // The command invocation requested that we report an error.
this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError()); this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError());
} }