From 5c5c55b83cc7d542890a47aeee6530a8ee6d10f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Tue, 19 Apr 2022 13:59:08 -0300 Subject: [PATCH] Fix unused argument warnings. Solution suggested by skrobinson. This way, GCC and clang-tidy don't generate warnings. Fixes: https://github.com/p-ranav/argparse/issues/167 --- include/argparse/argparse.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/argparse/argparse.hpp b/include/argparse/argparse.hpp index fb4f25a5..36a30cce 100644 --- a/include/argparse/argparse.hpp +++ b/include/argparse/argparse.hpp @@ -148,7 +148,7 @@ constexpr bool standard_integer = template constexpr decltype(auto) apply_plus_one_impl(F &&f, Tuple &&t, Extra &&x, - std::index_sequence unused) { + std::index_sequence /*unused*/) { return std::invoke(std::forward(f), std::get(std::forward(t))..., std::forward(x)); } @@ -855,7 +855,7 @@ class ArgumentParser { : m_program_name(std::move(program_name)), m_version(std::move(version)) { if ((add_args & default_arguments::help) == default_arguments::help) { add_argument("-h", "--help") - .action([&](const auto &unused) { + .action([&](const auto &/*unused*/) { std::cout << help().str(); std::exit(0); }) @@ -866,7 +866,7 @@ class ArgumentParser { } if ((add_args & default_arguments::version) == default_arguments::version) { add_argument("-v", "--version") - .action([&](const auto &unused) { + .action([&](const auto &/*unused*/) { std::cout << m_version << std::endl; std::exit(0); })