diff options
author | Regina Pfeifer <regina@mailbox.org> | 2019-07-30 22:58:40 +0200 |
---|---|---|
committer | Regina Pfeifer <regina@mailbox.org> | 2019-07-31 00:03:17 +0200 |
commit | 6491270e0d3699f5151c08ef41dce84724f9ffc1 (patch) | |
tree | f4caa3b0bc5262e73352394a4bb0ed534a765133 /Source/cmFunctionBlocker.cxx | |
parent | af24e4ef6e216184b8c207728d6b0312ce3c1525 (diff) | |
download | cmake-6491270e0d3699f5151c08ef41dce84724f9ffc1.tar.gz |
cmFunctionBlocker: Move check for matching args
Diffstat (limited to 'Source/cmFunctionBlocker.cxx')
-rw-r--r-- | Source/cmFunctionBlocker.cxx | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/Source/cmFunctionBlocker.cxx b/Source/cmFunctionBlocker.cxx index 29996916a6..437d4b5c31 100644 --- a/Source/cmFunctionBlocker.cxx +++ b/Source/cmFunctionBlocker.cxx @@ -2,8 +2,12 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmFunctionBlocker.h" +#include <cassert> +#include <sstream> + #include "cmExecutionStatus.h" #include "cmMakefile.h" +#include "cmMessageType.h" bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, cmExecutionStatus& status) @@ -14,7 +18,24 @@ bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, this->ScopeDepth--; if (this->ScopeDepth == 0U) { cmMakefile& mf = status.GetMakefile(); - auto self = mf.RemoveFunctionBlocker(this, lff); + auto self = mf.RemoveFunctionBlocker(); + assert(self.get() == this); + + if (!this->ArgumentsMatch(lff, mf)) { + cmListFileContext const& lfc = this->GetStartingContext(); + cmListFileContext closingContext = + cmListFileContext::FromCommandContext(lff, lfc.FilePath); + std::ostringstream e; + /* clang-format off */ + e << "A logical block opening on the line\n" + << " " << lfc << "\n" + << "closes on the line\n" + << " " << closingContext << "\n" + << "with mis-matching arguments."; + /* clang-format on */ + mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str()); + } + return this->Replay(this->Functions, status); } } |