Skip to content

Commit

Permalink
command_line/arguments: Added several missing noexcept markings
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonmux committed Aug 19, 2023
1 parent 834ea99 commit 8b22eb8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions impl/command_line/arguments.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@ namespace substrate::commandLine
static std::optional<optionMatch_t> matchOption(tokeniser_t &lexer, const option_t &option,
const std::string_view &argument) noexcept;
static std::optional<optionMatch_t> matchOptionSet(tokeniser_t &lexer, const optionSet_t &option,
const std::string_view &argument);
template<typename set_t> static bool checkMatchValid(const optionsItem_t &option, set_t &optionsVisited);
const std::string_view &argument) noexcept;
template<typename set_t> static bool checkMatchValid(const optionsItem_t &option, set_t &optionsVisited) noexcept;
template<typename set_t> static std::optional<bool> handleResult(arguments_t &arguments, const optionsItem_t &option,
set_t &optionsVisited, const std::string_view &argument, const optionMatch_t &match) noexcept;
static void handleUnrecognised(tokeniser_t &lexer, const std::string_view &argument);
static void handleUnrecognised(tokeniser_t &lexer, const std::string_view &argument) noexcept;

std::optional<bool> arguments_t::parseArgument(tokeniser_t &lexer, const options_t &options,
optionsVisited_t &optionsVisited)
optionsVisited_t &optionsVisited) noexcept
{
// Start by checking we're in a suitable state
const auto &token{lexer.token()};
Expand Down Expand Up @@ -307,7 +307,7 @@ namespace substrate::commandLine
}

static std::optional<optionMatch_t> matchOptionSet(tokeniser_t &lexer, const optionSet_t &option,
const std::string_view &argument)
const std::string_view &argument) noexcept
{
// Check if we're parsing an alternation from a set
const auto match{option.matches(argument)};
Expand All @@ -326,7 +326,7 @@ namespace substrate::commandLine
return choice_t{option.metaName(), argument, std::move(subarguments)};
}

template<typename set_t> static bool checkMatchValid(const optionsItem_t &option, set_t &optionsVisited)
template<typename set_t> static bool checkMatchValid(const optionsItem_t &option, set_t &optionsVisited) noexcept
{
// Look for the option in the set
const auto &count{optionsVisited.find(option)};
Expand Down Expand Up @@ -364,7 +364,7 @@ namespace substrate::commandLine
}, match);
}

static void handleUnrecognised(tokeniser_t &lexer, const std::string_view &argument)
static void handleUnrecognised(tokeniser_t &lexer, const std::string_view &argument) noexcept
{
const auto &token{lexer.next()};
// If the argument stands alone, display it and fast exit
Expand Down
4 changes: 2 additions & 2 deletions substrate/command_line/arguments
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ namespace substrate::commandLine
};

[[nodiscard]] SUBSTRATE_API std::optional<arguments_t>
parseArguments(size_t argCount, const char *const *argList, const options_t &options);
parseArguments(size_t argCount, const char *const *argList, const options_t &options) noexcept;

[[nodiscard]] inline std::optional<arguments_t>
parseArguments(size_t argCount, const char *const *argList, const internal::optionsHolder_t &options)
parseArguments(size_t argCount, const char *const *argList, const internal::optionsHolder_t &options) noexcept
{
const options_t programOptions{options};
return parseArguments(argCount, argList, programOptions);
Expand Down

0 comments on commit 8b22eb8

Please sign in to comment.