From 2873f41bd9f3636f53abf9c31a0b7492366c5199 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 28 Jun 2022 16:25:54 -0400 Subject: cmArgumentParser: Require callers to consider unparsed arguments --- Source/cmArgumentParser.h | 8 +++----- Source/cmFileCommand.cxx | 6 ++++-- Source/cmTargetSourcesCommand.cxx | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/cmArgumentParser.h b/Source/cmArgumentParser.h index 93ef6c1..aa6cf75 100644 --- a/Source/cmArgumentParser.h +++ b/Source/cmArgumentParser.h @@ -78,7 +78,7 @@ public: template void Parse(Result& result, Range const& args, - std::vector* unparsedArguments = nullptr, + std::vector* unparsedArguments, std::vector* keywordsMissingValue = nullptr, std::vector* parsedKeywords = nullptr) const { @@ -90,8 +90,7 @@ public: } template - Result Parse(Range const& args, - std::vector* unparsedArguments = nullptr, + Result Parse(Range const& args, std::vector* unparsedArguments, std::vector* keywordsMissingValue = nullptr, std::vector* parsedKeywords = nullptr) const { @@ -118,8 +117,7 @@ public: } template - void Parse(Range const& args, - std::vector* unparsedArguments = nullptr, + void Parse(Range const& args, std::vector* unparsedArguments, std::vector* keywordsMissingValue = nullptr, std::vector* parsedKeywords = nullptr) const { diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 6013bf8..aa3334f 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -172,7 +172,8 @@ bool HandleReadCommand(std::vector const& args, .Bind("LIMIT"_s, &Arguments::Limit) .Bind("HEX"_s, &Arguments::Hex); - Arguments const arguments = parser.Parse(cmMakeRange(args).advance(3)); + Arguments const arguments = parser.Parse(cmMakeRange(args).advance(3), + /*unparsedArguments=*/nullptr); std::string fileName = fileNameArg; if (!cmsys::SystemTools::FileIsFullPath(fileName)) { @@ -1197,7 +1198,8 @@ bool HandleReadElfCommand(std::vector const& args, .Bind("RPATH"_s, &Arguments::RPath) .Bind("RUNPATH"_s, &Arguments::RunPath) .Bind("CAPTURE_ERROR"_s, &Arguments::Error); - Arguments const arguments = parser.Parse(cmMakeRange(args).advance(2)); + Arguments const arguments = parser.Parse(cmMakeRange(args).advance(2), + /*unparsedArguments=*/nullptr); if (!cmSystemTools::FileExists(fileNameArg, true)) { status.SetError(cmStrCat("READ_ELF given FILE \"", fileNameArg, diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx index e4244a6..76b0384 100644 --- a/Source/cmTargetSourcesCommand.cxx +++ b/Source/cmTargetSourcesCommand.cxx @@ -197,7 +197,7 @@ std::vector TargetSourcesImpl::ConvertToAbsoluteContent( bool TargetSourcesImpl::HandleFileSetMode( const std::string& scope, const std::vector& content) { - auto args = FileSetsArgsParser.Parse(content); + auto args = FileSetsArgsParser.Parse(content, /*unparsedArguments=*/nullptr); for (auto& argList : args.FileSets) { argList.emplace(argList.begin(), "FILE_SET"_s); -- cgit v0.12