Fixed uninitialized variable warning.

Unfortunately there's not an easy way to annotate that the
"unexpected mode" case is unreachable (even GOOGLE_LOG(FATAL)
in a default: case doesn't do it).
pull/7698/head
Joshua Haberman 5 years ago
parent 2b3a79735b
commit 82bad2e1eb
  1. 5
      src/google/protobuf/compiler/command_line_interface.cc

@ -1531,7 +1531,7 @@ CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments(
}
// Check error cases that span multiple flag values.
bool missing_proto_definitions;
bool missing_proto_definitions = false;
switch (mode_) {
case MODE_COMPILE:
missing_proto_definitions = input_files_.empty();
@ -1555,6 +1555,9 @@ CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments(
case MODE_PRINT:
missing_proto_definitions =
input_files_.empty() && descriptor_set_in_names_.empty();
break;
default:
GOOGLE_LOG(FATAL) << "Unexpected mode: " << mode_;
}
if (missing_proto_definitions) {
std::cerr << "Missing input file." << std::endl;

Loading…
Cancel
Save