summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-07 13:48:32 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-09-07 13:48:32 (GMT)
commit85bfec7572f84ba259e0eabe383f6dcb0bd45d9b (patch)
tree6ee25d3e327ac5d8cca14f07e7c55acc749e317d /Source
parent4469e986ee2189378f9054231b796249e6db54e1 (diff)
parentf1ad71d7f8c066a7e0d0c11bb1ce9d5a5719ec5e (diff)
downloadCMake-85bfec7572f84ba259e0eabe383f6dcb0bd45d9b.zip
CMake-85bfec7572f84ba259e0eabe383f6dcb0bd45d9b.tar.gz
CMake-85bfec7572f84ba259e0eabe383f6dcb0bd45d9b.tar.bz2
Merge topic 'fix-continue-after-error'
f1ad71d7 cmMakefile: Restore nested error logic use of cmExecutionStatus
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExecutionStatus.h4
-rw-r--r--Source/cmFunctionCommand.cxx6
-rw-r--r--Source/cmMacroCommand.cxx4
-rw-r--r--Source/cmMakefile.cxx19
4 files changed, 17 insertions, 16 deletions
diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h
index 14e1454..7302837 100644
--- a/Source/cmExecutionStatus.h
+++ b/Source/cmExecutionStatus.h
@@ -40,12 +40,16 @@ 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 f0e4854..40c54db 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -76,7 +76,7 @@ public:
};
bool cmFunctionHelperCommand::InvokeInitialPass(
- const std::vector<cmListFileArgument>& args, cmExecutionStatus&)
+ const std::vector<cmListFileArgument>& args, cmExecutionStatus& inStatus)
{
// Expand the argument list to the function.
std::vector<std::string> 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) ||
- (cmSystemTools::GetErrorOccuredFlag() &&
- !cmSystemTools::GetFatalErrorOccured())) {
+ status.GetNestedError()) {
// 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 9d312ee..ee9dc8a 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -159,11 +159,11 @@ bool cmMacroHelperCommand::InvokeInitialPass(
}
cmExecutionStatus status;
if (!this->Makefile->ExecuteCommand(newLFF, status) ||
- (cmSystemTools::GetErrorOccuredFlag() &&
- !cmSystemTools::GetFatalErrorOccured())) {
+ status.GetNestedError()) {
// 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 11ccca1..e5a5e6e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -117,6 +117,11 @@ cmMakefile::~cmMakefile()
void cmMakefile::IssueMessage(cmake::MessageType t,
std::string const& text) const
{
+ if (!this->ExecutionStatusStack.empty()) {
+ if ((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) {
+ this->ExecutionStatusStack.back()->SetNestedError(true);
+ }
+ }
this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace());
}
@@ -277,19 +282,11 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
if (this->GetCMakeInstance()->GetTrace()) {
this->PrintCommandTrace(lff);
}
-
- bool hadPreviousNonFatalError = cmSystemTools::GetErrorOccuredFlag() &&
- !cmSystemTools::GetFatalErrorOccured();
- cmSystemTools::ResetErrorOccuredFlag();
-
+ // Try invoking the command.
bool invokeSucceeded = pcmd->InvokeInitialPass(lff.Arguments, status);
- bool hadNestedError = cmSystemTools::GetErrorOccuredFlag() &&
- !cmSystemTools::GetFatalErrorOccured();
- if (hadPreviousNonFatalError) {
- cmSystemTools::SetErrorOccured();
- }
+ bool hadNestedError = status.GetNestedError();
if (!invokeSucceeded || hadNestedError) {
- if (!hadNestedError && !cmSystemTools::GetFatalErrorOccured()) {
+ if (!hadNestedError) {
// The command invocation requested that we report an error.
this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError());
}