Skip to content

Commit

Permalink
Avoid calling absl::InitializeLog in protoc with MSVC
Browse files Browse the repository at this point in the history
The recent github runner image update changes the MSVC version, and InitializeLog now crashes in optimized builds.  Until Abseil works with MSVC, we can just log to stderr in protoc.

PiperOrigin-RevId: 641024759
  • Loading branch information
mkruskal-google authored and zhangskz committed Jun 11, 2024
1 parent 316f493 commit aa7fcb3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions protos/protos_extension_lock_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ void TestConcurrentExtensionAccess(::protos::ExtensionRegistry registry) {
test_theme();
test_theme_extension();
}
#ifndef _MSC_VER
// TODO Re-enable this once github runner issue is resolved.

TEST(CppGeneratedCode, ConcurrentAccessDoesNotRaceBothLazy) {
::upb::Arena arena;
Expand All @@ -120,5 +122,7 @@ TEST(CppGeneratedCode, ConcurrentAccessDoesNotRaceBothEager) {
{{&theme, &ThemeExtension::theme_extension}, arena});
}

#endif // _MSC_VER

} // namespace
} // namespace protos_generator::test::protos
3 changes: 3 additions & 0 deletions src/google/protobuf/compiler/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ namespace protobuf {
namespace compiler {

int ProtobufMain(int argc, char* argv[]) {
#ifndef _MSC_VER
// TODO Re-enable this once github runner issue is resolved.
absl::InitializeLog();
#endif // !_MSC_VER

CommandLineInterface cli;
cli.AllowPlugins("protoc-");
Expand Down
3 changes: 3 additions & 0 deletions src/google/protobuf/compiler/main_no_generators.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ namespace compiler {
// This is a version of protoc that has no built-in code generators.
// See go/protobuf-toolchain-protoc
int ProtocMain(int argc, char* argv[]) {
#ifndef _MSC_VER
// TODO Re-enable this once github runner issue is resolved.
absl::InitializeLog();
#endif // !_MSC_VER

CommandLineInterface cli;
cli.AllowPlugins("protoc-");
Expand Down

0 comments on commit aa7fcb3

Please sign in to comment.