diff options
author | Brad King <brad.king@kitware.com> | 2022-06-28 20:25:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-07-05 20:35:01 (GMT) |
commit | 2873f41bd9f3636f53abf9c31a0b7492366c5199 (patch) | |
tree | 673696739fc116262eaba782946e610af51b8020 | |
parent | 1ee5a4a548c62e5c382f3497be82aac36a99e485 (diff) | |
download | CMake-2873f41bd9f3636f53abf9c31a0b7492366c5199.zip CMake-2873f41bd9f3636f53abf9c31a0b7492366c5199.tar.gz CMake-2873f41bd9f3636f53abf9c31a0b7492366c5199.tar.bz2 |
cmArgumentParser: Require callers to consider unparsed arguments
-rw-r--r-- | Source/cmArgumentParser.h | 8 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 6 | ||||
-rw-r--r-- | 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 <typename Range> void Parse(Result& result, Range const& args, - std::vector<std::string>* unparsedArguments = nullptr, + std::vector<std::string>* unparsedArguments, std::vector<cm::string_view>* keywordsMissingValue = nullptr, std::vector<cm::string_view>* parsedKeywords = nullptr) const { @@ -90,8 +90,7 @@ public: } template <typename Range> - Result Parse(Range const& args, - std::vector<std::string>* unparsedArguments = nullptr, + Result Parse(Range const& args, std::vector<std::string>* unparsedArguments, std::vector<cm::string_view>* keywordsMissingValue = nullptr, std::vector<cm::string_view>* parsedKeywords = nullptr) const { @@ -118,8 +117,7 @@ public: } template <typename Range> - void Parse(Range const& args, - std::vector<std::string>* unparsedArguments = nullptr, + void Parse(Range const& args, std::vector<std::string>* unparsedArguments, std::vector<cm::string_view>* keywordsMissingValue = nullptr, std::vector<cm::string_view>* 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<std::string> 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<std::string> 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<std::string> TargetSourcesImpl::ConvertToAbsoluteContent( bool TargetSourcesImpl::HandleFileSetMode( const std::string& scope, const std::vector<std::string>& 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); |