Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.ProgramOptions issues porting from 1.56 to 1.64
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2017-07-26 14:53:53


On Tue, Jul 25, 2017 at 6:24 PM, Dominique Devienne <ddevienne_at_[hidden]>
wrote:

> I'm trying to understand what's going on;
>> obviously there's some kind of semantic change with optional argument to
>> switches.
>>
>> Could anyone shed some light on this please? I'm not sure how to proceed
>> now. TIA, -DD
>>
>
> OK, maybe with a small stand-alone program, I'll have more chances of
> getting help.
> ...
> Is this a regression? Given [2] I'd say yes, but given that
> test_implicit_value() [3] does test something similar
> to what I'm doing, I'm a bit baffled by my little example not working
> properly. What am I missing? Thanks, --DD
>
> [1] https://github.com/boostorg/program_options/commit/
> ed72cc2f92d0e48d0573614bb8d180325bff9866
> [2] https://github.com/boostorg/program_options/commit/
> 7729850bb7eb25b42552b25eff41f141dfa3729f
> [3] https://github.com/boostorg/program_options/commit/
> ed72cc2f92d0e48d0573614bb8d180325bff9866
>

Rah, the test code in 1.64 reads like
    test_case test_cases1[] = {
        {"--foo bar", s_success, "foo: positional:bar"},
        {"--foo=bar foobar", s_success, "foo:bar positional:foobar"},
        {0, 0, 0}
    };

while the one on the develop branch behaves as 1.56 and the way I need!
(see below)
So it means Vladimir hasn't merged these commits into the release, despite
predating it :(
Bummer bummer bummer... Specific reasons this wasn't done? Will they be in
1.65? --DD

test_case test_cases1[] = {
// 'bar' does not even look like option, so is consumed
{"--foo bar", s_success, "foo:bar"},

// '--bar' looks like option, and such option exists, so we don't consume
this token
{"--foo --bar", s_success, "foo: bar:"},

// '--biz' looks like option, but does not match any existing one.
// Presently this results in parse error, since
// (1) in cmdline.cpp:finish_option, we only consume following tokens if
they are
// requires
// (2) in cmdline.cpp:run, we let options consume following positional
options
// For --biz, an exception is thrown between 1 and 2.
// We might want to fix that in future.
{"--foo --biz", s_unknown_option, ""},
{0, 0, 0}
};



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net