WIP: eliminate dependency on boost::program_options#12744
WIP: eliminate dependency on boost::program_options#12744eklitzke wants to merge 2 commits intobitcoin:masterfrom
Conversation
2d68062 to
6ae9530
Compare
This change split out from bitcoin#12689
6ae9530 to
78bc52b
Compare
|
Really nice! Let's get rid of Boost Strong concept ACK |
|
Another concept ACK Some nits:
|
|
I saw the use of |
|
One comment: config_file_iterator is able to parse sections: http://www.boost.org/doc/libs/1_66_0/doc/html/program_options/overview.html#id-1.3.31.5.10.2 . That feature isn't currently used in bitcoin but is required for #11862. How much work would it be to enhance this PR to support INI-like config sections? courtesy ping @ajtowns |
| setOptions.insert("*"); | ||
| std::string line; | ||
| while (std::getline(config_file, line)) { | ||
| size_t eqpos = line.find('='); |
There was a problem hiding this comment.
Current syntax seems to be described here:
http://www.boost.org/doc/libs/1_66_0/doc/html/program_options/overview.html#id-1.3.31.5.10.2
I wonder if for backwards compatibility or convenience the new implementation should be extended to support # comments.
|
@jnewbery Seems pretty easy to add sections, INI format is literally just: The option parser needs to be updated to be section-aware anyway, as right now it stuffs everything in a global namespace. I looked at how Python checks their INI parser (configparser module) and this needs to be updated to handle comments and quoting. I will add a test case. Basically it should be able to parse this file correctly: https://github.com/python/cpython/blob/master/Lib/test/cfgparser.2 |
Concept ACK - though as @jnewbery already mentions, I'd prioritize #11862 first, because adding a per-network configuration mechanism is something we've wanted for a long time. Removing boost dependencies is what we want on the long run too, but shouldn't get in the way of providing functionality to users. |
|
Shouldn't you remove |
|
very nice! concept ACK. Will review in detail. |
| if (strValue.empty()) | ||
| return true; | ||
| return (atoi(strValue) != 0); | ||
| return val != "0"; |
There was a problem hiding this comment.
Looks like this will miss " 0" (whitespace), and "-0" (negative zero), which could happen as a typo on another argument.
|
Needs rebase |
right - needs rebase now that per-network configuration sections have been introduced. |
|
Using dependencies is strictly better than re-inventing them, but all things considered (minimal size of the code, and future modification code needed for rwconf), I guess this case looks not totally unreasonable... :x |
|
Needs rebase. |
|
Concept ACK |
|
Closing for now. Let me know when you start working on this again, so I can reopen. Also, this is up for grabs and can be rebased by any other contributor. |
f447a0a Remove program options from build system (Chun Kuan Lee) 11588c6 Replace boost program_options (Chun Kuan Lee) Pull request description: Concept from #12744, but without parsing negated options. Tree-SHA512: 7f418744bb8934e313d77a5f162633746ef5d043de802b9c9cd9f7c1842e7e566eb5f171cd9e2cc13317281b2449c6fbd553fa4f09b837e6af2f5d2b2aabdca2
f447a0a Remove program options from build system (Chun Kuan Lee) 11588c6 Replace boost program_options (Chun Kuan Lee) Pull request description: Concept from bitcoin#12744, but without parsing negated options. Tree-SHA512: 7f418744bb8934e313d77a5f162633746ef5d043de802b9c9cd9f7c1842e7e566eb5f171cd9e2cc13317281b2449c6fbd553fa4f09b837e6af2f5d2b2aabdca2
f447a0a Remove program options from build system (Chun Kuan Lee) 11588c6 Replace boost program_options (Chun Kuan Lee) Pull request description: Concept from bitcoin#12744, but without parsing negated options. Tree-SHA512: 7f418744bb8934e313d77a5f162633746ef5d043de802b9c9cd9f7c1842e7e566eb5f171cd9e2cc13317281b2449c6fbd553fa4f09b837e6af2f5d2b2aabdca2
This completely eliminates our dependency on boost::program_options, including the linking dependency:
The catch is that this branch has two commits: my change from #12713, and then another commit that actually removes boost::program_options (see the second for the interesting part of this change). The only thing holding up that PR is disagreement about what to do about an obscure never-meant-to-be-supported edge case in the old option parser. Hopefully everyone's universal dislike of Boost is sufficient to achieve consensus on that issue.