summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-06 19:25:26 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-06 20:20:39 (GMT)
commitf1ad71d7f8c066a7e0d0c11bb1ce9d5a5719ec5e (patch)
tree97df21a517176b2ae5b9420bef437fe8595da443 /Source/cmMakefile.cxx
parent8317ea01aa3cf9319ef907e127fa6dbf9666cc53 (diff)
downloadCMake-f1ad71d7f8c066a7e0d0c11bb1ce9d5a5719ec5e.zip
CMake-f1ad71d7f8c066a7e0d0c11bb1ce9d5a5719ec5e.tar.gz
CMake-f1ad71d7f8c066a7e0d0c11bb1ce9d5a5719ec5e.tar.bz2
cmMakefile: Restore nested error logic use of cmExecutionStatus
Since commit 14a8d61f (cmMakefile: Port nested error logic away from cmExecutionStatus) we fail to continue processing function and macro bodies after non-fatal errors. A non-fatal error should not stop foreach loops, macro bodies, nested bodies, or the outer script. Add a test covering these cases, and revert the change to fix them. Also revert commit 2af853de (cmMakefile: Simplify IssueMessage implementation) because the assertion it added (which was removed by the above commit and is restored by reverting it) is incorrect. We do have code paths that call cmMakefile::IssueMessage with an empty execution stack, such as in CheckForUnusedVariables's LogUnused call.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx19
1 files changed, 8 insertions, 11 deletions
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());
}