summaryrefslogtreecommitdiffstats
path: root/Source/cmFunctionBlocker.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2022-08-05 15:21:46 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2022-08-22 14:25:53 (GMT)
commit553da0685f4ed8785a0426caebad7338e8813322 (patch)
tree043c98815af0baaee4684fe6fa21493e911d13b5 /Source/cmFunctionBlocker.cxx
parent02c067dee5b53ca318f3acd245795172a0280f1f (diff)
downloadCMake-553da0685f4ed8785a0426caebad7338e8813322.zip
CMake-553da0685f4ed8785a0426caebad7338e8813322.tar.gz
CMake-553da0685f4ed8785a0426caebad7338e8813322.tar.bz2
cmFunctionBlocker: Add handling of close block without parameters.
Diffstat (limited to 'Source/cmFunctionBlocker.cxx')
-rw-r--r--Source/cmFunctionBlocker.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/Source/cmFunctionBlocker.cxx b/Source/cmFunctionBlocker.cxx
index 40e692d..523482a 100644
--- a/Source/cmFunctionBlocker.cxx
+++ b/Source/cmFunctionBlocker.cxx
@@ -24,10 +24,11 @@ bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
auto self = mf.RemoveFunctionBlocker();
assert(self.get() == this);
- if (!this->ArgumentsMatch(lff, mf)) {
- cmListFileContext const& lfc = this->GetStartingContext();
- cmListFileContext closingContext =
- cmListFileContext::FromListFileFunction(lff, lfc.FilePath);
+ cmListFileContext const& lfc = this->GetStartingContext();
+ cmListFileContext closingContext =
+ cmListFileContext::FromListFileFunction(lff, lfc.FilePath);
+ if (this->EndCommandSupportsArguments() &&
+ !this->ArgumentsMatch(lff, mf)) {
std::ostringstream e;
/* clang-format off */
e << "A logical block opening on the line\n"
@@ -37,6 +38,15 @@ bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
<< "with mis-matching arguments.";
/* clang-format on */
mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
+ } else if (!this->EndCommandSupportsArguments() &&
+ !lff.Arguments().empty()) {
+ std::ostringstream e;
+ /* clang-format off */
+ e << "A logical block closing on the line\n"
+ " " << closingContext << "\n"
+ "has unexpected arguments.";
+ /* clang-format on */
+ mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
}
return this->Replay(std::move(this->Functions), status);