merge(3p/absl): subtree merge of Abseil up to e19260f
... notably, this includes Abseil's own StatusOr type, which conflicted with our implementation (that was taken from TensorFlow). Change-Id: Ie7d6764b64055caaeb8dc7b6b9d066291e6b538f
This commit is contained in:
parent
cc27324d02
commit
082c006c04
854 changed files with 11260 additions and 5296 deletions
17
third_party/abseil_cpp/absl/flags/parse.cc
vendored
17
third_party/abseil_cpp/absl/flags/parse.cc
vendored
|
|
@ -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));
|
||||
|
|
@ -729,12 +739,13 @@ std::vector<char*> ParseCommandLineImpl(int argc, char* argv[],
|
|||
}
|
||||
|
||||
// 100. Set the located flag to a new new value, unless it is retired.
|
||||
// Setting retired flag fails, but we ignoring it here.
|
||||
if (flag->IsRetired()) continue;
|
||||
|
||||
// Setting retired flag fails, but we ignoring it here while also reporting
|
||||
// access to retired flag.
|
||||
std::string error;
|
||||
if (!flags_internal::PrivateHandleAccessor::ParseFrom(
|
||||
*flag, value, SET_FLAGS_VALUE, kCommandLine, error)) {
|
||||
if (flag->IsRetired()) continue;
|
||||
|
||||
flags_internal::ReportUsageError(error, true);
|
||||
success = false;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue