Downgrade C++ version check errors to warnings for bootstrap files.

PiperOrigin-RevId: 623604824
pull/16455/head
Protobuf Team Bot 8 months ago committed by Copybara-Service
parent 0e8115fed8
commit 8433cdc1e3
  1. 11
      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
)");

Loading…
Cancel
Save