From 7ba9921866f683f19f1aa43ce07fa542401ebe16 Mon Sep 17 00:00:00 2001 From: "dreamer.dead" Date: Mon, 1 Aug 2016 16:45:49 +0300 Subject: [PATCH] Fix wrong type comparison and outdated OfType() usage. --- src/gflags.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gflags.cc b/src/gflags.cc index 7a8af21..bbd58ec 100644 --- a/src/gflags.cc +++ b/src/gflags.cc @@ -1096,7 +1096,7 @@ uint32 CommandLineFlagParser::ParseNewCommandLineFlags(int* argc, char*** argv, if (value == NULL) { // Boolean options are always assigned a value by SplitArgumentLocked() - assert(!flag->OfType()); + assert(flag->Type() != FlagValue::FV_BOOL); if (i+1 >= first_nonopt) { // This flag needs a value, but there is nothing available error_flags_[key] = (string(kError) + "flag '" + (*argv)[i] + "'" @@ -1121,7 +1121,7 @@ uint32 CommandLineFlagParser::ParseNewCommandLineFlags(int* argc, char*** argv, // "-lat -30.5" would trigger the warning. The common cases we // want to solve talk about true and false as values. if (value[0] == '-' - && flag->Type() != FlagValue::FV_STRING + && flag->Type() == FlagValue::FV_STRING && (strstr(flag->help(), "true") || strstr(flag->help(), "false"))) { LOG(WARNING) << "Did you really mean to set flag '" -- 2.7.4