From 68d079e4a32ae525b236f956e8fc88c35eb8e24b Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 13 Jan 2023 18:25:52 +0100 Subject: Contrib: Adjust protobuf generator for latest include cleaned up output --- contrib/protoc-bnet/google/protobuf/compiler/cpp/cpp_enum_field.cc | 3 ++- .../protoc-bnet/google/protobuf/compiler/cpp/cpp_primitive_field.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'contrib/protoc-bnet/google/protobuf/compiler') 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"); } } -- cgit v1.2.3