45 lines
1.5 KiB
Diff
45 lines
1.5 KiB
Diff
From 8d334a7204d98874cbf970cb96ab0c7b52e06695 Mon Sep 17 00:00:00 2001
|
|
From: Robert Edmonds <edmonds@users.noreply.github.com>
|
|
Date: Sun, 2 Jul 2023 19:42:19 -0400
|
|
Subject: [PATCH] Work around GOOGLE_* changes in protobuf >= 22.0
|
|
|
|
According to the protobuf migration guide as of June 2023 [0], protobuf
|
|
22.0 (aka 4.22.0) took a dependency on something called "abseil" and as
|
|
a result the "stubs" have been removed. This apparently caused all the
|
|
uses of GOOGLE_* identifiers in protoc-c to fail when building against
|
|
newer versions of protobuf.
|
|
|
|
This commit introduces compatibility definitions when building against
|
|
protobuf >= 4.22.0 so that protobuf-c can build against older and newer
|
|
versions of protobuf.
|
|
|
|
[0] https://web.archive.org/web/20230611151200/https://protobuf.dev/support/migration/#abseil
|
|
---
|
|
protoc-c/c_helpers.h | 10 ++++++++++
|
|
1 file changed, 10 insertions(+)
|
|
|
|
diff --git a/protoc-c/c_helpers.h b/protoc-c/c_helpers.h
|
|
index 7598a4e..adc7ee2 100644
|
|
--- a/protoc-c/c_helpers.h
|
|
+++ b/protoc-c/c_helpers.h
|
|
@@ -178,6 +178,16 @@ inline int FieldSyntax(const FieldDescriptor* field) {
|
|
#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
|
|
} // namespace protobuf
|
|
--
|
|
2.33.0
|
|
|