summaryrefslogtreecommitdiff
path: root/absl/flags/parse.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/flags/parse.cc')
-rw-r--r--absl/flags/parse.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/absl/flags/parse.cc b/absl/flags/parse.cc
index 4f4bb3d5..dd1a6796 100644
--- a/absl/flags/parse.cc
+++ b/absl/flags/parse.cc
@@ -611,6 +611,11 @@ std::vector<char*> ParseCommandLineImpl(int argc, char* argv[],
OnUndefinedFlag on_undef_flag) {
ABSL_INTERNAL_CHECK(argc > 0, "Missing argv[0]");
+ // Once parsing has started we will not have more flag registrations.
+ // If we did, they would be missing during parsing, which is a problem on
+ // itself.
+ flags_internal::FinalizeRegistry();
+
// This routine does not return anything since we abort on failure.
CheckDefaultValuesParsingRoundtrip();
@@ -708,6 +713,11 @@ std::vector<char*> ParseCommandLineImpl(int argc, char* argv[],
std::tie(flag, is_negative) = LocateFlag(flag_name);
if (flag == nullptr) {
+ // Usage flags are not modeled as Abseil flags. Locate them separately.
+ if (flags_internal::DeduceUsageFlags(flag_name, value)) {
+ continue;
+ }
+
if (on_undef_flag != OnUndefinedFlag::kIgnoreUndefined) {
undefined_flag_names.emplace_back(arg_from_argv,
std::string(flag_name));