mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-27 03:08:35 -06:00
cmFunctionBlocker: Add handling of close block without parameters.
This commit is contained in:
@@ -24,10 +24,11 @@ bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
|
|||||||
auto self = mf.RemoveFunctionBlocker();
|
auto self = mf.RemoveFunctionBlocker();
|
||||||
assert(self.get() == this);
|
assert(self.get() == this);
|
||||||
|
|
||||||
if (!this->ArgumentsMatch(lff, mf)) {
|
cmListFileContext const& lfc = this->GetStartingContext();
|
||||||
cmListFileContext const& lfc = this->GetStartingContext();
|
cmListFileContext closingContext =
|
||||||
cmListFileContext closingContext =
|
cmListFileContext::FromListFileFunction(lff, lfc.FilePath);
|
||||||
cmListFileContext::FromListFileFunction(lff, lfc.FilePath);
|
if (this->EndCommandSupportsArguments() &&
|
||||||
|
!this->ArgumentsMatch(lff, mf)) {
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
e << "A logical block opening on the line\n"
|
e << "A logical block opening on the line\n"
|
||||||
@@ -37,6 +38,15 @@ bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
|
|||||||
<< "with mis-matching arguments.";
|
<< "with mis-matching arguments.";
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
|
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);
|
return this->Replay(std::move(this->Functions), status);
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ private:
|
|||||||
virtual cm::string_view StartCommandName() const = 0;
|
virtual cm::string_view StartCommandName() const = 0;
|
||||||
virtual cm::string_view EndCommandName() const = 0;
|
virtual cm::string_view EndCommandName() const = 0;
|
||||||
|
|
||||||
|
virtual bool EndCommandSupportsArguments() const { return true; }
|
||||||
|
|
||||||
virtual bool ArgumentsMatch(cmListFileFunction const& lff,
|
virtual bool ArgumentsMatch(cmListFileFunction const& lff,
|
||||||
cmMakefile& mf) const = 0;
|
cmMakefile& mf) const = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user