Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jarro2783/cxxopts.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarryd Beck <jarro.2783@gmail.com>2022-07-25 00:21:22 +0300
committerJarryd Beck <jarro.2783@gmail.com>2022-07-25 00:21:22 +0300
commit01798ee7a09fca55cf770c94a3bea8a670ea4a7d (patch)
tree29fbf892bbcc1fcef155eedf853906226ac6fd72
parenta6bfe2d457c6b2eb83029ec907777aa48760bd9f (diff)
GCC 4.8 fixes
-rw-r--r--include/cxxopts.hpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp
index 53759ae..284ddf8 100644
--- a/include/cxxopts.hpp
+++ b/include/cxxopts.hpp
@@ -337,6 +337,9 @@ const std::string RQUOTE("’");
// destructor This will be ignored under other compilers like LLVM clang.
CXXOPTS_DIAGNOSTIC_PUSH
CXXOPTS_IGNORE_WARNING("-Wnon-virtual-dtor")
+
+// some older versions of GCC warn under this warning
+CXXOPTS_IGNORE_WARNING("-Weffc++")
class Value : public std::enable_shared_from_this<Value>
{
public:
@@ -647,6 +650,11 @@ inline OptionNames split_option_names(const std::string &text)
std::string::size_type token_start_pos = 0;
auto length = text.length();
+ if (length == 0)
+ {
+ throw_or_mimic<exceptions::invalid_option_format>(text);
+ }
+
while (token_start_pos < length) {
const auto &npos = std::string::npos;
auto next_non_space_pos = text.find_first_not_of(' ', token_start_pos);
@@ -1766,8 +1774,8 @@ class Options
{
public:
- explicit Options(std::string program, std::string help_string = "")
- : m_program(std::move(program))
+ explicit Options(std::string program_name, std::string help_string = "")
+ : m_program(std::move(program_name))
, m_help_string(toLocalString(std::move(help_string)))
, m_custom_help("[OPTION...]")
, m_positional_help("positional parameters")