aboutsummaryrefslogtreecommitdiff
path: root/contrib/protoc-bnet/google/protobuf
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-01-13 18:25:52 +0100
committerShauren <shauren.trinity@gmail.com>2023-01-13 18:25:52 +0100
commit68d079e4a32ae525b236f956e8fc88c35eb8e24b (patch)
tree9226a44caa0c6bb0d82f6d74d88b249eeddeb819 /contrib/protoc-bnet/google/protobuf
parent3f1816d4076a9dfc65adae3109bf504e35f21003 (diff)
Contrib: Adjust protobuf generator for latest include cleaned up output
Diffstat (limited to 'contrib/protoc-bnet/google/protobuf')
-rw-r--r--contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_enum_field.cc3
-rw-r--r--contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_primitive_field.cc2
2 files changed, 3 insertions, 2 deletions
diff --git a/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_enum_field.cc b/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_enum_field.cc
index ea15fd74744..de39a9fc54f 100644
--- a/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_enum_field.cc
+++ b/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_enum_field.cc
@@ -285,7 +285,8 @@ GenerateSwappingCode(io::Printer* printer) const {
void RepeatedEnumFieldGenerator::
GenerateConstructorCode(io::Printer* printer) const {
- if (descriptor_->options().packed()) {
+ if (descriptor_->options().packed()
+ && HasGeneratedMethods(descriptor_->file())) {
printer->Print(variables_, "_$name$_cached_byte_size_ = 0;\n");
}
}
diff --git a/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_primitive_field.cc b/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_primitive_field.cc
index 244a7f178d9..3e2cf0a50ce 100644
--- a/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_primitive_field.cc
+++ b/contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_primitive_field.cc
@@ -335,7 +335,7 @@ GenerateSwappingCode(io::Printer* printer) const {
void RepeatedPrimitiveFieldGenerator::
GenerateConstructorCode(io::Printer* printer) const {
- if (descriptor_->options().packed()) {
+ if (descriptor_->options().packed() && HasGeneratedMethods(descriptor_->file())) {
printer->Print(variables_, "_$name$_cached_byte_size_ = 0;\n");
}
}