Pedantic fixes
This commit is contained in:
parent
9a454c8e4e
commit
6993db7524
@ -278,6 +278,13 @@ namespace cxxopts
|
|||||||
#endif
|
#endif
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
// GNU GCC with -Weffc++ will issue a warning regarding the upcoming class, we want to silence it:
|
||||||
|
// warning: base class 'class std::enable_shared_from_this<cxxopts::Value>' has accessible non-virtual destructor
|
||||||
|
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
// This will be ignored under other compilers like LLVM clang.
|
||||||
|
#endif
|
||||||
class Value : public std::enable_shared_from_this<Value>
|
class Value : public std::enable_shared_from_this<Value>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -321,7 +328,9 @@ namespace cxxopts
|
|||||||
virtual bool
|
virtual bool
|
||||||
is_boolean() const = 0;
|
is_boolean() const = 0;
|
||||||
};
|
};
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
class OptionException : public std::exception
|
class OptionException : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -805,6 +814,8 @@ namespace cxxopts
|
|||||||
|
|
||||||
~abstract_value() override = default;
|
~abstract_value() override = default;
|
||||||
|
|
||||||
|
abstract_value& operator=(const abstract_value&) = default;
|
||||||
|
|
||||||
abstract_value(const abstract_value& rhs)
|
abstract_value(const abstract_value& rhs)
|
||||||
{
|
{
|
||||||
if (rhs.m_result)
|
if (rhs.m_result)
|
||||||
@ -905,14 +916,14 @@ namespace cxxopts
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<T> m_result;
|
std::shared_ptr<T> m_result{};
|
||||||
T* m_store;
|
T* m_store{};
|
||||||
|
|
||||||
bool m_default = false;
|
bool m_default = false;
|
||||||
bool m_implicit = false;
|
bool m_implicit = false;
|
||||||
|
|
||||||
std::string m_default_value;
|
std::string m_default_value{};
|
||||||
std::string m_implicit_value;
|
std::string m_implicit_value{};
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1036,10 +1047,11 @@ namespace cxxopts
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_short;
|
std::string m_short{};
|
||||||
std::string m_long;
|
std::string m_long{};
|
||||||
String m_desc;
|
String m_desc{};
|
||||||
std::shared_ptr<const Value> m_value;
|
std::shared_ptr<const Value> m_value{}
|
||||||
|
;
|
||||||
int m_count;
|
int m_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1059,9 +1071,9 @@ namespace cxxopts
|
|||||||
|
|
||||||
struct HelpGroupDetails
|
struct HelpGroupDetails
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name{};
|
||||||
std::string description;
|
std::string description{};
|
||||||
std::vector<HelpOptionDetails> options;
|
std::vector<HelpOptionDetails> options{};
|
||||||
};
|
};
|
||||||
|
|
||||||
class OptionValue
|
class OptionValue
|
||||||
@ -1125,7 +1137,7 @@ namespace cxxopts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Value> m_value;
|
std::shared_ptr<Value> m_value{};
|
||||||
size_t m_count = 0;
|
size_t m_count = 0;
|
||||||
bool m_default = false;
|
bool m_default = false;
|
||||||
};
|
};
|
||||||
@ -1249,14 +1261,14 @@ namespace cxxopts
|
|||||||
const std::shared_ptr<
|
const std::shared_ptr<
|
||||||
std::unordered_map<std::string, std::shared_ptr<OptionDetails>>
|
std::unordered_map<std::string, std::shared_ptr<OptionDetails>>
|
||||||
> m_options;
|
> m_options;
|
||||||
std::vector<std::string> m_positional;
|
std::vector<std::string> m_positional{};
|
||||||
std::vector<std::string>::iterator m_next_positional;
|
std::vector<std::string>::iterator m_next_positional;
|
||||||
std::unordered_set<std::string> m_positional_set;
|
std::unordered_set<std::string> m_positional_set{};
|
||||||
std::unordered_map<std::shared_ptr<OptionDetails>, OptionValue> m_results;
|
std::unordered_map<std::shared_ptr<OptionDetails>, OptionValue> m_results{};
|
||||||
|
|
||||||
bool m_allow_unrecognised;
|
bool m_allow_unrecognised;
|
||||||
|
|
||||||
std::vector<KeyValue> m_sequential;
|
std::vector<KeyValue> m_sequential{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Option
|
struct Option
|
||||||
@ -1406,18 +1418,18 @@ namespace cxxopts
|
|||||||
|
|
||||||
std::string m_program;
|
std::string m_program;
|
||||||
String m_help_string;
|
String m_help_string;
|
||||||
std::string m_custom_help;
|
std::string m_custom_help{};
|
||||||
std::string m_positional_help;
|
std::string m_positional_help;
|
||||||
bool m_show_positional;
|
bool m_show_positional;
|
||||||
bool m_allow_unrecognised;
|
bool m_allow_unrecognised;
|
||||||
|
|
||||||
std::shared_ptr<OptionMap> m_options;
|
std::shared_ptr<OptionMap> m_options;
|
||||||
std::vector<std::string> m_positional;
|
std::vector<std::string> m_positional{};
|
||||||
std::vector<std::string>::iterator m_next_positional;
|
std::vector<std::string>::iterator m_next_positional;
|
||||||
std::unordered_set<std::string> m_positional_set;
|
std::unordered_set<std::string> m_positional_set{};
|
||||||
|
|
||||||
//mapping from groups to help options
|
//mapping from groups to help options
|
||||||
std::map<std::string, HelpGroupDetails> m_help;
|
std::map<std::string, HelpGroupDetails> m_help{};
|
||||||
};
|
};
|
||||||
|
|
||||||
class OptionAdder
|
class OptionAdder
|
||||||
@ -1468,11 +1480,7 @@ namespace cxxopts
|
|||||||
|
|
||||||
if (!s.empty())
|
if (!s.empty())
|
||||||
{
|
{
|
||||||
result += "-" + toLocalString(s);
|
result += "-" + toLocalString(s) + ",";
|
||||||
if (!l.empty())
|
|
||||||
{
|
|
||||||
result += ",";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user