diff --git a/src/google/protobuf/compiler/cpp/ifndef_guard.cc b/src/google/protobuf/compiler/cpp/ifndef_guard.cc index bc04eecebf36f..a8604e0675d35 100644 --- a/src/google/protobuf/compiler/cpp/ifndef_guard.cc +++ b/src/google/protobuf/compiler/cpp/ifndef_guard.cc @@ -30,6 +30,7 @@ std::string MakeIfdefGuardIdentifier(const absl::string_view header_path) { { {"/", "_"}, {".", "_"}, + {"-", "_"}, })), "_"); } diff --git a/src/google/protobuf/compiler/cpp/ifndef_guard_unittest.cc b/src/google/protobuf/compiler/cpp/ifndef_guard_unittest.cc index 4e4a823845ed9..b63c86b6a7f78 100644 --- a/src/google/protobuf/compiler/cpp/ifndef_guard_unittest.cc +++ b/src/google/protobuf/compiler/cpp/ifndef_guard_unittest.cc @@ -36,7 +36,7 @@ TEST_F(IfnDefGuardTest, Basic) { { io::Printer printer(output(), '$'); - const IfdefGuardPrinter ifdef_guard(&printer, "A/B/E/alpha"); + const IfdefGuardPrinter ifdef_guard(&printer, "A/B-E.alpha"); EXPECT_FALSE(printer.failed()); }