Skip to content

Commit

Permalink
Fix C++ ifndef_guard printer to also convert "-" to "_".
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 679648401
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Sep 27, 2024
1 parent d81e6f7 commit 7331b77
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/google/protobuf/compiler/cpp/ifndef_guard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ std::string MakeIfdefGuardIdentifier(const absl::string_view header_path) {
{
{"/", "_"},
{".", "_"},
{"-", "_"},
})),
"_");
}
Expand Down
2 changes: 1 addition & 1 deletion src/google/protobuf/compiler/cpp/ifndef_guard_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 7331b77

Please sign in to comment.