Skip to content

Commit 01798ee

Browse files
committed
GCC 4.8 fixes
1 parent a6bfe2d commit 01798ee

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

include/cxxopts.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ const std::string RQUOTE("’");
337337
// destructor This will be ignored under other compilers like LLVM clang.
338338
CXXOPTS_DIAGNOSTIC_PUSH
339339
CXXOPTS_IGNORE_WARNING("-Wnon-virtual-dtor")
340+
341+
// some older versions of GCC warn under this warning
342+
CXXOPTS_IGNORE_WARNING("-Weffc++")
340343
class Value : public std::enable_shared_from_this<Value>
341344
{
342345
public:
@@ -647,6 +650,11 @@ inline OptionNames split_option_names(const std::string &text)
647650
std::string::size_type token_start_pos = 0;
648651
auto length = text.length();
649652

653+
if (length == 0)
654+
{
655+
throw_or_mimic<exceptions::invalid_option_format>(text);
656+
}
657+
650658
while (token_start_pos < length) {
651659
const auto &npos = std::string::npos;
652660
auto next_non_space_pos = text.find_first_not_of(' ', token_start_pos);
@@ -1766,8 +1774,8 @@ class Options
17661774
{
17671775
public:
17681776

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))
17711779
, m_help_string(toLocalString(std::move(help_string)))
17721780
, m_custom_help("[OPTION...]")
17731781
, m_positional_help("positional parameters")

0 commit comments

Comments
 (0)