From c268d04e35ad507a89550b0de036a7b4999f77c1 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 4 Mar 2020 01:23:01 +0300 Subject: [PATCH 1/2] Remove unnecessary includes of boost/bind.hpp, replace standard function wrappers. boost/bind.hpp generates deprecation warnings about global placeholder argument keywords. Removes the unnecessary includes of it. Also, this commit replaces standard function object wrappers, which were removed from C++20, with boost::bind. --- example/options_heirarchy.cpp | 6 ++++-- test/test_convert.cpp | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/options_heirarchy.cpp b/example/options_heirarchy.cpp index c913b149e1..1a62ce7bd7 100644 --- a/example/options_heirarchy.cpp +++ b/example/options_heirarchy.cpp @@ -21,12 +21,14 @@ // #include -namespace po = boost::program_options; #include #include #include #include #include +#include + +namespace po = boost::program_options; const std::string version("1.0"); @@ -221,7 +223,7 @@ class OptionsHeirarchy // The next two lines are the crazy syntax to use EnvironmentMapper as // the lookup function for env->config name conversions boost::function1( - std::bind1st(std::mem_fun(&OptionsHeirarchy::EnvironmentMapper), this))), + boost::bind(&OptionsHeirarchy::EnvironmentMapper, this))), results); notify(results); } diff --git a/test/test_convert.cpp b/test/test_convert.cpp index a541e0264b..106f674040 100644 --- a/test/test_convert.cpp +++ b/test/test_convert.cpp @@ -13,8 +13,6 @@ #include #include #include -#include -#include #include #include From 69699b280c5f255c7759380c3ae7bc074d33d9c5 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 4 Mar 2020 01:27:15 +0300 Subject: [PATCH 2/2] Trim trailing spaces. --- example/config_file_types.cpp | 6 +- example/custom_syntax.cpp | 10 +- example/first.cpp | 6 +- example/multiple_sources.cpp | 34 +++--- example/option_groups.cpp | 12 +- example/options_heirarchy.cpp | 40 +++--- example/real.cpp | 18 +-- example/regex.cpp | 22 ++-- example/response_file.cpp | 10 +- src/cmdline.cpp | 132 ++++++++++---------- src/config_file.cpp | 14 +-- src/convert.cpp | 44 +++---- src/options_description.cpp | 154 +++++++++++------------ src/parsers.cpp | 54 ++++---- src/positional_options.cpp | 6 +- src/split.cpp | 28 ++--- src/value_semantic.cpp | 50 ++++---- src/winmain.cpp | 22 ++-- test/cmdline_test.cpp | 38 +++--- test/exception_test.cpp | 40 +++--- test/exception_txt_test.cpp | 196 +++++++++++++++--------------- test/options_description_test.cpp | 12 +- test/parsers_test.cpp | 16 +-- test/positional_options_test.cpp | 2 +- test/required_test.cpp | 22 ++-- test/split_test.cpp | 46 +++---- test/test_convert.cpp | 42 +++---- test/unicode_test.cpp | 16 +-- test/unrecognized_test.cpp | 14 +-- test/variable_map_test.cpp | 20 +-- test/winmain.cpp | 4 +- 31 files changed, 565 insertions(+), 565 deletions(-) diff --git a/example/config_file_types.cpp b/example/config_file_types.cpp index e466e94a1c..121b7151fe 100644 --- a/example/config_file_types.cpp +++ b/example/config_file_types.cpp @@ -38,7 +38,7 @@ stringstream make_file() ss << "word = word\n"; ss << "phrase = this is a phrase\n"; ss << "quoted = \"quotes are in result\"\n"; - + ss << "\n[ints]\n"; ss << "positive = 41\n"; ss << "negative = -42\n"; @@ -71,7 +71,7 @@ stringstream make_file() ss << "onoff_true = on\n"; ss << "onoff_false = off\n"; ss << "present_equal_true = \n"; - //FAILS: Must be an = + //FAILS: Must be an = //ss << "present_no_equal_true\n"; ss.seekp(ios_base::beg); @@ -236,7 +236,7 @@ int main(int ac, char* av[]) auto opts = set_options(); po::variables_map vars; auto unregistered = parse_file(file, opts, vars); - check_results(vars, unregistered); + check_results(vars, unregistered); return 0; } diff --git a/example/custom_syntax.cpp b/example/custom_syntax.cpp index 829087d9d9..7c603c2469 100644 --- a/example/custom_syntax.cpp +++ b/example/custom_syntax.cpp @@ -5,8 +5,8 @@ /** This example shows how to support custom options syntax. - It's possible to install 'custom_parser'. It will be invoked on all command - line tokens and can return name/value pair, or nothing. If it returns + It's possible to install 'custom_parser'. It will be invoked on all command + line tokens and can return name/value pair, or nothing. If it returns nothing, usual processing will be done. */ @@ -20,7 +20,7 @@ using namespace boost::program_options; #include using namespace std; -/* This custom option parse function recognize gcc-style +/* This custom option parse function recognize gcc-style option "-fbar" / "-fno-bar". */ pair reg_foo(const string& s) @@ -32,7 +32,7 @@ pair reg_foo(const string& s) return make_pair(s.substr(2), string("true")); } else { return make_pair(string(), string()); - } + } } int main(int ac, char* av[]) @@ -53,7 +53,7 @@ int main(int ac, char* av[]) cout << "\nIn addition -ffoo and -fno-foo syntax are recognized.\n"; } if (vm.count("foo")) { - cout << "foo value with the value of " + cout << "foo value with the value of " << vm["foo"].as() << "\n"; } } diff --git a/example/first.cpp b/example/first.cpp index 8763fec9cd..b44950684d 100644 --- a/example/first.cpp +++ b/example/first.cpp @@ -23,9 +23,9 @@ int main(int ac, char* av[]) ("compression", po::value(), "set compression level") ; - po::variables_map vm; + po::variables_map vm; po::store(po::parse_command_line(ac, av, desc), vm); - po::notify(vm); + po::notify(vm); if (vm.count("help")) { cout << desc << "\n"; @@ -33,7 +33,7 @@ int main(int ac, char* av[]) } if (vm.count("compression")) { - cout << "Compression level was set to " + cout << "Compression level was set to " << vm["compression"].as() << ".\n"; } else { cout << "Compression level was not set.\n"; diff --git a/example/multiple_sources.cpp b/example/multiple_sources.cpp index 22c8235bce..e7a1feaf28 100644 --- a/example/multiple_sources.cpp +++ b/example/multiple_sources.cpp @@ -18,7 +18,7 @@ using namespace std; template ostream& operator<<(ostream& os, const vector& v) { - copy(v.begin(), v.end(), ostream_iterator(os, " ")); + copy(v.begin(), v.end(), ostream_iterator(os, " ")); return os; } @@ -28,8 +28,8 @@ int main(int ac, char* av[]) try { int opt; string config_file; - - // Declare a group of options that will be + + // Declare a group of options that will be // allowed only on command line po::options_description generic("Generic options"); generic.add_options() @@ -38,16 +38,16 @@ int main(int ac, char* av[]) ("config,c", po::value(&config_file)->default_value("multiple_sources.cfg"), "name of a file of a configuration.") ; - - // Declare a group of options that will be + + // Declare a group of options that will be // allowed both on command line and in // config file po::options_description config("Configuration"); config.add_options() - ("optimization", po::value(&opt)->default_value(10), + ("optimization", po::value(&opt)->default_value(10), "optimization level") - ("include-path,I", - po::value< vector >()->composing(), + ("include-path,I", + po::value< vector >()->composing(), "include path") ; @@ -58,7 +58,7 @@ int main(int ac, char* av[]) ("input-file", po::value< vector >(), "input file") ; - + po::options_description cmdline_options; cmdline_options.add(generic).add(config).add(hidden); @@ -67,15 +67,15 @@ int main(int ac, char* av[]) po::options_description visible("Allowed options"); visible.add(generic).add(config); - + po::positional_options_description p; p.add("input-file", -1); - + po::variables_map vm; store(po::command_line_parser(ac, av). options(cmdline_options).positional(p).run(), vm); notify(vm); - + ifstream ifs(config_file.c_str()); if (!ifs) { @@ -87,7 +87,7 @@ int main(int ac, char* av[]) store(parse_config_file(ifs, config_file_options), vm); notify(vm); } - + if (vm.count("help")) { cout << visible << "\n"; return 0; @@ -100,22 +100,22 @@ int main(int ac, char* av[]) if (vm.count("include-path")) { - cout << "Include paths are: " + cout << "Include paths are: " << vm["include-path"].as< vector >() << "\n"; } if (vm.count("input-file")) { - cout << "Input files are: " + cout << "Input files are: " << vm["input-file"].as< vector >() << "\n"; } - cout << "Optimization level is " << opt << "\n"; + cout << "Optimization level is " << opt << "\n"; } catch(exception& e) { cout << e.what() << "\n"; return 1; - } + } return 0; } diff --git a/example/option_groups.cpp b/example/option_groups.cpp index 63e1fca48b..bbae4e8ab4 100644 --- a/example/option_groups.cpp +++ b/example/option_groups.cpp @@ -53,7 +53,7 @@ int main(int ac, char* av[]) backend.add_options() ("num-threads", value(), "the initial number of threads") ; - + // Declare an options description instance which will include // all the options options_description all("Allowed options"); @@ -63,12 +63,12 @@ int main(int ac, char* av[]) // to the user options_description visible("Allowed options"); visible.add(general).add(gui); - + variables_map vm; store(parse_command_line(ac, av, all), vm); - if (vm.count("help")) + if (vm.count("help")) { cout << visible; return 0; @@ -80,7 +80,7 @@ int main(int ac, char* av[]) } else if (s == "backend") { cout << backend; } else { - cout << "Unknown module '" + cout << "Unknown module '" << s << "' in the --help-module option\n"; return 1; } @@ -88,8 +88,8 @@ int main(int ac, char* av[]) } if (vm.count("num-threads")) { cout << "The 'num-threads' options was set to " - << vm["num-threads"].as() << "\n"; - } + << vm["num-threads"].as() << "\n"; + } } catch(std::exception& e) { cout << e.what() << "\n"; diff --git a/example/options_heirarchy.cpp b/example/options_heirarchy.cpp index 1a62ce7bd7..686cc960f9 100644 --- a/example/options_heirarchy.cpp +++ b/example/options_heirarchy.cpp @@ -3,9 +3,9 @@ // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) -// +// // This is an example of a program that uses multiple facets of the boost -// program_options library. It will go through different types of config +// program_options library. It will go through different types of config // options in a heirarchal manner: // 1. Default options are set. // 2. Command line options are set (they override defaults). @@ -16,7 +16,7 @@ // other steps). // 5. Default config file (default.cfg) is read, if present (it overrides // defaults but not options from the other steps). -// +// // See the bottom of this file for full usage examples // @@ -217,7 +217,7 @@ class OptionsHeirarchy std::cout << "Program Options Example " << version << std::endl; throw OptionsExitsProgram(); } - void ParseEnvironment() + void ParseEnvironment() { store(po::parse_environment(common_options, // The next two lines are the crazy syntax to use EnvironmentMapper as @@ -333,16 +333,16 @@ int main(int ac, char* av[]) return 0; } -/* +/* Full Usage Examples =================== -These were run on windows, so some results may show that environment, but +These were run on windows, so some results may show that environment, but results should be similar on POSIX platforms. Help ---- -To see the help screen, with the available options just pass the --help (or -h) +To see the help screen, with the available options just pass the --help (or -h) parameter. The program will then exit. > example.exe --help @@ -367,10 +367,10 @@ Version is similar to help (--version or -v). Basics ------ -Running without any options will get the default values (path is set from the +Running without any options will get the default values (path is set from the environment): - > example.exe + > example.exe First 75 chars of the system path: C:\Program Files (x86)\MSBuild\14.0\bin;C:\Perl\site\bin;C:\Perl\bin;C:\Pro Verbosity: INFO @@ -436,8 +436,8 @@ Or you can put the option immediately after it: Network Address: 127.0.0.1 Network Port: 12345 -The include path (--include-path or -I) option allows for multiple paths to be -specified (both on the command line and in config files) and combined into a +The include path (--include-path or -I) option allows for multiple paths to be +specified (both on the command line and in config files) and combined into a vector for use by the program. > example.exe --include-path=a/b/c --include-path d/e/f -I g/h/i -Ij/k/l @@ -455,7 +455,7 @@ vector for use by the program. Network Address: 127.0.0.1 Network Port: 12345 -There are also the option of flags that do not take parameters and just set a +There are also the option of flags that do not take parameters and just set a boolean value to true. In this case, running the gui also causes default values for the gui to be output to the screen. @@ -491,7 +491,7 @@ one specifies the "master" file the others are additional files. Environment Variables --------------------- -In addition to the PATH environment variable, it also knows how to read the +In addition to the PATH environment variable, it also knows how to read the EXAMPLE_VERBOSE environmental variable and use that to set the verbosity option/ @@ -509,7 +509,7 @@ option/ However, if the --verboseity flag is also set, it will override the env variable. This illustrates an important example, the way program_options works, -is that a parser will not override a value that has previously been set by +is that a parser will not override a value that has previously been set by another parser. Thus the env parser doesn't override the command line parser. (We will see this again in config files.) Default values are seperate from this heirarcy, they only apply if no parser has set the value and it is being read. @@ -527,7 +527,7 @@ heirarcy, they only apply if no parser has set the value and it is being read. Network Port: 12345 (You can unset an environmental variable with an empty set command) - + > set EXAMPLE_VERBOSE= > example.exe First 75 chars of the system path: @@ -544,7 +544,7 @@ heirarcy, they only apply if no parser has set the value and it is being read. Config Files ------------ Config files generally follow the [INI file format] -(https://en.wikipedia.org/wiki/INI_file) with a few exceptions. +(https://en.wikipedia.org/wiki/INI_file) with a few exceptions. Values can be simply added tp options with an equal sign. Here are two include paths added via the default config file (default.cfg), you can have optional @@ -661,7 +661,7 @@ Results in a combination of all three config files: Network Address: 5.6.7.8 Network Port: 3000 -Incidently the boolean run-gui option could have been set a number of ways +Incidently the boolean run-gui option could have been set a number of ways that all result in the C++ boolean value of true: run-gui=true @@ -672,10 +672,10 @@ that all result in the C++ boolean value of true: Since run-gui is an option that was set with the bool_switch type, which forces its use on the command line without a parameter (i.e. --run-gui instead -of --run-gui=true) it can't be given a "false" option, bool_switch values can +of --run-gui=true) it can't be given a "false" option, bool_switch values can only be turned true. If instead we had a value ("my-switch", po::value()) -that could be set at the command line --my-switch=true or --my-switch=false, or -any of the other types of boolean keywords true: true, on, 1, yes; +that could be set at the command line --my-switch=true or --my-switch=false, or +any of the other types of boolean keywords true: true, on, 1, yes; false: false, off, 0, no. In a config file this could look like: my-switch=true diff --git a/example/real.cpp b/example/real.cpp index 1c5d132211..6a2067e8a3 100644 --- a/example/real.cpp +++ b/example/real.cpp @@ -14,12 +14,12 @@ using namespace std; /* Function used to check that 'opt1' and 'opt2' are not specified at the same time. */ -void conflicting_options(const variables_map& vm, +void conflicting_options(const variables_map& vm, const char* opt1, const char* opt2) { - if (vm.count(opt1) && !vm[opt1].defaulted() + if (vm.count(opt1) && !vm[opt1].defaulted() && vm.count(opt2) && !vm[opt2].defaulted()) - throw logic_error(string("Conflicting options '") + throw logic_error(string("Conflicting options '") + opt1 + "' and '" + opt2 + "'."); } @@ -30,7 +30,7 @@ void option_dependency(const variables_map& vm, { if (vm.count(for_what) && !vm[for_what].defaulted()) if (vm.count(required_option) == 0 || vm[required_option].defaulted()) - throw logic_error(string("Option '") + for_what + throw logic_error(string("Option '") + for_what + "' requires option '" + required_option + "'."); } @@ -56,20 +56,20 @@ int main(int argc, char* argv[]) ("macrofile,m", value(¯ofile), "full pathname of macro.h") ("two,t", bool_switch(&t_given), "preprocess both header and body") ("body,b", bool_switch(&b_given), "preprocess body in the header context") - ("libmakfile,l", value(&libmakfile), + ("libmakfile,l", value(&libmakfile), "write include makefile for library") - ("mainpackage,p", value(&mainpackage), + ("mainpackage,p", value(&mainpackage), "output dependency information") - ("depends,d", value(&depends), + ("depends,d", value(&depends), "write dependencies to ") ("sources,s", value(&sources), "write source package list to ") ("root,r", value(&root), "treat as project root directory") ; - + variables_map vm; store(parse_command_line(argc, argv, desc), vm); - if (vm.count("help")) { + if (vm.count("help")) { cout << desc << "\n"; return 0; } diff --git a/example/regex.cpp b/example/regex.cpp index df98f77a0f..29502cef43 100644 --- a/example/regex.cpp +++ b/example/regex.cpp @@ -9,10 +9,10 @@ // A new class 'magic_number' is defined and the 'validate' method is overloaded // to validate the values of that class using Boost.Regex. // To test, run -// +// // regex -m 123-456 // regex -m 123-4567 -// +// // The first invocation should output: // // The magic is "456" @@ -36,12 +36,12 @@ struct magic_number { }; /* Overload the 'validate' function for the user-defined class. - It makes sure that value is of form XXX-XXX + It makes sure that value is of form XXX-XXX where X are digits and converts the second group to an integer. This has no practical meaning, meant only to show how regex can be used to validate values. */ -void validate(boost::any& v, +void validate(boost::any& v, const std::vector& values, magic_number*, int) { @@ -55,14 +55,14 @@ void validate(boost::any& v, // one string, it's an error, and exception will be thrown. const string& s = validators::get_single_string(values); - // Do regex match and convert the interesting part to + // Do regex match and convert the interesting part to // int. smatch match; if (regex_match(s, match, r)) { v = any(magic_number(lexical_cast(match[1]))); } else { throw validation_error(validation_error::invalid_option_value); - } + } } @@ -73,13 +73,13 @@ int main(int ac, char* av[]) desc.add_options() ("help", "produce a help screen") ("version,v", "print the version number") - ("magic,m", value(), + ("magic,m", value(), "magic value (in NNN-NNN format)") ; - + variables_map vm; store(parse_command_line(ac, av, desc), vm); - + if (vm.count("help")) { cout << "Usage: regex [options]\n"; cout << desc; @@ -90,12 +90,12 @@ int main(int ac, char* av[]) return 0; } if (vm.count("magic")) { - cout << "The magic is \"" + cout << "The magic is \"" << vm["magic"].as().n << "\"\n"; } } catch(std::exception& e) { cout << e.what() << "\n"; - } + } } diff --git a/example/response_file.cpp b/example/response_file.cpp index ce80f76a9e..e8831c7b68 100644 --- a/example/response_file.cpp +++ b/example/response_file.cpp @@ -44,10 +44,10 @@ int main(int ac, char* av[]) options_description desc("Allowed options"); desc.add_options() ("help", "produce a help message") - ("include-path,I", value< vector >()->composing(), + ("include-path,I", value< vector >()->composing(), "include path") ("magic", value(), "magic value") - ("response-file", value(), + ("response-file", value(), "can be specified with '@name', too") ; @@ -56,7 +56,7 @@ int main(int ac, char* av[]) .extra_parser(at_option_parser).run(), vm); if (vm.count("help")) { - cout << desc; + cout << desc; } if (vm.count("response-file")) { // Load the file and tokenize it @@ -75,7 +75,7 @@ int main(int ac, char* av[]) vector args; copy(tok.begin(), tok.end(), back_inserter(args)); // Parse the file and store the options - store(command_line_parser(args).options(desc).run(), vm); + store(command_line_parser(args).options(desc).run(), vm); } if (vm.count("include-path")) { @@ -83,7 +83,7 @@ int main(int ac, char* av[]) cout << "Include paths: "; copy(s.begin(), s.end(), ostream_iterator(cout, " ")); cout << "\n"; - } + } if (vm.count("magic")) { cout << "Magic value: " << vm["magic"].as() << "\n"; } diff --git a/src/cmdline.cpp b/src/cmdline.cpp index 8f4ae64e4a..e69db994da 100644 --- a/src/cmdline.cpp +++ b/src/cmdline.cpp @@ -37,9 +37,9 @@ namespace boost { namespace program_options { using namespace std; using namespace boost::program_options::command_line_style; - - - string + + + string invalid_syntax::get_template(kind_t kind) { // Initially, store the message in 'const char*' variable, @@ -107,37 +107,37 @@ namespace boost { namespace program_options { namespace detail { void cmdline::init(const vector& args) { - this->m_args = args; + this->m_args = args; m_style = command_line_style::default_style; m_desc = 0; m_positional = 0; m_allow_unregistered = false; } - void + void cmdline::style(int style) { - if (style == 0) - style = default_style; + if (style == 0) + style = default_style; check_style(style); this->m_style = style_t(style); } - - void + + void cmdline::allow_unregistered() { this->m_allow_unregistered = true; } - void + void cmdline::check_style(int style) const { - bool allow_some_long = + bool allow_some_long = (style & allow_long) || (style & allow_long_disguise); const char* error = 0; - if (allow_some_long && + if (allow_some_long && !(style & long_allow_adjacent) && !(style & long_allow_next)) error = "boost::program_options misconfiguration: " "choose one or other of 'command_line_style::long_allow_next' " @@ -166,20 +166,20 @@ namespace boost { namespace program_options { namespace detail { // Need to check that if guessing and long disguise are enabled // -f will mean the same as -foo } - - bool + + bool cmdline::is_style_active(style_t style) const { return ((m_style & style) ? true : false); - } + } - void + void cmdline::set_options_description(const options_description& desc) { m_desc = &desc; } - void + void cmdline::set_positional_options( const positional_options_description& positional) { @@ -221,7 +221,7 @@ namespace boost { namespace program_options { namespace detail { // So, after vector is returned, we validate them. assert(m_desc); - vector style_parsers; + vector style_parsers; if (m_style_parser) style_parsers.push_back(m_style_parser); @@ -270,15 +270,15 @@ namespace boost { namespace program_options { namespace detail { // if appropriate. finish_option(next.back(), args, style_parsers); for (unsigned j = 0; j < next.size(); ++j) - result.push_back(next[j]); + result.push_back(next[j]); } - + if (args.size() != current_size) { ok = true; - break; - } + break; + } } - + if (!ok) { option opt; opt.value.push_back(args[0]); @@ -303,11 +303,11 @@ namespace boost { namespace program_options { namespace detail { const option_description* xd; try { - xd = m_desc->find_nothrow(opt.string_key, + xd = m_desc->find_nothrow(opt.string_key, is_style_active(allow_guessing), is_style_active(long_case_insensitive), is_style_active(short_case_insensitive)); - } + } catch(error_with_option_name& e) { // add context and rethrow @@ -343,7 +343,7 @@ namespace boost { namespace program_options { namespace detail { } assert(opt2.value.size() == 1); - + opt.value.push_back(opt2.value[0]); assert(opt2.original_tokens.size() == 1); @@ -354,7 +354,7 @@ namespace boost { namespace program_options { namespace detail { } } result.swap(result2); - + // Assign position keys to positional options. int position_key = 0; @@ -378,7 +378,7 @@ namespace boost { namespace program_options { namespace detail { } } } - + // set case sensitive flag for (unsigned i = 0; i < result.size(); ++i) { if (result[i].string_key.size() > 2 || @@ -401,11 +401,11 @@ namespace boost { namespace program_options { namespace detail { cmdline::finish_option(option& opt, vector& other_tokens, const vector& style_parsers) - { + { if (opt.string_key.empty()) return; - // + // // Be defensive: // will have no original token if option created by handle_additional_parser() std::string original_token_for_exceptions = opt.string_key; @@ -415,7 +415,7 @@ namespace boost { namespace program_options { namespace detail { try { // First check that the option is valid, and get its description. - const option_description* xd = m_desc->find_nothrow(opt.string_key, + const option_description* xd = m_desc->find_nothrow(opt.string_key, is_style_active(allow_guessing), is_style_active(long_case_insensitive), is_style_active(short_case_insensitive)); @@ -427,7 +427,7 @@ namespace boost { namespace program_options { namespace detail { return; } else { boost::throw_exception(unknown_option()); - } + } } const option_description& d = *xd; @@ -441,20 +441,20 @@ namespace boost { namespace program_options { namespace detail { // left unconsumed. unsigned min_tokens = d.semantic()->min_tokens(); unsigned max_tokens = d.semantic()->max_tokens(); - + unsigned present_tokens = static_cast(opt.value.size() + other_tokens.size()); - + if (present_tokens >= min_tokens) { - if (!opt.value.empty() && max_tokens == 0) + if (!opt.value.empty() && max_tokens == 0) { boost::throw_exception( invalid_command_line_syntax(invalid_command_line_syntax::extra_parameter)); } - + // Grab min_tokens values from other_tokens, but only if those tokens // are not recognized as options themselves. - if (opt.value.size() <= min_tokens) + if (opt.value.size() <= min_tokens) { min_tokens -= static_cast(opt.value.size()); } @@ -464,25 +464,25 @@ namespace boost { namespace program_options { namespace detail { } // Everything's OK, move the values to the result. - for(;!other_tokens.empty() && min_tokens--; ) + for(;!other_tokens.empty() && min_tokens--; ) { // check if extra parameter looks like a known option - // we use style parsers to check if it is syntactically an option, + // we use style parsers to check if it is syntactically an option, // additionally we check if an option_description exists - vector