Skip to content

Commit 82bad2e

Browse files
committed
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).
1 parent 2b3a797 commit 82bad2e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/google/protobuf/compiler/command_line_interface.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments(
15311531
}
15321532

15331533
// Check error cases that span multiple flag values.
1534-
bool missing_proto_definitions;
1534+
bool missing_proto_definitions = false;
15351535
switch (mode_) {
15361536
case MODE_COMPILE:
15371537
missing_proto_definitions = input_files_.empty();
@@ -1555,6 +1555,9 @@ CommandLineInterface::ParseArgumentStatus CommandLineInterface::ParseArguments(
15551555
case MODE_PRINT:
15561556
missing_proto_definitions =
15571557
input_files_.empty() && descriptor_set_in_names_.empty();
1558+
break;
1559+
default:
1560+
GOOGLE_LOG(FATAL) << "Unexpected mode: " << mode_;
15581561
}
15591562
if (missing_proto_definitions) {
15601563
std::cerr << "Missing input file." << std::endl;

0 commit comments

Comments
 (0)