Fix GCC14 warnings on template specialization syntax (#4974) (#4975)

This commit is contained in:
Nolan Poe 2024-03-15 19:21:08 -07:00 committed by GitHub
parent e82c9db6da
commit 08c76b1da6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 5 deletions

View File

@ -114,16 +114,33 @@ V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbCall, void(void), m_cb(), en::NONE);
V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbFOnOff, void(bool), m_cb(!hasPrefixFNo(optp)),
en::FONOFF);
V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbOnOff, void(bool), m_cb(!hasPrefixNo(optp)), en::ONOFF);
template <>
V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbVal<int>, void(int), m_cb(std::atoi(argp)), en::VALUE);
template <>
V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbVal<const char*>, void(const char*), m_cb(argp),
en::VALUE);
V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbPartialMatch, void(const char*), m_cb(optp), en::NONE,
true);
V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbPartialMatchVal, void(const char*, const char*),
m_cb(optp, argp), en::VALUE, true);
template <>
class V3OptionParser::Impl::ActionCbVal<int> final : public ActionBase<en::VALUE> {
std::function<void(int)> m_cb;
public:
using CbType = std::function<void(int)>;
explicit ActionCbVal(CbType cb)
: m_cb(std::move(cb)) {}
void exec(const char* optp, const char* argp) override { m_cb(std::atoi(argp)); }
};
template <>
class V3OptionParser::Impl::ActionCbVal<const char*> final : public ActionBase<en::VALUE> {
std::function<void(const char*)> m_cb;
public:
using CbType = std::function<void(const char*)>;
explicit ActionCbVal(CbType cb)
: m_cb(std::move(cb)) {}
void exec(const char* optp, const char* argp) override { m_cb(argp); }
};
#undef V3OPTION_PARSER_DEF_ACT_CB_CLASS
//######################################################################