sync ports with The Matrix

This commit is contained in:
purplerain 2023-09-17 04:05:06 +00:00
parent 02776f1507
commit a0fe1892c0
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
885 changed files with 6817 additions and 4874 deletions

View file

@ -0,0 +1,42 @@
https://github.com/protobuf-c/protobuf-c/pull/673
Index: protoc-c/c_helpers.h
--- protoc-c/c_helpers.h.orig
+++ protoc-c/c_helpers.h
@@ -70,6 +70,10 @@
#include <protobuf-c/protobuf-c.pb.h>
#include <google/protobuf/io/printer.h>
+#if GOOGLE_PROTOBUF_VERSION >= 4023000
+# include <google/protobuf/descriptor_legacy.h>
+#endif
+
namespace google {
namespace protobuf {
namespace compiler {
@@ -172,11 +176,25 @@ int compare_name_indices_by_name(const void*, const vo
// This wrapper is needed to be able to compile against protobuf2.
inline int FieldSyntax(const FieldDescriptor* field) {
#ifdef HAVE_PROTO3
+# if GOOGLE_PROTOBUF_VERSION >= 4023000
+ return FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3 ? 3 : 2;
+# else
return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? 3 : 2;
+# endif
#else
return 2;
#endif
}
+
+// Work around changes in protobuf >= 22.x without breaking compilation against
+// older protobuf versions.
+#if GOOGLE_PROTOBUF_VERSION >= 4022000
+# define GOOGLE_ARRAYSIZE ABSL_ARRAYSIZE
+# define GOOGLE_CHECK_EQ ABSL_CHECK_EQ
+# define GOOGLE_CHECK_EQ ABSL_CHECK_EQ
+# define GOOGLE_DCHECK_GE ABSL_DCHECK_GE
+# define GOOGLE_LOG ABSL_LOG
+#endif
} // namespace c
} // namespace compiler