diff options
| -rw-r--r-- | meta-oe/recipes-devtools/protobuf/protobuf-c/0001-protobuf-c-fix-compile-error-with-protobuf-3.6.0.1.patch | 207 | ||||
| -rw-r--r-- | meta-oe/recipes-devtools/protobuf/protobuf-c_1.3.0.bb | 8 |
2 files changed, 214 insertions, 1 deletions
diff --git a/meta-oe/recipes-devtools/protobuf/protobuf-c/0001-protobuf-c-fix-compile-error-with-protobuf-3.6.0.1.patch b/meta-oe/recipes-devtools/protobuf/protobuf-c/0001-protobuf-c-fix-compile-error-with-protobuf-3.6.0.1.patch new file mode 100644 index 0000000000..e6239ee32e --- /dev/null +++ b/meta-oe/recipes-devtools/protobuf/protobuf-c/0001-protobuf-c-fix-compile-error-with-protobuf-3.6.0.1.patch | |||
| @@ -0,0 +1,207 @@ | |||
| 1 | From fb77cbce29d9ea4d4acbfd6ba72cb1cffabf649a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Changqing Li <changqing.li@windriver.com> | ||
| 3 | Date: Fri, 20 Jul 2018 11:47:53 +0800 | ||
| 4 | Subject: [PATCH] protobuf-c: fix compile error with protobuf 3.6.0.1 | ||
| 5 | |||
| 6 | Upstream-Status: Backport[https://github.com/protobuf-c/protobuf-c/pull/328] | ||
| 7 | |||
| 8 | 1. protoc-c depend on protobuf, from protobuf 3.6.0.1, | ||
| 9 | scoped_array is removed, but protoc-c still use scoped_array, | ||
| 10 | caused compile error. | ||
| 11 | |||
| 12 | 2. fix compile error since missing namespace | ||
| 13 | |||
| 14 | |||
| 15 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
| 16 | --- | ||
| 17 | protoc-c/c_field.cc | 2 +- | ||
| 18 | protoc-c/c_field.h | 2 +- | ||
| 19 | protoc-c/c_file.cc | 8 ++++---- | ||
| 20 | protoc-c/c_file.h | 10 +++++----- | ||
| 21 | protoc-c/c_generator.cc | 12 ++++++------ | ||
| 22 | protoc-c/c_helpers.cc | 4 +++- | ||
| 23 | protoc-c/c_message.cc | 6 +++--- | ||
| 24 | protoc-c/c_message.h | 7 ++++--- | ||
| 25 | 8 files changed, 27 insertions(+), 24 deletions(-) | ||
| 26 | |||
| 27 | diff --git a/protoc-c/c_field.cc b/protoc-c/c_field.cc | ||
| 28 | index 9fa56ef..eaa38d2 100644 | ||
| 29 | --- a/protoc-c/c_field.cc | ||
| 30 | +++ b/protoc-c/c_field.cc | ||
| 31 | @@ -189,7 +189,7 @@ void FieldGenerator::GenerateDescriptorInitializerGeneric(io::Printer* printer, | ||
| 32 | FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor) | ||
| 33 | : descriptor_(descriptor), | ||
| 34 | field_generators_( | ||
| 35 | - new scoped_ptr<FieldGenerator>[descriptor->field_count()]) { | ||
| 36 | + new std::unique_ptr<FieldGenerator>[descriptor->field_count()]) { | ||
| 37 | // Construct all the FieldGenerators. | ||
| 38 | for (int i = 0; i < descriptor->field_count(); i++) { | ||
| 39 | field_generators_[i].reset(MakeGenerator(descriptor->field(i))); | ||
| 40 | diff --git a/protoc-c/c_field.h b/protoc-c/c_field.h | ||
| 41 | index 91f1a03..94b2fad 100644 | ||
| 42 | --- a/protoc-c/c_field.h | ||
| 43 | +++ b/protoc-c/c_field.h | ||
| 44 | @@ -117,7 +117,7 @@ class FieldGeneratorMap { | ||
| 45 | |||
| 46 | private: | ||
| 47 | const Descriptor* descriptor_; | ||
| 48 | - scoped_array<scoped_ptr<FieldGenerator> > field_generators_; | ||
| 49 | + std::unique_ptr<std::unique_ptr<FieldGenerator>[]> field_generators_; | ||
| 50 | |||
| 51 | static FieldGenerator* MakeGenerator(const FieldDescriptor* field); | ||
| 52 | |||
| 53 | diff --git a/protoc-c/c_file.cc b/protoc-c/c_file.cc | ||
| 54 | index 9851768..6dae516 100644 | ||
| 55 | --- a/protoc-c/c_file.cc | ||
| 56 | +++ b/protoc-c/c_file.cc | ||
| 57 | @@ -83,13 +83,13 @@ FileGenerator::FileGenerator(const FileDescriptor* file, | ||
| 58 | const string& dllexport_decl) | ||
| 59 | : file_(file), | ||
| 60 | message_generators_( | ||
| 61 | - new scoped_ptr<MessageGenerator>[file->message_type_count()]), | ||
| 62 | + new std::unique_ptr<MessageGenerator>[file->message_type_count()]), | ||
| 63 | enum_generators_( | ||
| 64 | - new scoped_ptr<EnumGenerator>[file->enum_type_count()]), | ||
| 65 | + new std::unique_ptr<EnumGenerator>[file->enum_type_count()]), | ||
| 66 | service_generators_( | ||
| 67 | - new scoped_ptr<ServiceGenerator>[file->service_count()]), | ||
| 68 | + new std::unique_ptr<ServiceGenerator>[file->service_count()]), | ||
| 69 | extension_generators_( | ||
| 70 | - new scoped_ptr<ExtensionGenerator>[file->extension_count()]) { | ||
| 71 | + new std::unique_ptr<ExtensionGenerator>[file->extension_count()]) { | ||
| 72 | |||
| 73 | for (int i = 0; i < file->message_type_count(); i++) { | ||
| 74 | message_generators_[i].reset( | ||
| 75 | diff --git a/protoc-c/c_file.h b/protoc-c/c_file.h | ||
| 76 | index ed38ce4..adc2841 100644 | ||
| 77 | --- a/protoc-c/c_file.h | ||
| 78 | +++ b/protoc-c/c_file.h | ||
| 79 | @@ -98,13 +98,13 @@ class FileGenerator { | ||
| 80 | private: | ||
| 81 | const FileDescriptor* file_; | ||
| 82 | |||
| 83 | - scoped_array<scoped_ptr<MessageGenerator> > message_generators_; | ||
| 84 | - scoped_array<scoped_ptr<EnumGenerator> > enum_generators_; | ||
| 85 | - scoped_array<scoped_ptr<ServiceGenerator> > service_generators_; | ||
| 86 | - scoped_array<scoped_ptr<ExtensionGenerator> > extension_generators_; | ||
| 87 | + std::unique_ptr<std::unique_ptr<MessageGenerator>[]> message_generators_; | ||
| 88 | + std::unique_ptr<std::unique_ptr<EnumGenerator>[]> enum_generators_; | ||
| 89 | + std::unique_ptr<std::unique_ptr<ServiceGenerator>[]> service_generators_; | ||
| 90 | + std::unique_ptr<std::unique_ptr<ExtensionGenerator>[]> extension_generators_; | ||
| 91 | |||
| 92 | // E.g. if the package is foo.bar, package_parts_ is {"foo", "bar"}. | ||
| 93 | - vector<string> package_parts_; | ||
| 94 | + std::vector<string> package_parts_; | ||
| 95 | |||
| 96 | GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); | ||
| 97 | }; | ||
| 98 | diff --git a/protoc-c/c_generator.cc b/protoc-c/c_generator.cc | ||
| 99 | index a0d0cb6..c46cfe4 100644 | ||
| 100 | --- a/protoc-c/c_generator.cc | ||
| 101 | +++ b/protoc-c/c_generator.cc | ||
| 102 | @@ -80,13 +80,13 @@ namespace c { | ||
| 103 | // "foo=bar,baz,qux=corge" | ||
| 104 | // parses to the pairs: | ||
| 105 | // ("foo", "bar"), ("baz", ""), ("qux", "corge") | ||
| 106 | -void ParseOptions(const string& text, vector<pair<string, string> >* output) { | ||
| 107 | - vector<string> parts; | ||
| 108 | +void ParseOptions(const string& text, std::vector<std::pair<string, string> >* output) { | ||
| 109 | + std::vector<string> parts; | ||
| 110 | SplitStringUsing(text, ",", &parts); | ||
| 111 | |||
| 112 | for (unsigned i = 0; i < parts.size(); i++) { | ||
| 113 | string::size_type equals_pos = parts[i].find_first_of('='); | ||
| 114 | - pair<string, string> value; | ||
| 115 | + std::pair<string, string> value; | ||
| 116 | if (equals_pos == string::npos) { | ||
| 117 | value.first = parts[i]; | ||
| 118 | value.second = ""; | ||
| 119 | @@ -105,7 +105,7 @@ bool CGenerator::Generate(const FileDescriptor* file, | ||
| 120 | const string& parameter, | ||
| 121 | OutputDirectory* output_directory, | ||
| 122 | string* error) const { | ||
| 123 | - vector<pair<string, string> > options; | ||
| 124 | + std::vector<std::pair<string, string> > options; | ||
| 125 | ParseOptions(parameter, &options); | ||
| 126 | |||
| 127 | // ----------------------------------------------------------------- | ||
| 128 | @@ -149,7 +149,7 @@ bool CGenerator::Generate(const FileDescriptor* file, | ||
| 129 | |||
| 130 | // Generate header. | ||
| 131 | { | ||
| 132 | - scoped_ptr<io::ZeroCopyOutputStream> output( | ||
| 133 | + std::unique_ptr<io::ZeroCopyOutputStream> output( | ||
| 134 | output_directory->Open(basename + ".h")); | ||
| 135 | io::Printer printer(output.get(), '$'); | ||
| 136 | file_generator.GenerateHeader(&printer); | ||
| 137 | @@ -157,7 +157,7 @@ bool CGenerator::Generate(const FileDescriptor* file, | ||
| 138 | |||
| 139 | // Generate cc file. | ||
| 140 | { | ||
| 141 | - scoped_ptr<io::ZeroCopyOutputStream> output( | ||
| 142 | + std::unique_ptr<io::ZeroCopyOutputStream> output( | ||
| 143 | output_directory->Open(basename + ".c")); | ||
| 144 | io::Printer printer(output.get(), '$'); | ||
| 145 | file_generator.GenerateSource(&printer); | ||
| 146 | diff --git a/protoc-c/c_helpers.cc b/protoc-c/c_helpers.cc | ||
| 147 | index b79b5b0..f4ef73d 100644 | ||
| 148 | --- a/protoc-c/c_helpers.cc | ||
| 149 | +++ b/protoc-c/c_helpers.cc | ||
| 150 | @@ -86,6 +86,8 @@ namespace c { | ||
| 151 | #pragma warning(disable:4996) | ||
| 152 | #endif | ||
| 153 | |||
| 154 | +using std::vector; | ||
| 155 | + | ||
| 156 | string DotsToUnderscores(const string& name) { | ||
| 157 | return StringReplace(name, ".", "_", true); | ||
| 158 | } | ||
| 159 | @@ -559,7 +561,7 @@ static int CEscapeInternal(const char* src, int src_len, char* dest, | ||
| 160 | } | ||
| 161 | string CEscape(const string& src) { | ||
| 162 | const int dest_length = src.size() * 4 + 1; // Maximum possible expansion | ||
| 163 | - scoped_array<char> dest(new char[dest_length]); | ||
| 164 | + std::unique_ptr<char[]> dest(new char[dest_length]); | ||
| 165 | const int len = CEscapeInternal(src.data(), src.size(), | ||
| 166 | dest.get(), dest_length, false); | ||
| 167 | GOOGLE_DCHECK_GE(len, 0); | ||
| 168 | diff --git a/protoc-c/c_message.cc b/protoc-c/c_message.cc | ||
| 169 | index 6b22c71..85a946e 100755 | ||
| 170 | --- a/protoc-c/c_message.cc | ||
| 171 | +++ b/protoc-c/c_message.cc | ||
| 172 | @@ -83,11 +83,11 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor, | ||
| 173 | : descriptor_(descriptor), | ||
| 174 | dllexport_decl_(dllexport_decl), | ||
| 175 | field_generators_(descriptor), | ||
| 176 | - nested_generators_(new scoped_ptr<MessageGenerator>[ | ||
| 177 | + nested_generators_(new std::unique_ptr<MessageGenerator>[ | ||
| 178 | descriptor->nested_type_count()]), | ||
| 179 | - enum_generators_(new scoped_ptr<EnumGenerator>[ | ||
| 180 | + enum_generators_(new std::unique_ptr<EnumGenerator>[ | ||
| 181 | descriptor->enum_type_count()]), | ||
| 182 | - extension_generators_(new scoped_ptr<ExtensionGenerator>[ | ||
| 183 | + extension_generators_(new std::unique_ptr<ExtensionGenerator>[ | ||
| 184 | descriptor->extension_count()]) { | ||
| 185 | |||
| 186 | for (int i = 0; i < descriptor->nested_type_count(); i++) { | ||
| 187 | diff --git a/protoc-c/c_message.h b/protoc-c/c_message.h | ||
| 188 | index 8b115d1..114c2d0 100644 | ||
| 189 | --- a/protoc-c/c_message.h | ||
| 190 | +++ b/protoc-c/c_message.h | ||
| 191 | @@ -126,9 +126,10 @@ class MessageGenerator { | ||
| 192 | const Descriptor* descriptor_; | ||
| 193 | string dllexport_decl_; | ||
| 194 | FieldGeneratorMap field_generators_; | ||
| 195 | - scoped_array<scoped_ptr<MessageGenerator> > nested_generators_; | ||
| 196 | - scoped_array<scoped_ptr<EnumGenerator> > enum_generators_; | ||
| 197 | - scoped_array<scoped_ptr<ExtensionGenerator> > extension_generators_; | ||
| 198 | + | ||
| 199 | + std::unique_ptr<std::unique_ptr<MessageGenerator>[]> nested_generators_; | ||
| 200 | + std::unique_ptr<std::unique_ptr<EnumGenerator>[]> enum_generators_; | ||
| 201 | + std::unique_ptr<std::unique_ptr<ExtensionGenerator>[]> extension_generators_; | ||
| 202 | |||
| 203 | GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); | ||
| 204 | }; | ||
| 205 | -- | ||
| 206 | 2.7.4 | ||
| 207 | |||
diff --git a/meta-oe/recipes-devtools/protobuf/protobuf-c_1.3.0.bb b/meta-oe/recipes-devtools/protobuf/protobuf-c_1.3.0.bb index 9b696906e8..209bb47e8e 100644 --- a/meta-oe/recipes-devtools/protobuf/protobuf-c_1.3.0.bb +++ b/meta-oe/recipes-devtools/protobuf/protobuf-c_1.3.0.bb | |||
| @@ -15,10 +15,16 @@ DEPENDS = "protobuf-native protobuf" | |||
| 15 | PV .= "+git${SRCPV}" | 15 | PV .= "+git${SRCPV}" |
| 16 | SRCREV = "dac1a65feac4ad72f612aab99f487056fbcf5c1a" | 16 | SRCREV = "dac1a65feac4ad72f612aab99f487056fbcf5c1a" |
| 17 | 17 | ||
| 18 | SRC_URI = "git://github.com/protobuf-c/protobuf-c.git" | 18 | SRC_URI = "git://github.com/protobuf-c/protobuf-c.git \ |
| 19 | file://0001-protobuf-c-fix-compile-error-with-protobuf-3.6.0.1.patch \ | ||
| 20 | " | ||
| 19 | 21 | ||
| 20 | S = "${WORKDIR}/git" | 22 | S = "${WORKDIR}/git" |
| 21 | 23 | ||
| 24 | #make sure c++11 is used | ||
| 25 | CXXFLAGS += "-std=c++11" | ||
| 26 | BUILD_CXXFLAGS += "-std=c++11" | ||
| 27 | |||
| 22 | inherit autotools pkgconfig | 28 | inherit autotools pkgconfig |
| 23 | 29 | ||
| 24 | PACKAGE_BEFORE_PN = "${PN}-compiler" | 30 | PACKAGE_BEFORE_PN = "${PN}-compiler" |
