0003-FileGenerator-GenerateHeader-Set-min_header_version-.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From a6cf1aa386067e26d582cc1d1e327787595c9f13 Mon Sep 17 00:00:00 2001
  2. From: Robert Edmonds <edmonds@users.noreply.github.com>
  3. Date: Wed, 20 Mar 2024 21:48:10 -0400
  4. Subject: [PATCH] FileGenerator::GenerateHeader(): Set `min_header_version`
  5. unconditionally
  6. Previously, we were conditionally trying to set `min_header_version` to
  7. the lowest possible value, and relying on a "legacy" Google interface to
  8. determine the file descriptor's syntax version as part of that
  9. determination.
  10. Instead, simply bump the minimum version to 1003000 (1.3.0). This
  11. release was almost 7 years ago. In practice protobuf-c users should not
  12. be shipping pre-compiled .pb-c.c/.pb-c.h files, anyway.
  13. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
  14. Upstream: https://github.com/protobuf-c/protobuf-c/pull/711
  15. ---
  16. protoc-c/c_file.cc | 9 +--------
  17. 1 file changed, 1 insertion(+), 8 deletions(-)
  18. diff --git a/protoc-c/c_file.cc b/protoc-c/c_file.cc
  19. index ca0ad34..c6d8a24 100644
  20. --- a/protoc-c/c_file.cc
  21. +++ b/protoc-c/c_file.cc
  22. @@ -117,14 +117,7 @@ FileGenerator::~FileGenerator() {}
  23. void FileGenerator::GenerateHeader(io::Printer* printer) {
  24. std::string filename_identifier = FilenameIdentifier(file_->name());
  25. - int min_header_version = 1000000;
  26. -#if GOOGLE_PROTOBUF_VERSION >= 4023000
  27. - if (FileDescriptorLegacy(file_).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3) {
  28. -#else
  29. - if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) {
  30. -#endif
  31. - min_header_version = 1003000;
  32. - }
  33. + const int min_header_version = 1003000;
  34. // Generate top of header.
  35. printer->Print(
  36. --
  37. 2.34.1