diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc index 424c0f80aa..478fc16a94 100644 --- a/src/google/protobuf/compiler/cpp/message.cc +++ b/src/google/protobuf/compiler/cpp/message.cc @@ -4124,13 +4124,11 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) { for (int j = 0; j < chunk.size(); j++) { const FieldDescriptor* field = chunk[j]; bool have_enclosing_if = false; - bool need_extra_newline = false; PrintFieldComment(format, field); if (field->is_repeated()) { // No presence check is required. - need_extra_newline = true; } else if (HasHasbit(field)) { PrintPresenceCheck(field, has_bit_indices_, p, &cached_has_word_index); have_enclosing_if = true; @@ -4150,9 +4148,6 @@ void MessageGenerator::GenerateByteSize(io::Printer* p) { "}\n" "\n"); } - if (need_extra_newline) { - format("\n"); - } } if (have_outer_if) { diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index ca4479eaff..534389f4bc 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -827,14 +827,12 @@ const ::_pbi::TcParseTable<3, 4, 2, 79, 2> CodeGeneratorRequest::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( _internal_file_to_generate().Get(i)); } - // repeated .google.protobuf.FileDescriptorProto proto_file = 15; total_size += 1UL * this->_internal_proto_file_size(); for (const auto& msg : this->_internal_proto_file()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x00000003u) { // optional string parameter = 2; @@ -1457,7 +1455,6 @@ const ::_pbi::TcParseTable<2, 3, 1, 60, 2> CodeGeneratorResponse::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x00000003u) { // optional string error = 1; diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 62a3e21723..f04d4f017b 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -2106,7 +2106,6 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> FileDescriptorSet::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -2605,35 +2604,30 @@ constexpr ::_pbi::TcParseTable<4, 13, 6, 86, 2> FileDescriptorProto::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( _internal_dependency().Get(i)); } - // repeated .google.protobuf.DescriptorProto message_type = 4; total_size += 1UL * this->_internal_message_type_size(); for (const auto& msg : this->_internal_message_type()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated .google.protobuf.EnumDescriptorProto enum_type = 5; total_size += 1UL * this->_internal_enum_type_size(); for (const auto& msg : this->_internal_enum_type()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated .google.protobuf.ServiceDescriptorProto service = 6; total_size += 1UL * this->_internal_service_size(); for (const auto& msg : this->_internal_service()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated .google.protobuf.FieldDescriptorProto extension = 7; total_size += 1UL * this->_internal_extension_size(); for (const auto& msg : this->_internal_extension()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated int32 public_dependency = 10; { std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( @@ -2644,7 +2638,6 @@ constexpr ::_pbi::TcParseTable<4, 13, 6, 86, 2> FileDescriptorProto::_table_ = { ; total_size += tag_size + data_size; } - // repeated int32 weak_dependency = 11; { std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( @@ -2655,7 +2648,6 @@ constexpr ::_pbi::TcParseTable<4, 13, 6, 86, 2> FileDescriptorProto::_table_ = { ; total_size += tag_size + data_size; } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x0000003fu) { // optional string name = 1; @@ -3635,56 +3627,48 @@ constexpr ::_pbi::TcParseTable<4, 10, 8, 65, 2> DescriptorProto::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated .google.protobuf.DescriptorProto nested_type = 3; total_size += 1UL * this->_internal_nested_type_size(); for (const auto& msg : this->_internal_nested_type()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated .google.protobuf.EnumDescriptorProto enum_type = 4; total_size += 1UL * this->_internal_enum_type_size(); for (const auto& msg : this->_internal_enum_type()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; total_size += 1UL * this->_internal_extension_range_size(); for (const auto& msg : this->_internal_extension_range()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated .google.protobuf.FieldDescriptorProto extension = 6; total_size += 1UL * this->_internal_extension_size(); for (const auto& msg : this->_internal_extension()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; total_size += 1UL * this->_internal_oneof_decl_size(); for (const auto& msg : this->_internal_oneof_decl()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; total_size += 1UL * this->_internal_reserved_range_size(); for (const auto& msg : this->_internal_reserved_range()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated string reserved_name = 10; total_size += 1 * ::google::protobuf::internal::FromIntSize(_internal_reserved_name().size()); for (int i = 0, n = _internal_reserved_name().size(); i < n; ++i) { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( _internal_reserved_name().Get(i)); } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x00000003u) { // optional string name = 1; @@ -4352,14 +4336,12 @@ constexpr ::_pbi::TcParseTable<1, 3, 3, 0, 7> ExtensionRangeOptions::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; total_size += 2UL * this->_internal_uninterpreted_option_size(); for (const auto& msg : this->_internal_uninterpreted_option()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // optional .google.protobuf.ExtensionRangeOptions.VerificationState verification = 3 [default = UNVERIFIED]; cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x00000001u) { @@ -5742,21 +5724,18 @@ constexpr ::_pbi::TcParseTable<3, 5, 3, 61, 2> EnumDescriptorProto::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; total_size += 1UL * this->_internal_reserved_range_size(); for (const auto& msg : this->_internal_reserved_range()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // repeated string reserved_name = 5; total_size += 1 * ::google::protobuf::internal::FromIntSize(_internal_reserved_name().size()); for (int i = 0, n = _internal_reserved_name().size(); i < n; ++i) { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( _internal_reserved_name().Get(i)); } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x00000003u) { // optional string name = 1; @@ -6338,7 +6317,6 @@ constexpr ::_pbi::TcParseTable<2, 3, 2, 51, 2> ServiceDescriptorProto::_table_ = total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x00000003u) { // optional string name = 1; @@ -7538,7 +7516,6 @@ constexpr ::_pbi::TcParseTable<5, 21, 2, 202, 12> FileOptions::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x000000ffu) { // optional string java_package = 1; @@ -8049,7 +8026,6 @@ constexpr ::_pbi::TcParseTable<3, 6, 1, 0, 7> MessageOptions::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x0000001fu) { // optional bool message_set_wire_format = 1 [default = false]; @@ -8522,14 +8498,12 @@ constexpr ::_pbi::TcParseTable<4, 12, 6, 0, 7> FieldOptions::_table_ = { total_size += data_size; total_size += std::size_t{2} * count; } - // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; total_size += 2UL * this->_internal_uninterpreted_option_size(); for (const auto& msg : this->_internal_uninterpreted_option()) { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x000000ffu) { // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING]; @@ -8826,7 +8800,6 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 7> OneofOptions::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -9088,7 +9061,6 @@ constexpr ::_pbi::TcParseTable<3, 4, 1, 0, 7> EnumOptions::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x00000007u) { // optional bool allow_alias = 2; @@ -9346,7 +9318,6 @@ constexpr ::_pbi::TcParseTable<2, 2, 1, 0, 7> EnumValueOptions::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // optional bool deprecated = 1 [default = false]; cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x00000001u) { @@ -9578,7 +9549,6 @@ constexpr ::_pbi::TcParseTable<2, 2, 1, 0, 12> ServiceOptions::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - // optional bool deprecated = 33 [default = false]; cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x00000001u) { @@ -9835,7 +9805,6 @@ constexpr ::_pbi::TcParseTable<2, 3, 2, 0, 12> MethodOptions::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x00000003u) { // optional bool deprecated = 33 [default = false]; @@ -10464,7 +10433,6 @@ constexpr ::_pbi::TcParseTable<3, 7, 1, 75, 2> UninterpretedOption::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x0000003fu) { // optional string identifier_value = 3; @@ -10846,7 +10814,6 @@ constexpr ::_pbi::TcParseTable<3, 5, 0, 106, 2> SourceCodeInfo_Location::_table_ ; total_size += tag_size + data_size; } - // repeated int32 span = 2 [packed = true]; { std::size_t data_size = ::_pbi::WireFormatLite::Int32Size( @@ -10860,14 +10827,12 @@ constexpr ::_pbi::TcParseTable<3, 5, 0, 106, 2> SourceCodeInfo_Location::_table_ ; total_size += tag_size + data_size; } - // repeated string leading_detached_comments = 6; total_size += 1 * ::google::protobuf::internal::FromIntSize(_internal_leading_detached_comments().size()); for (int i = 0, n = _internal_leading_detached_comments().size(); i < n; ++i) { total_size += ::google::protobuf::internal::WireFormatLite::StringSize( _internal_leading_detached_comments().Get(i)); } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x00000003u) { // optional string leading_comments = 3; @@ -11073,7 +11038,6 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> SourceCodeInfo::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -11363,7 +11327,6 @@ constexpr ::_pbi::TcParseTable<3, 5, 1, 64, 2> GeneratedCodeInfo_Annotation::_ta ; total_size += tag_size + data_size; } - cached_has_bits = _impl_._has_bits_[0]; if (cached_has_bits & 0x0000000fu) { // optional string source_file = 2; @@ -11587,7 +11550,6 @@ constexpr ::_pbi::TcParseTable<0, 1, 1, 0, 2> GeneratedCodeInfo::_table_ = { total_size += ::google::protobuf::internal::WireFormatLite::MessageSize(msg); } - return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); }