Commit 01798ee7a09fca55cf770c94a3bea8a670ea4a7d

Authored by Jarryd Beck
1 parent a6bfe2d4

GCC 4.8 fixes

Showing 1 changed file with 10 additions and 2 deletions
include/cxxopts.hpp
... ... @@ -337,6 +337,9 @@ const std::string RQUOTE("’");
337 337 // destructor This will be ignored under other compilers like LLVM clang.
338 338 CXXOPTS_DIAGNOSTIC_PUSH
339 339 CXXOPTS_IGNORE_WARNING("-Wnon-virtual-dtor")
  340 +
  341 +// some older versions of GCC warn under this warning
  342 +CXXOPTS_IGNORE_WARNING("-Weffc++")
340 343 class Value : public std::enable_shared_from_this<Value>
341 344 {
342 345 public:
... ... @@ -647,6 +650,11 @@ inline OptionNames split_option_names(const std::string &amp;text)
647 650 std::string::size_type token_start_pos = 0;
648 651 auto length = text.length();
649 652  
  653 + if (length == 0)
  654 + {
  655 + throw_or_mimic<exceptions::invalid_option_format>(text);
  656 + }
  657 +
650 658 while (token_start_pos < length) {
651 659 const auto &npos = std::string::npos;
652 660 auto next_non_space_pos = text.find_first_not_of(' ', token_start_pos);
... ... @@ -1766,8 +1774,8 @@ class Options
1766 1774 {
1767 1775 public:
1768 1776  
1769   - explicit Options(std::string program, std::string help_string = "")
1770   - : m_program(std::move(program))
  1777 + explicit Options(std::string program_name, std::string help_string = "")
  1778 + : m_program(std::move(program_name))
1771 1779 , m_help_string(toLocalString(std::move(help_string)))
1772 1780 , m_custom_help("[OPTION...]")
1773 1781 , m_positional_help("positional parameters")
... ...