mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2025-12-21 09:07:26 -08:00
dev-libs/protobuf-c: drop 1.5.1 1.5.0-r4 1.5.0-r3 1.4.1-r2
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com> Part-of: https://github.com/gentoo/gentoo/pull/44225 Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
parent
cde40662a5
commit
5a2f51df5f
@ -1,5 +1 @@
|
||||
DIST protobuf-c-1.4.1.tar.gz 513596 BLAKE2B b5e87a3154863581b81790a26b6b522c2b3ad138e966053f20c6264b4a7677d6c5bff8e27faa7c6cfa9e982b72b06e2f518a3def9f6db13241c3cb3ee9afc8f6 SHA512 190a4aa5c607853e6bf860b0974deb21e4f7f6209e810251eaca9612b59ea676779b0ca217fb1572914ffb8de3315a7d24f162b14d447ee671a9adc5b1271e41
|
||||
DIST protobuf-c-1.5.0.tar.gz 507251 BLAKE2B 7b428655901f4fd74b67b75419552e7c02065a5291aed4dcc1d55b98c986caa9ccf846eb5e98e0954420c3e5bea559b0078843e00daa7b5c63465eec21e28204 SHA512 175c9fc901cab88308730eea982dd62b1e0decdceb80aa53be163f17a440b4acecb834a784beab5cd71186413a322a323f4539758a8727ca51801cf92f9bd3da
|
||||
DIST protobuf-c-1.5.1-protobuf-30.patch 57952 BLAKE2B abd28312d438cacbc056751e265e74e8a987f8f4dceab28b6ef2b628696eed7624bc9d0ac0a67b58cb87383519212541f3e119dd4bb28553c2bd2c5e663ed5a8 SHA512 ae6e2cc0a8141d8143451a87a84ae9140d5e82817f2312025dd426d892c7aa3b5fc363e44f76486608322712eabccaa75afa06ff4bfb7829bb265ab27e11c611
|
||||
DIST protobuf-c-1.5.1.tar.gz 531693 BLAKE2B f3c8688e6d88999b24c1192a91fd96855233c811c9c87534983cca14d06158cf48f729775c529a182326c97c41184ef86fcc26e9ed706e49cf1e7994ed573b61 SHA512 35d4de5562b79056f46320552a27b8e476b92466d0a2f5c697f41b0e1c437bb0b0819c39f71accf942b74ecfcea64e42e0a1e67792eeff4a7e01fbafd84488b5
|
||||
DIST protobuf-c-1.5.2.tar.gz 532447 BLAKE2B f6815319bad26095fe462b7a3da295594a853b131b565c7bc27d2d9ba1e51722ce8fefb408e37bc41b953de8ba51d4340b87a57fbb7163ce444e5aa2b99c9721 SHA512 78dc72988d7e8232c1b967849aa00939bc05ab7d39b86a8e2af005e38aa4ef4c9b03920d51fb5337399d980e65f35d11bd4742bea745a893ecc909f56a51c9ac
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
https://bugs.gentoo.org/518440
|
||||
|
||||
avoid compiling tests when we aren't actually testing, especially since it
|
||||
requires a compiler to execute which fails when cross-compiling
|
||||
|
||||
--- protobuf-c-1.3.0/Makefile.am
|
||||
+++ protobuf-c-1.3.0/Makefile.am
|
||||
@@ -150,7 +150,7 @@
|
||||
t_generated_code2_test_generated_code2_LDADD = \
|
||||
protobuf-c/libprotobuf-c.la
|
||||
|
||||
-noinst_PROGRAMS += \
|
||||
+check_PROGRAMS += \
|
||||
t/generated-code2/cxx-generate-packed-data
|
||||
|
||||
t_generated_code2_cxx_generate_packed_data_SOURCES = \
|
||||
@@ -178,13 +178,6 @@
|
||||
t/generated-code2/test-full-cxx-output.inc: t/generated-code2/cxx-generate-packed-data$(EXEEXT)
|
||||
$(AM_V_GEN)$(top_builddir)/t/generated-code2/cxx-generate-packed-data$(EXEEXT) > $(top_builddir)/t/generated-code2/test-full-cxx-output.inc
|
||||
|
||||
-BUILT_SOURCES += \
|
||||
- t/test.pb-c.c t/test.pb-c.h \
|
||||
- t/test-full.pb-c.c t/test-full.pb-c.h \
|
||||
- t/test-optimized.pb-c.c t/test-optimized.pb-c.h \
|
||||
- t/test-full.pb.cc t/test-full.pb.h \
|
||||
- t/generated-code2/test-full-cxx-output.inc
|
||||
-
|
||||
if BUILD_PROTO3
|
||||
|
||||
check_PROGRAMS += \
|
||||
@ -1,105 +0,0 @@
|
||||
https://bugs.gentoo.org/818775
|
||||
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -111,7 +111,7 @@ protoc_c_protoc_gen_c_LDADD = \
|
||||
-lprotoc
|
||||
|
||||
protobuf-c/protobuf-c.pb.cc protobuf-c/protobuf-c.pb.h: @PROTOC@ $(top_srcdir)/protobuf-c/protobuf-c.proto
|
||||
- $(AM_V_GEN)@PROTOC@ -I$(top_srcdir) --cpp_out=$(top_builddir) $(top_srcdir)/protobuf-c/protobuf-c.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ -I$(top_srcdir) -I@includedir@ --cpp_out=$(top_builddir) $(top_srcdir)/protobuf-c/protobuf-c.proto
|
||||
|
||||
BUILT_SOURCES += \
|
||||
protobuf-c/protobuf-c.pb.cc \
|
||||
@@ -174,16 +174,16 @@ t_generated_code2_cxx_generate_packed_da
|
||||
$(protobuf_LIBS)
|
||||
|
||||
t/test.pb-c.c t/test.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test.proto
|
||||
- $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) -I@includedir@ --c_out=$(top_builddir) $(top_srcdir)/t/test.proto
|
||||
|
||||
t/test-optimized.pb-c.c t/test-optimized.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test-optimized.proto
|
||||
- $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test-optimized.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) -I@includedir@ --c_out=$(top_builddir) $(top_srcdir)/t/test-optimized.proto
|
||||
|
||||
t/test-full.pb-c.c t/test-full.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test-full.proto
|
||||
- $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test-full.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) -I@includedir@ --c_out=$(top_builddir) $(top_srcdir)/t/test-full.proto
|
||||
|
||||
t/test-full.pb.cc t/test-full.pb.h: @PROTOC@ $(top_srcdir)/t/test-full.proto
|
||||
- $(AM_V_GEN)@PROTOC@ -I$(top_srcdir) --cpp_out=$(top_builddir) $(top_srcdir)/t/test-full.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ -I$(top_srcdir) -I@includedir@ --cpp_out=$(top_builddir) $(top_srcdir)/t/test-full.proto
|
||||
|
||||
t/generated-code2/test-full-cxx-output.inc: t/generated-code2/cxx-generate-packed-data$(EXEEXT)
|
||||
$(AM_V_GEN)$(top_builddir)/t/generated-code2/cxx-generate-packed-data$(EXEEXT) > $(top_builddir)/t/generated-code2/test-full-cxx-output.inc
|
||||
@@ -214,7 +214,7 @@ t_generated_code3_test_generated_code3_S
|
||||
t/test-proto3.pb-c.c
|
||||
|
||||
t/test-proto3.pb-c.c t/test-proto3.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test-proto3.proto
|
||||
- $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test-proto3.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) -I@includedir@ --c_out=$(top_builddir) $(top_srcdir)/t/test-proto3.proto
|
||||
|
||||
BUILT_SOURCES += \
|
||||
t/test-proto3.pb-c.c t/test-proto3.pb-c.h
|
||||
@@ -237,7 +237,7 @@ t_issue204_issue204_SOURCES = \
|
||||
t_issue204_issue204_LDADD = \
|
||||
protobuf-c/libprotobuf-c.la
|
||||
t/issue204/issue204.pb-c.c t/issue204/issue204.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/issue204/issue204.proto
|
||||
- $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/issue204/issue204.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) -I@includedir@ --c_out=$(top_builddir) $(top_srcdir)/t/issue204/issue204.proto
|
||||
BUILT_SOURCES += \
|
||||
t/issue204/issue204.pb-c.c t/issue204/issue204.pb-c.h
|
||||
EXTRA_DIST += \
|
||||
@@ -254,7 +254,7 @@ t_issue220_issue220_SOURCES = \
|
||||
t_issue220_issue220_LDADD = \
|
||||
protobuf-c/libprotobuf-c.la
|
||||
t/issue220/issue220.pb-c.c t/issue220/issue220.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/issue220/issue220.proto
|
||||
- $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/issue220/issue220.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) -I@includedir@ --c_out=$(top_builddir) $(top_srcdir)/t/issue220/issue220.proto
|
||||
BUILT_SOURCES += \
|
||||
t/issue220/issue220.pb-c.c t/issue220/issue220.pb-c.h
|
||||
EXTRA_DIST += \
|
||||
@@ -271,7 +271,7 @@ t_issue251_issue251_SOURCES = \
|
||||
t_issue251_issue251_LDADD = \
|
||||
protobuf-c/libprotobuf-c.la
|
||||
t/issue251/issue251.pb-c.c t/issue251/issue251.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/issue251/issue251.proto
|
||||
- $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/issue251/issue251.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) -I@includedir@ --c_out=$(top_builddir) $(top_srcdir)/t/issue251/issue251.proto
|
||||
BUILT_SOURCES += \
|
||||
t/issue251/issue251.pb-c.c t/issue251/issue251.pb-c.h
|
||||
EXTRA_DIST += \
|
||||
@@ -289,14 +289,14 @@ t_issue330_issue330_SOURCES = \
|
||||
t_issue330_issue330_LDADD = \
|
||||
protobuf-c/libprotobuf-c.la
|
||||
t/issue330/issue330.pb-c.c t/issue330/issue330.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/issue330/issue330.proto
|
||||
- $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/issue330/issue330.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) -I@includedir@ --c_out=$(top_builddir) $(top_srcdir)/t/issue330/issue330.proto
|
||||
BUILT_SOURCES += \
|
||||
t/issue330/issue330.pb-c.c t/issue330/issue330.pb-c.h
|
||||
|
||||
t_issue330_issue330_SOURCES += \
|
||||
t/issue389/issue389.pb-c.c # Tack onto issue330 since there is no need for a separate binary here
|
||||
t/issue389/issue389.pb-c.c t/issue389/issue389.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/issue389/issue389.proto
|
||||
- $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/issue389/issue389.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) -I@includedir@ --c_out=$(top_builddir) $(top_srcdir)/t/issue389/issue389.proto
|
||||
BUILT_SOURCES += \
|
||||
t/issue389/issue389.pb-c.c t/issue389/issue389.pb-c.h
|
||||
EXTRA_DIST += \
|
||||
@@ -312,7 +312,7 @@ t_issue440_issue440_SOURCES = \
|
||||
t_issue440_issue440_LDADD = \
|
||||
protobuf-c/libprotobuf-c.la
|
||||
t/issue440/issue440.pb-c.c t/issue440/issue440.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/issue440/issue440.proto
|
||||
- $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/issue440/issue440.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) -I@includedir@ --c_out=$(top_builddir) $(top_srcdir)/t/issue440/issue440.proto
|
||||
BUILT_SOURCES += \
|
||||
t/issue440/issue440.pb-c.c t/issue440/issue440.pb-c.h
|
||||
EXTRA_DIST += \
|
||||
@@ -332,7 +332,7 @@ t_issue375_issue375_SOURCES = \
|
||||
t_issue375_issue375_LDADD = \
|
||||
protobuf-c/libprotobuf-c.la
|
||||
t/issue375/issue375.pb-c.c t/issue375/issue375.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/issue375/issue375.proto
|
||||
- $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/issue375/issue375.proto
|
||||
+ $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) -I@includedir@ --c_out=$(top_builddir) $(top_srcdir)/t/issue375/issue375.proto
|
||||
BUILT_SOURCES += \
|
||||
t/issue375/issue375.pb-c.c t/issue375/issue375.pb-c.h
|
||||
EXTRA_DIST += \
|
||||
@ -1,501 +0,0 @@
|
||||
https://bugs.gentoo.org/912775
|
||||
https://github.com/protobuf-c/protobuf-c/issues/679
|
||||
https://github.com/protobuf-c/protobuf-c/issues/544
|
||||
https://github.com/protobuf-c/protobuf-c/pull/673
|
||||
|
||||
From ad48868dfe77592c4bacf936ade208f384a26b09 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Edmonds <edmonds@users.noreply.github.com>
|
||||
Date: Sun, 2 Jul 2023 17:48:18 -0400
|
||||
Subject: [PATCH 1/7] protoc-c: Remove GOOGLE_DISALLOW_EVIL_CONSTRUCTORS macro
|
||||
invocations
|
||||
|
||||
protobuf has removed the definition of this macro as of commit
|
||||
1595417dd3859bbff7d3d61ad0b6e39044d47489, so the invocation of this
|
||||
macro in protobuf-c breaks the build when building agaist the protobuf
|
||||
22.x or 23.x series.
|
||||
|
||||
Simply removing the macro invocations seems to be safe and doesn't break
|
||||
the build on Debian's protobuf 3.21.12 nor Debian's protobuf 3.6.1.3.
|
||||
---
|
||||
protoc-c/c_bytes_field.h | 2 --
|
||||
protoc-c/c_enum.h | 2 --
|
||||
protoc-c/c_enum_field.h | 2 --
|
||||
protoc-c/c_extension.h | 2 --
|
||||
protoc-c/c_field.h | 5 -----
|
||||
protoc-c/c_file.h | 2 --
|
||||
protoc-c/c_generator.h | 3 ---
|
||||
protoc-c/c_message.h | 2 --
|
||||
protoc-c/c_message_field.h | 4 ----
|
||||
protoc-c/c_primitive_field.h | 4 ----
|
||||
protoc-c/c_service.h | 2 --
|
||||
protoc-c/c_string_field.h | 2 --
|
||||
12 files changed, 32 deletions(-)
|
||||
|
||||
diff --git a/protoc-c/c_bytes_field.h b/protoc-c/c_bytes_field.h
|
||||
index bf873f0f..df91ef73 100644
|
||||
--- a/protoc-c/c_bytes_field.h
|
||||
+++ b/protoc-c/c_bytes_field.h
|
||||
@@ -87,8 +87,6 @@ class BytesFieldGenerator : public FieldGenerator {
|
||||
|
||||
private:
|
||||
std::map<std::string, std::string> variables_;
|
||||
-
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(BytesFieldGenerator);
|
||||
};
|
||||
|
||||
|
||||
diff --git a/protoc-c/c_enum.h b/protoc-c/c_enum.h
|
||||
index 9c34b697..089c3366 100644
|
||||
--- a/protoc-c/c_enum.h
|
||||
+++ b/protoc-c/c_enum.h
|
||||
@@ -106,8 +106,6 @@ class EnumGenerator {
|
||||
private:
|
||||
const EnumDescriptor* descriptor_;
|
||||
std::string dllexport_decl_;
|
||||
-
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
|
||||
};
|
||||
|
||||
} // namespace c
|
||||
diff --git a/protoc-c/c_enum_field.h b/protoc-c/c_enum_field.h
|
||||
index 3f8c005d..e0c96adf 100644
|
||||
--- a/protoc-c/c_enum_field.h
|
||||
+++ b/protoc-c/c_enum_field.h
|
||||
@@ -85,8 +85,6 @@ class EnumFieldGenerator : public FieldGenerator {
|
||||
|
||||
private:
|
||||
std::map<std::string, std::string> variables_;
|
||||
-
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
|
||||
};
|
||||
|
||||
|
||||
diff --git a/protoc-c/c_extension.h b/protoc-c/c_extension.h
|
||||
index 95413885..bda0bc55 100644
|
||||
--- a/protoc-c/c_extension.h
|
||||
+++ b/protoc-c/c_extension.h
|
||||
@@ -98,8 +98,6 @@ class ExtensionGenerator {
|
||||
const FieldDescriptor* descriptor_;
|
||||
std::string type_traits_;
|
||||
std::string dllexport_decl_;
|
||||
-
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
|
||||
};
|
||||
|
||||
} // namespace c
|
||||
diff --git a/protoc-c/c_field.h b/protoc-c/c_field.h
|
||||
index 3cad35d3..623a872e 100644
|
||||
--- a/protoc-c/c_field.h
|
||||
+++ b/protoc-c/c_field.h
|
||||
@@ -103,9 +103,6 @@ class FieldGenerator {
|
||||
const std::string &type_macro,
|
||||
const std::string &descriptor_addr) const;
|
||||
const FieldDescriptor *descriptor_;
|
||||
-
|
||||
- private:
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
|
||||
};
|
||||
|
||||
// Convenience class which constructs FieldGenerators for a Descriptor.
|
||||
@@ -121,8 +118,6 @@ class FieldGeneratorMap {
|
||||
std::unique_ptr<std::unique_ptr<FieldGenerator>[]> field_generators_;
|
||||
|
||||
static FieldGenerator* MakeGenerator(const FieldDescriptor* field);
|
||||
-
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
|
||||
};
|
||||
|
||||
} // namespace c
|
||||
diff --git a/protoc-c/c_file.h b/protoc-c/c_file.h
|
||||
index 8dfd8ba0..db1866cd 100644
|
||||
--- a/protoc-c/c_file.h
|
||||
+++ b/protoc-c/c_file.h
|
||||
@@ -103,8 +103,6 @@ class FileGenerator {
|
||||
std::unique_ptr<std::unique_ptr<EnumGenerator>[]> enum_generators_;
|
||||
std::unique_ptr<std::unique_ptr<ServiceGenerator>[]> service_generators_;
|
||||
std::unique_ptr<std::unique_ptr<ExtensionGenerator>[]> extension_generators_;
|
||||
-
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
|
||||
};
|
||||
|
||||
} // namespace c
|
||||
diff --git a/protoc-c/c_generator.h b/protoc-c/c_generator.h
|
||||
index ac1ffafe..b8b44aaa 100644
|
||||
--- a/protoc-c/c_generator.h
|
||||
+++ b/protoc-c/c_generator.h
|
||||
@@ -93,9 +93,6 @@ class PROTOC_C_EXPORT CGenerator : public CodeGenerator {
|
||||
const std::string& parameter,
|
||||
OutputDirectory* output_directory,
|
||||
std::string* error) const;
|
||||
-
|
||||
- private:
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CGenerator);
|
||||
};
|
||||
|
||||
} // namespace c
|
||||
diff --git a/protoc-c/c_message.h b/protoc-c/c_message.h
|
||||
index ea1c3ab3..0d8c6440 100644
|
||||
--- a/protoc-c/c_message.h
|
||||
+++ b/protoc-c/c_message.h
|
||||
@@ -136,8 +136,6 @@ class MessageGenerator {
|
||||
std::unique_ptr<std::unique_ptr<MessageGenerator>[]> nested_generators_;
|
||||
std::unique_ptr<std::unique_ptr<EnumGenerator>[]> enum_generators_;
|
||||
std::unique_ptr<std::unique_ptr<ExtensionGenerator>[]> extension_generators_;
|
||||
-
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator);
|
||||
};
|
||||
|
||||
} // namespace c
|
||||
diff --git a/protoc-c/c_message_field.h b/protoc-c/c_message_field.h
|
||||
index 39b8d999..e485921a 100644
|
||||
--- a/protoc-c/c_message_field.h
|
||||
+++ b/protoc-c/c_message_field.h
|
||||
@@ -82,10 +82,6 @@ class MessageFieldGenerator : public FieldGenerator {
|
||||
void GenerateDescriptorInitializer(io::Printer* printer) const;
|
||||
std::string GetDefaultValue(void) const;
|
||||
void GenerateStaticInit(io::Printer* printer) const;
|
||||
-
|
||||
- private:
|
||||
-
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
|
||||
};
|
||||
|
||||
|
||||
diff --git a/protoc-c/c_primitive_field.h b/protoc-c/c_primitive_field.h
|
||||
index a9eb893b..aa7079f9 100644
|
||||
--- a/protoc-c/c_primitive_field.h
|
||||
+++ b/protoc-c/c_primitive_field.h
|
||||
@@ -82,10 +82,6 @@ class PrimitiveFieldGenerator : public FieldGenerator {
|
||||
void GenerateDescriptorInitializer(io::Printer* printer) const;
|
||||
std::string GetDefaultValue(void) const;
|
||||
void GenerateStaticInit(io::Printer* printer) const;
|
||||
-
|
||||
- private:
|
||||
-
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
|
||||
};
|
||||
|
||||
} // namespace c
|
||||
diff --git a/protoc-c/c_service.h b/protoc-c/c_service.h
|
||||
index 27125a60..b51472f9 100644
|
||||
--- a/protoc-c/c_service.h
|
||||
+++ b/protoc-c/c_service.h
|
||||
@@ -100,8 +100,6 @@ class ServiceGenerator {
|
||||
|
||||
const ServiceDescriptor* descriptor_;
|
||||
std::map<std::string, std::string> vars_;
|
||||
-
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceGenerator);
|
||||
};
|
||||
|
||||
} // namespace c
|
||||
diff --git a/protoc-c/c_string_field.h b/protoc-c/c_string_field.h
|
||||
index 513cea75..b3a1a7ff 100644
|
||||
--- a/protoc-c/c_string_field.h
|
||||
+++ b/protoc-c/c_string_field.h
|
||||
@@ -87,8 +87,6 @@ class StringFieldGenerator : public FieldGenerator {
|
||||
|
||||
private:
|
||||
std::map<std::string, std::string> variables_;
|
||||
-
|
||||
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator);
|
||||
};
|
||||
|
||||
|
||||
|
||||
From 7b90330bff40ab555bb3f0c5ee43ae208a275104 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Edmonds <edmonds@users.noreply.github.com>
|
||||
Date: Sun, 2 Jul 2023 19:35:43 -0400
|
||||
Subject: [PATCH 2/7] Use GOOGLE_LOG(FATAL) instead of GOOGLE_LOG(DFATAL)
|
||||
|
||||
Looking at where these identifiers are ultimately defined [0], it looks
|
||||
like "DFATAL" means either "ERROR" or "FATAL" depending on whether
|
||||
NDEBUG is defined. However, looking at the actual code sites in protoc-c
|
||||
where DFATAL is used, it's not clear why we couldn't just use FATAL
|
||||
unconditionally.
|
||||
|
||||
This is aimed at supporting newer versions of protobuf where the DFATAL
|
||||
identifier apparently no longer exists.
|
||||
|
||||
[0] https://github.com/protocolbuffers/protobuf/blob/v21.12/src/google/protobuf/stubs/logging.h#L61-L65
|
||||
---
|
||||
protoc-c/c_message.cc | 4 ++--
|
||||
protoc-c/c_primitive_field.cc | 2 +-
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/protoc-c/c_message.cc b/protoc-c/c_message.cc
|
||||
index 37e8bf8b..af2974ca 100755
|
||||
--- a/protoc-c/c_message.cc
|
||||
+++ b/protoc-c/c_message.cc
|
||||
@@ -499,7 +499,7 @@ GenerateMessageDescriptor(io::Printer* printer, bool gen_init) {
|
||||
// NOTE: not supported by protobuf
|
||||
vars["maybe_static"] = "";
|
||||
vars["field_dv_ctype"] = "{ ... }";
|
||||
- GOOGLE_LOG(DFATAL) << "Messages can't have default values!";
|
||||
+ GOOGLE_LOG(FATAL) << "Messages can't have default values!";
|
||||
break;
|
||||
case FieldDescriptor::CPPTYPE_STRING:
|
||||
if (fd->type() == FieldDescriptor::TYPE_BYTES || opt.string_as_bytes())
|
||||
@@ -521,7 +521,7 @@ GenerateMessageDescriptor(io::Printer* printer, bool gen_init) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
- GOOGLE_LOG(DFATAL) << "Unknown CPPTYPE";
|
||||
+ GOOGLE_LOG(FATAL) << "Unknown CPPTYPE";
|
||||
break;
|
||||
}
|
||||
if (!already_defined)
|
||||
diff --git a/protoc-c/c_primitive_field.cc b/protoc-c/c_primitive_field.cc
|
||||
index 6990893f..1727af38 100644
|
||||
--- a/protoc-c/c_primitive_field.cc
|
||||
+++ b/protoc-c/c_primitive_field.cc
|
||||
@@ -143,7 +143,7 @@ std::string PrimitiveFieldGenerator::GetDefaultValue() const
|
||||
case FieldDescriptor::CPPTYPE_BOOL:
|
||||
return descriptor_->default_value_bool() ? "1" : "0";
|
||||
default:
|
||||
- GOOGLE_LOG(DFATAL) << "unexpected CPPTYPE in c_primitive_field";
|
||||
+ GOOGLE_LOG(FATAL) << "unexpected CPPTYPE in c_primitive_field";
|
||||
return "UNEXPECTED_CPPTYPE";
|
||||
}
|
||||
}
|
||||
|
||||
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 3/7] 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 7598a4e1..adc7ee21 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
|
||||
|
||||
From 23d2246e0f6ebfc69232ab29b6c6325d8009d1f7 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Edmonds <edmonds@users.noreply.github.com>
|
||||
Date: Sun, 2 Jul 2023 19:48:17 -0400
|
||||
Subject: [PATCH 4/7] configure.ac: Require C++17 when building against
|
||||
protobuf >= 4.22.0
|
||||
|
||||
It's unclear from looking at the online protobuf documentation whether
|
||||
C++14 or C++17 is now required when building against newer versions of
|
||||
protobuf (or perhaps I'm looking in the wrong place), but experimentally
|
||||
it did not work for me with C++14.
|
||||
|
||||
This commit rewrites the versioned PKG_CHECK_MODULES checks in
|
||||
configure.ac to enforce the following policies:
|
||||
|
||||
* Require protobuf >= 2.6.0.
|
||||
* On protobuf >= 3.0.0, require C++11.
|
||||
* On protobuf >= 4.22.0, require C++17.
|
||||
---
|
||||
configure.ac | 26 ++++++++++++++++++++------
|
||||
1 file changed, 20 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 94d01dca..fa024b6a 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -76,12 +76,26 @@ AC_ARG_ENABLE([protoc],
|
||||
if test "x$enable_protoc" != "xno"; then
|
||||
AC_LANG_PUSH([C++])
|
||||
|
||||
- AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
|
||||
-
|
||||
- PKG_CHECK_MODULES([protobuf], [protobuf >= 3.0.0],
|
||||
- [proto3_supported=yes],
|
||||
- [PKG_CHECK_MODULES([protobuf], [protobuf >= 2.6.0])]
|
||||
- )
|
||||
+ # PKG_CHECK_MODULES(prefix, list-of-modules, action-if-found, action-if-not-found)
|
||||
+ PKG_CHECK_MODULES(
|
||||
+ [protobuf],
|
||||
+ [protobuf >= 4.22.0],
|
||||
+ [
|
||||
+ proto3_supported=yes
|
||||
+ AX_CXX_COMPILE_STDCXX(17, noext, mandatory)
|
||||
+ ],
|
||||
+ [
|
||||
+ PKG_CHECK_MODULES(
|
||||
+ [protobuf],
|
||||
+ [protobuf >= 3.0.0],
|
||||
+ [
|
||||
+ proto3_supported=yes
|
||||
+ AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
|
||||
+ ],
|
||||
+ [
|
||||
+ PKG_CHECK_MODULES([protobuf], [protobuf >= 2.6.0])
|
||||
+ ])
|
||||
+ ])
|
||||
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$save_CPPFLAGS $protobuf_CFLAGS"
|
||||
|
||||
From 1937ba946b0a7a62c0f534e60f4d4799d7e0daed Mon Sep 17 00:00:00 2001
|
||||
From: Robert Edmonds <edmonds@users.noreply.github.com>
|
||||
Date: Sun, 2 Jul 2023 22:57:57 -0400
|
||||
Subject: [PATCH 5/7] protoc-c: Use FileDescriptorLegacy to obtain proto syntax
|
||||
version on protobuf >= 23.0
|
||||
|
||||
Use the newer "legacy" way of determining whether a file descriptor is
|
||||
using proto2 or proto3 syntax on protobuf >= 23.0.
|
||||
|
||||
Based on
|
||||
https://github.com/protobuf-c/protobuf-c/pull/556/commits/66574f3fd85a205eb7c90b790477d5415364209e
|
||||
but continues to support older versions of protobuf.
|
||||
|
||||
Unfortunately, since this is a "deprecated", "legacy" API it'll probably
|
||||
disappear in about five seconds.
|
||||
---
|
||||
protoc-c/c_file.cc | 4 ++++
|
||||
protoc-c/c_helpers.h | 8 ++++++++
|
||||
2 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/protoc-c/c_file.cc b/protoc-c/c_file.cc
|
||||
index 59c1824e..d211a3da 100644
|
||||
--- a/protoc-c/c_file.cc
|
||||
+++ b/protoc-c/c_file.cc
|
||||
@@ -119,7 +119,11 @@ void FileGenerator::GenerateHeader(io::Printer* printer) {
|
||||
|
||||
int min_header_version = 1000000;
|
||||
#if defined(HAVE_PROTO3)
|
||||
+# if GOOGLE_PROTOBUF_VERSION >= 4023000
|
||||
+ if (FileDescriptorLegacy(file_).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3) {
|
||||
+# else
|
||||
if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) {
|
||||
+#endif
|
||||
min_header_version = 1003000;
|
||||
}
|
||||
#endif
|
||||
diff --git a/protoc-c/c_helpers.h b/protoc-c/c_helpers.h
|
||||
index adc7ee21..055528bf 100644
|
||||
--- a/protoc-c/c_helpers.h
|
||||
+++ b/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,7 +176,11 @@ int compare_name_indices_by_name(const void*, const void*);
|
||||
// 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
|
||||
|
||||
From 7582b6e7d640636bf24c0f9dd2b386ed6fd41919 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Edmonds <edmonds@users.noreply.github.com>
|
||||
Date: Sun, 2 Jul 2023 22:58:48 -0400
|
||||
Subject: [PATCH 6/7] cmake: Require C++17
|
||||
|
||||
Newer versions of protobuf apparently don't build with older versions of
|
||||
the C++ standard.
|
||||
---
|
||||
build-cmake/CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt
|
||||
index 95f561c0..c71dd899 100644
|
||||
--- a/build-cmake/CMakeLists.txt
|
||||
+++ b/build-cmake/CMakeLists.txt
|
||||
@@ -96,7 +96,7 @@ if (MSVC AND NOT BUILD_SHARED_LIBS)
|
||||
endif (MSVC AND NOT BUILD_SHARED_LIBS)
|
||||
|
||||
IF(BUILD_PROTOC)
|
||||
-SET(CMAKE_CXX_STANDARD 11)
|
||||
+SET(CMAKE_CXX_STANDARD 17)
|
||||
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
SET(CMAKE_CXX_EXTENSIONS OFF)
|
||||
ADD_CUSTOM_COMMAND(OUTPUT protobuf-c/protobuf-c.pb.cc protobuf-c/protobuf-c.pb.h
|
||||
|
||||
From 5b0661f1e8a0e03f75cc6f53b8d42507e95403c9 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Edmonds <edmonds@users.noreply.github.com>
|
||||
Date: Mon, 3 Jul 2023 01:10:28 -0400
|
||||
Subject: [PATCH 7/7] configure.ac: Require C++17
|
||||
|
||||
There are some recent reports of strange build failures that might have
|
||||
been fixed by compiling in C++17 mode, so it might be a good idea to use
|
||||
C++17 in general, and not just when building against very recent
|
||||
protobuf versions.
|
||||
|
||||
Since it looks like we've lost protobuf < 3.0.0 support, configure.ac
|
||||
can be simplified a bit if we just use C++17 by default.
|
||||
---
|
||||
configure.ac | 23 ++---------------------
|
||||
1 file changed, 2 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index fa024b6a..586ac3c0 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -75,27 +75,8 @@ AC_ARG_ENABLE([protoc],
|
||||
AS_HELP_STRING([--disable-protoc], [Disable building protoc_c (also disables tests)]))
|
||||
if test "x$enable_protoc" != "xno"; then
|
||||
AC_LANG_PUSH([C++])
|
||||
-
|
||||
- # PKG_CHECK_MODULES(prefix, list-of-modules, action-if-found, action-if-not-found)
|
||||
- PKG_CHECK_MODULES(
|
||||
- [protobuf],
|
||||
- [protobuf >= 4.22.0],
|
||||
- [
|
||||
- proto3_supported=yes
|
||||
- AX_CXX_COMPILE_STDCXX(17, noext, mandatory)
|
||||
- ],
|
||||
- [
|
||||
- PKG_CHECK_MODULES(
|
||||
- [protobuf],
|
||||
- [protobuf >= 3.0.0],
|
||||
- [
|
||||
- proto3_supported=yes
|
||||
- AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
|
||||
- ],
|
||||
- [
|
||||
- PKG_CHECK_MODULES([protobuf], [protobuf >= 2.6.0])
|
||||
- ])
|
||||
- ])
|
||||
+ AX_CXX_COMPILE_STDCXX(17, noext, mandatory)
|
||||
+ PKG_CHECK_MODULES([protobuf], [protobuf >= 3.0.0], [proto3_supported=yes])
|
||||
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$save_CPPFLAGS $protobuf_CFLAGS"
|
||||
@ -1,117 +0,0 @@
|
||||
From a6cf1aa386067e26d582cc1d1e327787595c9f13 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Edmonds <edmonds@users.noreply.github.com>
|
||||
Date: Wed, 20 Mar 2024 21:48:10 -0400
|
||||
Subject: [PATCH 01/11] FileGenerator::GenerateHeader(): Set
|
||||
`min_header_version` unconditionally
|
||||
|
||||
Previously, we were conditionally trying to set `min_header_version` to
|
||||
the lowest possible value, and relying on a "legacy" Google interface to
|
||||
determine the file descriptor's syntax version as part of that
|
||||
determination.
|
||||
|
||||
Instead, simply bump the minimum version to 1003000 (1.3.0). This
|
||||
release was almost 7 years ago. In practice protobuf-c users should not
|
||||
be shipping pre-compiled .pb-c.c/.pb-c.h files, anyway.
|
||||
---
|
||||
protoc-c/c_file.cc | 9 +--------
|
||||
1 file changed, 1 insertion(+), 8 deletions(-)
|
||||
|
||||
diff --git a/protoc-c/c_file.cc b/protoc-c/c_file.cc
|
||||
index ca0ad34e..c6d8a240 100644
|
||||
--- a/protoc-c/c_file.cc
|
||||
+++ b/protoc-c/c_file.cc
|
||||
@@ -117,14 +117,7 @@ FileGenerator::~FileGenerator() {}
|
||||
void FileGenerator::GenerateHeader(io::Printer* printer) {
|
||||
std::string filename_identifier = FilenameIdentifier(file_->name());
|
||||
|
||||
- int min_header_version = 1000000;
|
||||
-#if GOOGLE_PROTOBUF_VERSION >= 4023000
|
||||
- if (FileDescriptorLegacy(file_).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3) {
|
||||
-#else
|
||||
- if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) {
|
||||
-#endif
|
||||
- min_header_version = 1003000;
|
||||
- }
|
||||
+ const int min_header_version = 1003000;
|
||||
|
||||
// Generate top of header.
|
||||
printer->Print(
|
||||
|
||||
From ee3d9e5423c93ee6b828fdda8e7fef13a77634eb Mon Sep 17 00:00:00 2001
|
||||
From: Robert Edmonds <edmonds@users.noreply.github.com>
|
||||
Date: Wed, 20 Mar 2024 22:25:54 -0400
|
||||
Subject: [PATCH 02/11] Reimplement FieldSyntax() to maximize compatibility
|
||||
across protobuf versions
|
||||
|
||||
Recent versions of Google protobuf have broken the interfaces for
|
||||
determining the syntax version of a .proto file. The current protobuf-c
|
||||
1.5.0 release does not compile with Google protobuf 26.0 due to the most
|
||||
recentage breakage. There is a possible workaround involving the Google
|
||||
protobuf `FileDescriptorLegacy` class, which is documented as:
|
||||
|
||||
// TODO Remove this deprecated API entirely.
|
||||
|
||||
So we probably shouldn't rely on it.
|
||||
|
||||
Instead, this commit obtains the `FileDescriptorProto` corresponding
|
||||
to the passed in `FieldDescriptor` and interrogates the `syntax` field
|
||||
directly. This is a single implementation with no version-specific
|
||||
workarounds. Hopefully this won't break in the next Google protobuf
|
||||
release.
|
||||
|
||||
I tested the `FieldSyntax()` implementation in this commit across a
|
||||
number of different Google protobuf releases and found that it worked
|
||||
(`make && make check`) on all of them:
|
||||
|
||||
- Google protobuf 3.6.1.3 (Ubuntu 20.04)
|
||||
- Google protobuf 3.12.4 (Ubuntu 22.04)
|
||||
- Google protobuf 3.21.12 (Debian 12 + Debian unstable)
|
||||
- Google protobuf 3.25.2 (Debian experimental)
|
||||
- Google protobuf 26.1-dev
|
||||
---
|
||||
protoc-c/c_helpers.h | 24 ++++++++++++++----------
|
||||
1 file changed, 14 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/protoc-c/c_helpers.h b/protoc-c/c_helpers.h
|
||||
index 062d330b..be28b601 100644
|
||||
--- a/protoc-c/c_helpers.h
|
||||
+++ b/protoc-c/c_helpers.h
|
||||
@@ -70,10 +70,6 @@
|
||||
#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 {
|
||||
@@ -173,13 +169,21 @@ struct NameIndex
|
||||
int compare_name_indices_by_name(const void*, const void*);
|
||||
|
||||
// Return the syntax version of the file containing the field.
|
||||
-// This wrapper is needed to be able to compile against protobuf2.
|
||||
inline int FieldSyntax(const FieldDescriptor* field) {
|
||||
-#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
|
||||
+ auto proto = FileDescriptorProto();
|
||||
+ field->file()->CopyTo(&proto);
|
||||
+
|
||||
+ if (proto.has_syntax()) {
|
||||
+ auto syntax = proto.syntax();
|
||||
+ assert(syntax == "proto2" || syntax == "proto3");
|
||||
+ if (syntax == "proto2") {
|
||||
+ return 2;
|
||||
+ } else if (syntax == "proto3") {
|
||||
+ return 3;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 2;
|
||||
}
|
||||
|
||||
// Work around changes in protobuf >= 22.x without breaking compilation against
|
||||
@ -1,44 +0,0 @@
|
||||
https://github.com/protobuf-c/protobuf-c/issues/690
|
||||
https://github.com/protobuf-c/protobuf-c/pull/703
|
||||
|
||||
From 55c8b0dc688b070f4fa860d055a6365c0ae11bb3 Mon Sep 17 00:00:00 2001
|
||||
From: Stephan Mueller <smueller@chronox.de>
|
||||
Date: Sun, 21 Jan 2024 11:04:34 +0100
|
||||
Subject: [PATCH] Fix memory corruption by initlizalizing pointer
|
||||
|
||||
A memory corruption in protobuf_c_message_free_unpacked happens at the
|
||||
following line:
|
||||
|
||||
if (message->unknown_fields != NULL)
|
||||
do_free(allocator, message->unknown_fields);
|
||||
|
||||
The do_free will free ->unknown_fields. This is may be wrong, because
|
||||
protobuf_c_message_unpack uses malloc as the default allocator, allocates
|
||||
rv with malloc. At the end, however, ->unknown_fields is only initialized
|
||||
if there are some. That means if there are no such fields ->unknown_fields
|
||||
is an uninitialized pointer.
|
||||
|
||||
The patch initializes the pointer to NULL to ensure the check before free
|
||||
is performed on initialized memory in case there is no unknown_field.
|
||||
|
||||
This fixes https://github.com/protobuf-c/protobuf-c/issues/690
|
||||
|
||||
Signed-off-by: Stephan Mueller <smueller@chronox.de>
|
||||
---
|
||||
protobuf-c/protobuf-c.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/protobuf-c/protobuf-c.c b/protobuf-c/protobuf-c.c
|
||||
index 776ee4fb..0c18f89b 100644
|
||||
--- a/protobuf-c/protobuf-c.c
|
||||
+++ b/protobuf-c/protobuf-c.c
|
||||
@@ -3278,6 +3278,8 @@ protobuf_c_message_unpack(const ProtobufCMessageDescriptor *desc,
|
||||
n_unknown * sizeof(ProtobufCMessageUnknownField));
|
||||
if (rv->unknown_fields == NULL)
|
||||
goto error_cleanup;
|
||||
+ } else {
|
||||
+ rv->unknown_fields = NULL;
|
||||
}
|
||||
|
||||
/* do real parsing */
|
||||
|
||||
@ -1,63 +0,0 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit autotools flag-o-matic multilib-minimal
|
||||
|
||||
MY_PV="${PV/_/-}"
|
||||
MY_P="${PN}-${MY_PV}"
|
||||
|
||||
DESCRIPTION="Protocol Buffers implementation in C"
|
||||
HOMEPAGE="https://github.com/protobuf-c/protobuf-c"
|
||||
SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${MY_PV}/${MY_P}.tar.gz"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="BSD-2"
|
||||
# Subslot == SONAME version
|
||||
SLOT="0/1.0.0"
|
||||
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
|
||||
IUSE="static-libs test"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
BDEPEND="
|
||||
>=dev-libs/protobuf-3:0
|
||||
virtual/pkgconfig
|
||||
"
|
||||
DEPEND=">=dev-libs/protobuf-3:0=[${MULTILIB_USEDEP}]"
|
||||
RDEPEND="${DEPEND}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-1.4.0-include-path.patch
|
||||
"${FILESDIR}"/${P}-protobuf-22.patch
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
if ! use test; then
|
||||
eapply "${FILESDIR}"/${PN}-1.3.0-no-build-tests.patch
|
||||
fi
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
# Workaround for bug #946366
|
||||
append-flags $(test-flags-CC -fzero-init-padding-bits=unions)
|
||||
|
||||
multilib-minimal_src_configure
|
||||
}
|
||||
|
||||
multilib_src_configure() {
|
||||
local myeconfargs=(
|
||||
$(use_enable static-libs static)
|
||||
)
|
||||
|
||||
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
|
||||
}
|
||||
|
||||
multilib_src_install_all() {
|
||||
find "${ED}" -name '*.la' -type f -delete || die
|
||||
einstalldocs
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit autotools flag-o-matic multilib-minimal
|
||||
|
||||
MY_PV="${PV/_/-}"
|
||||
MY_P="${PN}-${MY_PV}"
|
||||
|
||||
DESCRIPTION="Protocol Buffers implementation in C"
|
||||
HOMEPAGE="https://github.com/protobuf-c/protobuf-c"
|
||||
SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${MY_PV}/${MY_P}.tar.gz"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="BSD-2"
|
||||
# Subslot == SONAME version
|
||||
SLOT="0/1.0.0"
|
||||
KEYWORDS="~alpha amd64 ~arm arm64 ~loong ~mips ppc64 ~riscv ~sparc x86"
|
||||
IUSE="static-libs"
|
||||
|
||||
BDEPEND="
|
||||
>=dev-libs/protobuf-3:0
|
||||
virtual/pkgconfig
|
||||
"
|
||||
DEPEND="
|
||||
>=dev-libs/protobuf-3:0=[${MULTILIB_USEDEP}]"
|
||||
# NOTE
|
||||
# protobuf links to abseil-cpp libraries via it's .pc files.
|
||||
# To cause rebuild when the abseil-cpp version changes we add it to RDEPEND only.
|
||||
RDEPEND="${DEPEND}
|
||||
dev-cpp/abseil-cpp:=[${MULTILIB_USEDEP}]
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/${PN}-1.5.0-Clean-CMake.patch"
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
# Workaround for bug #946366
|
||||
append-flags $(test-flags-CC -fzero-init-padding-bits=unions)
|
||||
|
||||
multilib-minimal_src_configure
|
||||
}
|
||||
|
||||
multilib_src_configure() {
|
||||
local myeconfargs=(
|
||||
$(use_enable static-libs static)
|
||||
--enable-year2038
|
||||
)
|
||||
|
||||
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
|
||||
}
|
||||
|
||||
multilib_src_install_all() {
|
||||
find "${ED}" -name '*.la' -type f -delete || die
|
||||
einstalldocs
|
||||
}
|
||||
@ -1,66 +0,0 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
# Check 'next' branch for backports.
|
||||
|
||||
inherit autotools flag-o-matic multilib-minimal
|
||||
|
||||
MY_PV="${PV/_/-}"
|
||||
MY_P="${PN}-${MY_PV}"
|
||||
|
||||
DESCRIPTION="Protocol Buffers implementation in C"
|
||||
HOMEPAGE="https://github.com/protobuf-c/protobuf-c"
|
||||
SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${MY_PV}/${MY_P}.tar.gz"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="BSD-2"
|
||||
# Subslot == SONAME version
|
||||
SLOT="0/1.0.0"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc64 ~riscv ~sparc ~x86"
|
||||
IUSE="static-libs"
|
||||
|
||||
BDEPEND="
|
||||
>=dev-libs/protobuf-3:0
|
||||
virtual/pkgconfig
|
||||
"
|
||||
DEPEND="
|
||||
>=dev-libs/protobuf-3:0=[${MULTILIB_USEDEP}]"
|
||||
# NOTE
|
||||
# protobuf links to abseil-cpp libraries via it's .pc files.
|
||||
# To cause rebuild when the abseil-cpp version changes we add it to RDEPEND only.
|
||||
RDEPEND="${DEPEND}
|
||||
dev-cpp/abseil-cpp:=[${MULTILIB_USEDEP}]
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/${PN}-1.5.0-Clean-CMake.patch"
|
||||
"${FILESDIR}/${P}-free-corruption.patch"
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
# Workaround for bug #946366
|
||||
append-flags $(test-flags-CC -fzero-init-padding-bits=unions)
|
||||
|
||||
multilib-minimal_src_configure
|
||||
}
|
||||
|
||||
multilib_src_configure() {
|
||||
local myeconfargs=(
|
||||
$(use_enable static-libs static)
|
||||
--enable-year2038
|
||||
)
|
||||
|
||||
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
|
||||
}
|
||||
|
||||
multilib_src_install_all() {
|
||||
find "${ED}" -name '*.la' -type f -delete || die
|
||||
einstalldocs
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
# Check 'next' branch for backports.
|
||||
|
||||
inherit autotools multilib-minimal
|
||||
|
||||
MY_PV="${PV/_/-}"
|
||||
MY_P="${PN}-${MY_PV}"
|
||||
|
||||
DESCRIPTION="Protocol Buffers implementation in C"
|
||||
HOMEPAGE="https://github.com/protobuf-c/protobuf-c"
|
||||
SRC_URI="
|
||||
https://github.com/${PN}/${PN}/releases/download/v${MY_PV}/${MY_P}.tar.gz
|
||||
https://github.com/protobuf-c/protobuf-c/commit/25174818178d4761f971dab1c47083b892297dc2.patch
|
||||
-> ${PN}-1.5.1-protobuf-30.patch
|
||||
"
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="BSD-2"
|
||||
# Subslot == SONAME version
|
||||
SLOT="0/1.0.0"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
|
||||
IUSE="static-libs"
|
||||
|
||||
BDEPEND="
|
||||
>=dev-libs/protobuf-3:0
|
||||
virtual/pkgconfig
|
||||
"
|
||||
DEPEND="
|
||||
>=dev-libs/protobuf-3:0=[${MULTILIB_USEDEP}]"
|
||||
# NOTE
|
||||
# protobuf links to abseil-cpp libraries via it's .pc files.
|
||||
# To cause rebuild when the abseil-cpp version changes we add it to RDEPEND only.
|
||||
RDEPEND="${DEPEND}
|
||||
dev-cpp/abseil-cpp:=[${MULTILIB_USEDEP}]
|
||||
"
|
||||
|
||||
src_prepare() {
|
||||
if has_version ">=dev-libs/protobuf-30"; then
|
||||
eapply "${DISTDIR}/${PN}-1.5.1-protobuf-30.patch"
|
||||
fi
|
||||
|
||||
default
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
multilib_src_configure() {
|
||||
local myeconfargs=(
|
||||
$(use_enable static-libs static)
|
||||
--enable-year2038
|
||||
)
|
||||
|
||||
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
|
||||
}
|
||||
|
||||
multilib_src_install_all() {
|
||||
find "${ED}" -name '*.la' -type f -delete || die
|
||||
einstalldocs
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user