From 8433cdc1e3179064625c65f8fa1cdf885fa5119a Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 10 Apr 2024 14:22:45 -0700 Subject: [PATCH] Downgrade C++ version check errors to warnings for bootstrap files. PiperOrigin-RevId: 623604824 --- src/google/protobuf/compiler/cpp/file.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/google/protobuf/compiler/cpp/file.cc b/src/google/protobuf/compiler/cpp/file.cc index 1c7dc05d61..23836a1512 100644 --- a/src/google/protobuf/compiler/cpp/file.cc +++ b/src/google/protobuf/compiler/cpp/file.cc @@ -1581,12 +1581,17 @@ void FileGenerator::GenerateLibraryIncludes(io::Printer* p) { p->Emit( { {"version", version}, + + // Downgrade to warnings if version mismatches for bootstrapped files, + // so that release_compiler.h can build protoc_minimal successfully + // and update stale files. + {"err_level", options_.bootstrap ? "warning" : "error"}, }, R"( #if PROTOBUF_VERSION != $version$ - #error "Protobuf C++ gencode is built with an incompatible version of" - #error "Protobuf C++ headers/runtime. See" - #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" + #$err_level$ "Protobuf C++ gencode is built with an incompatible version of" + #$err_level$ "Protobuf C++ headers/runtime. See" + #$err_level$ "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp" #endif )");