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 #include +#if GOOGLE_PROTOBUF_VERSION >= 4023000 +# include +#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