From d61aede89cf188367766b971f59cf57d7835d8e8 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Tue, 4 Sep 2018 10:58:54 -0700 Subject: Down-integrate from google3. --- src/google/protobuf/type.pb.cc | 289 +++++++++++++++++++++-------------------- 1 file changed, 147 insertions(+), 142 deletions(-) (limited to 'src/google/protobuf/type.pb.cc') diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index de1bd6c9..2d00a8ff 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -13,10 +13,6 @@ #include #include #include -// This is a temporary google only hack -#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS -#include "third_party/protobuf/version.h" -#endif // @@protoc_insertion_point(includes) #include @@ -60,7 +56,7 @@ static void InitDefaultsType_google_2fprotobuf_2ftype_2eproto() { ::google::protobuf::Type::InitAsDefaultInstance(); } -LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<3> scc_info_Type_google_2fprotobuf_2ftype_2eproto = +PROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<3> scc_info_Type_google_2fprotobuf_2ftype_2eproto = {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 3, InitDefaultsType_google_2fprotobuf_2ftype_2eproto}, { &scc_info_Field_google_2fprotobuf_2ftype_2eproto.base, &scc_info_Option_google_2fprotobuf_2ftype_2eproto.base, @@ -77,7 +73,7 @@ static void InitDefaultsField_google_2fprotobuf_2ftype_2eproto() { ::google::protobuf::Field::InitAsDefaultInstance(); } -LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_Field_google_2fprotobuf_2ftype_2eproto = +PROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_Field_google_2fprotobuf_2ftype_2eproto = {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsField_google_2fprotobuf_2ftype_2eproto}, { &scc_info_Option_google_2fprotobuf_2ftype_2eproto.base,}}; @@ -92,7 +88,7 @@ static void InitDefaultsEnum_google_2fprotobuf_2ftype_2eproto() { ::google::protobuf::Enum::InitAsDefaultInstance(); } -LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<3> scc_info_Enum_google_2fprotobuf_2ftype_2eproto = +PROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<3> scc_info_Enum_google_2fprotobuf_2ftype_2eproto = {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 3, InitDefaultsEnum_google_2fprotobuf_2ftype_2eproto}, { &scc_info_EnumValue_google_2fprotobuf_2ftype_2eproto.base, &scc_info_Option_google_2fprotobuf_2ftype_2eproto.base, @@ -109,7 +105,7 @@ static void InitDefaultsEnumValue_google_2fprotobuf_2ftype_2eproto() { ::google::protobuf::EnumValue::InitAsDefaultInstance(); } -LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_EnumValue_google_2fprotobuf_2ftype_2eproto = +PROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_EnumValue_google_2fprotobuf_2ftype_2eproto = {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsEnumValue_google_2fprotobuf_2ftype_2eproto}, { &scc_info_Option_google_2fprotobuf_2ftype_2eproto.base,}}; @@ -124,7 +120,7 @@ static void InitDefaultsOption_google_2fprotobuf_2ftype_2eproto() { ::google::protobuf::Option::InitAsDefaultInstance(); } -LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_Option_google_2fprotobuf_2ftype_2eproto = +PROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<1> scc_info_Option_google_2fprotobuf_2ftype_2eproto = {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsOption_google_2fprotobuf_2ftype_2eproto}, { &scc_info_Any_google_2fprotobuf_2fany_2eproto.base,}}; @@ -140,60 +136,60 @@ void InitDefaults_google_2fprotobuf_2ftype_2eproto() { const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[3]; constexpr ::google::protobuf::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2ftype_2eproto = nullptr; -const ::google::protobuf::uint32 TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { +const ::google::protobuf::uint32 TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, fields_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, oneofs_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, options_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, source_context_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Type, syntax_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, name_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, fields_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, oneofs_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, options_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, source_context_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Type, syntax_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, kind_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, cardinality_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, number_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, type_url_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, oneof_index_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, packed_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, options_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, json_name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Field, default_value_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, kind_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, cardinality_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, number_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, name_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, type_url_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, oneof_index_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, packed_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, options_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, json_name_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Field, default_value_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, enumvalue_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, options_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, source_context_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Enum, syntax_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, name_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, enumvalue_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, options_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, source_context_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Enum, syntax_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValue, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValue, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValue, number_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::EnumValue, options_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, name_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, number_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::EnumValue, options_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Option, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Option, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Option, name_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Option, value_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Option, name_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Option, value_), }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { +static const ::google::protobuf::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, sizeof(::google::protobuf::Type)}, { 11, -1, sizeof(::google::protobuf::Field)}, { 26, -1, sizeof(::google::protobuf::Enum)}, @@ -512,14 +508,13 @@ const char* Type::_InternalParse(const char* begin, const char* end, void* objec while (ptr < end) { ::google::protobuf::uint32 tag; ptr = Varint::Parse32Inline(ptr, &tag); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); switch (tag >> 3) { - case 0: goto error; // string name = 1; case 1: { if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual; ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ctx->extra_parse_data().SetFieldName("google.protobuf.Type.name"); parser_till_end = ::google::protobuf::internal::StringParserUTF8; ::std::string* str = msg->mutable_name(); @@ -527,8 +522,8 @@ const char* Type::_InternalParse(const char* begin, const char* end, void* objec object = str; if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; - ptr = newend; + if (size) ptr = parser_till_end(ptr, newend, object, ctx); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr == newend); break; } // repeated .google.protobuf.Field fields = 2; @@ -536,15 +531,17 @@ const char* Type::_InternalParse(const char* begin, const char* end, void* objec if (static_cast<::google::protobuf::uint8>(tag) != 18) goto handle_unusual; do { ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); parser_till_end = ::google::protobuf::Field::_InternalParse; object = msg->add_fields(); if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; + bool ok = ctx->ParseExactRange({parser_till_end, object}, + ptr, newend); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); ptr = newend; if (ptr >= end) break; - } while((*reinterpret_cast(ptr) & 255) == 18 && (ptr += 1)); + } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 18 && (ptr += 1)); break; } // repeated string oneofs = 3; @@ -552,7 +549,7 @@ const char* Type::_InternalParse(const char* begin, const char* end, void* objec if (static_cast<::google::protobuf::uint8>(tag) != 26) goto handle_unusual; do { ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ctx->extra_parse_data().SetFieldName("google.protobuf.Type.oneofs"); parser_till_end = ::google::protobuf::internal::StringParserUTF8; ::std::string* str = msg->add_oneofs(); @@ -560,10 +557,10 @@ const char* Type::_InternalParse(const char* begin, const char* end, void* objec object = str; if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; - ptr = newend; + if (size) ptr = parser_till_end(ptr, newend, object, ctx); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr == newend); if (ptr >= end) break; - } while((*reinterpret_cast(ptr) & 255) == 26 && (ptr += 1)); + } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 26 && (ptr += 1)); break; } // repeated .google.protobuf.Option options = 4; @@ -571,27 +568,31 @@ const char* Type::_InternalParse(const char* begin, const char* end, void* objec if (static_cast<::google::protobuf::uint8>(tag) != 34) goto handle_unusual; do { ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); parser_till_end = ::google::protobuf::Option::_InternalParse; object = msg->add_options(); if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; + bool ok = ctx->ParseExactRange({parser_till_end, object}, + ptr, newend); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); ptr = newend; if (ptr >= end) break; - } while((*reinterpret_cast(ptr) & 255) == 34 && (ptr += 1)); + } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 34 && (ptr += 1)); break; } // .google.protobuf.SourceContext source_context = 5; case 5: { if (static_cast<::google::protobuf::uint8>(tag) != 42) goto handle_unusual; ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); parser_till_end = ::google::protobuf::SourceContext::_InternalParse; object = msg->mutable_source_context(); if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; + bool ok = ctx->ParseExactRange({parser_till_end, object}, + ptr, newend); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); ptr = newend; break; } @@ -600,15 +601,16 @@ const char* Type::_InternalParse(const char* begin, const char* end, void* objec if (static_cast<::google::protobuf::uint8>(tag) != 48) goto handle_unusual; ::google::protobuf::uint64 val; ptr = Varint::Parse64(ptr, &val); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ::google::protobuf::Syntax value = static_cast<::google::protobuf::Syntax>(val); msg->set_syntax(value); break; } default: { handle_unusual: (void)&&handle_unusual; - if ((tag & 7) == 4) { - if (!ctx->ValidEndGroup(tag)) goto error; + if ((tag & 7) == 4 || tag == 0) { + bool ok = ctx->ValidEndGroup(tag); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); return ptr; } auto res = UnknownFieldParse(tag, {_InternalParse, msg}, @@ -619,8 +621,6 @@ const char* Type::_InternalParse(const char* begin, const char* end, void* objec } // switch } // while return ptr; -error: - return nullptr; len_delim_till_end: (void)&&len_delim_till_end; return ctx->StoreAndTailCall(ptr, end, {_InternalParse, msg}, {parser_till_end, object}, size); @@ -632,7 +632,7 @@ group_continues: (void)&&group_continues; #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool Type::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!GOOGLE_PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:google.protobuf.Type) for (;;) { @@ -1159,15 +1159,14 @@ const char* Field::_InternalParse(const char* begin, const char* end, void* obje while (ptr < end) { ::google::protobuf::uint32 tag; ptr = Varint::Parse32Inline(ptr, &tag); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); switch (tag >> 3) { - case 0: goto error; // .google.protobuf.Field.Kind kind = 1; case 1: { if (static_cast<::google::protobuf::uint8>(tag) != 8) goto handle_unusual; ::google::protobuf::uint64 val; ptr = Varint::Parse64(ptr, &val); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ::google::protobuf::Field_Kind value = static_cast<::google::protobuf::Field_Kind>(val); msg->set_kind(value); break; @@ -1177,7 +1176,7 @@ const char* Field::_InternalParse(const char* begin, const char* end, void* obje if (static_cast<::google::protobuf::uint8>(tag) != 16) goto handle_unusual; ::google::protobuf::uint64 val; ptr = Varint::Parse64(ptr, &val); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ::google::protobuf::Field_Cardinality value = static_cast<::google::protobuf::Field_Cardinality>(val); msg->set_cardinality(value); break; @@ -1187,7 +1186,7 @@ const char* Field::_InternalParse(const char* begin, const char* end, void* obje if (static_cast<::google::protobuf::uint8>(tag) != 24) goto handle_unusual; ::google::protobuf::uint64 val; ptr = Varint::Parse64(ptr, &val); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ::google::protobuf::int32 value = val; msg->set_number(value); break; @@ -1196,7 +1195,7 @@ const char* Field::_InternalParse(const char* begin, const char* end, void* obje case 4: { if (static_cast<::google::protobuf::uint8>(tag) != 34) goto handle_unusual; ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ctx->extra_parse_data().SetFieldName("google.protobuf.Field.name"); parser_till_end = ::google::protobuf::internal::StringParserUTF8; ::std::string* str = msg->mutable_name(); @@ -1204,15 +1203,15 @@ const char* Field::_InternalParse(const char* begin, const char* end, void* obje object = str; if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; - ptr = newend; + if (size) ptr = parser_till_end(ptr, newend, object, ctx); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr == newend); break; } // string type_url = 6; case 6: { if (static_cast<::google::protobuf::uint8>(tag) != 50) goto handle_unusual; ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ctx->extra_parse_data().SetFieldName("google.protobuf.Field.type_url"); parser_till_end = ::google::protobuf::internal::StringParserUTF8; ::std::string* str = msg->mutable_type_url(); @@ -1220,8 +1219,8 @@ const char* Field::_InternalParse(const char* begin, const char* end, void* obje object = str; if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; - ptr = newend; + if (size) ptr = parser_till_end(ptr, newend, object, ctx); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr == newend); break; } // int32 oneof_index = 7; @@ -1229,7 +1228,7 @@ const char* Field::_InternalParse(const char* begin, const char* end, void* obje if (static_cast<::google::protobuf::uint8>(tag) != 56) goto handle_unusual; ::google::protobuf::uint64 val; ptr = Varint::Parse64(ptr, &val); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ::google::protobuf::int32 value = val; msg->set_oneof_index(value); break; @@ -1239,7 +1238,7 @@ const char* Field::_InternalParse(const char* begin, const char* end, void* obje if (static_cast<::google::protobuf::uint8>(tag) != 64) goto handle_unusual; ::google::protobuf::uint64 val; ptr = Varint::Parse64(ptr, &val); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); bool value = val; msg->set_packed(value); break; @@ -1249,22 +1248,24 @@ const char* Field::_InternalParse(const char* begin, const char* end, void* obje if (static_cast<::google::protobuf::uint8>(tag) != 74) goto handle_unusual; do { ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); parser_till_end = ::google::protobuf::Option::_InternalParse; object = msg->add_options(); if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; + bool ok = ctx->ParseExactRange({parser_till_end, object}, + ptr, newend); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); ptr = newend; if (ptr >= end) break; - } while((*reinterpret_cast(ptr) & 255) == 74 && (ptr += 1)); + } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 74 && (ptr += 1)); break; } // string json_name = 10; case 10: { if (static_cast<::google::protobuf::uint8>(tag) != 82) goto handle_unusual; ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ctx->extra_parse_data().SetFieldName("google.protobuf.Field.json_name"); parser_till_end = ::google::protobuf::internal::StringParserUTF8; ::std::string* str = msg->mutable_json_name(); @@ -1272,15 +1273,15 @@ const char* Field::_InternalParse(const char* begin, const char* end, void* obje object = str; if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; - ptr = newend; + if (size) ptr = parser_till_end(ptr, newend, object, ctx); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr == newend); break; } // string default_value = 11; case 11: { if (static_cast<::google::protobuf::uint8>(tag) != 90) goto handle_unusual; ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ctx->extra_parse_data().SetFieldName("google.protobuf.Field.default_value"); parser_till_end = ::google::protobuf::internal::StringParserUTF8; ::std::string* str = msg->mutable_default_value(); @@ -1288,14 +1289,15 @@ const char* Field::_InternalParse(const char* begin, const char* end, void* obje object = str; if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; - ptr = newend; + if (size) ptr = parser_till_end(ptr, newend, object, ctx); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr == newend); break; } default: { handle_unusual: (void)&&handle_unusual; - if ((tag & 7) == 4) { - if (!ctx->ValidEndGroup(tag)) goto error; + if ((tag & 7) == 4 || tag == 0) { + bool ok = ctx->ValidEndGroup(tag); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); return ptr; } auto res = UnknownFieldParse(tag, {_InternalParse, msg}, @@ -1306,8 +1308,6 @@ const char* Field::_InternalParse(const char* begin, const char* end, void* obje } // switch } // while return ptr; -error: - return nullptr; len_delim_till_end: (void)&&len_delim_till_end; return ctx->StoreAndTailCall(ptr, end, {_InternalParse, msg}, {parser_till_end, object}, size); @@ -1319,7 +1319,7 @@ group_continues: (void)&&group_continues; #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool Field::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!GOOGLE_PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:google.protobuf.Field) for (;;) { @@ -2010,14 +2010,13 @@ const char* Enum::_InternalParse(const char* begin, const char* end, void* objec while (ptr < end) { ::google::protobuf::uint32 tag; ptr = Varint::Parse32Inline(ptr, &tag); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); switch (tag >> 3) { - case 0: goto error; // string name = 1; case 1: { if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual; ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ctx->extra_parse_data().SetFieldName("google.protobuf.Enum.name"); parser_till_end = ::google::protobuf::internal::StringParserUTF8; ::std::string* str = msg->mutable_name(); @@ -2025,8 +2024,8 @@ const char* Enum::_InternalParse(const char* begin, const char* end, void* objec object = str; if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; - ptr = newend; + if (size) ptr = parser_till_end(ptr, newend, object, ctx); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr == newend); break; } // repeated .google.protobuf.EnumValue enumvalue = 2; @@ -2034,15 +2033,17 @@ const char* Enum::_InternalParse(const char* begin, const char* end, void* objec if (static_cast<::google::protobuf::uint8>(tag) != 18) goto handle_unusual; do { ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); parser_till_end = ::google::protobuf::EnumValue::_InternalParse; object = msg->add_enumvalue(); if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; + bool ok = ctx->ParseExactRange({parser_till_end, object}, + ptr, newend); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); ptr = newend; if (ptr >= end) break; - } while((*reinterpret_cast(ptr) & 255) == 18 && (ptr += 1)); + } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 18 && (ptr += 1)); break; } // repeated .google.protobuf.Option options = 3; @@ -2050,27 +2051,31 @@ const char* Enum::_InternalParse(const char* begin, const char* end, void* objec if (static_cast<::google::protobuf::uint8>(tag) != 26) goto handle_unusual; do { ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); parser_till_end = ::google::protobuf::Option::_InternalParse; object = msg->add_options(); if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; + bool ok = ctx->ParseExactRange({parser_till_end, object}, + ptr, newend); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); ptr = newend; if (ptr >= end) break; - } while((*reinterpret_cast(ptr) & 255) == 26 && (ptr += 1)); + } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 26 && (ptr += 1)); break; } // .google.protobuf.SourceContext source_context = 4; case 4: { if (static_cast<::google::protobuf::uint8>(tag) != 34) goto handle_unusual; ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); parser_till_end = ::google::protobuf::SourceContext::_InternalParse; object = msg->mutable_source_context(); if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; + bool ok = ctx->ParseExactRange({parser_till_end, object}, + ptr, newend); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); ptr = newend; break; } @@ -2079,15 +2084,16 @@ const char* Enum::_InternalParse(const char* begin, const char* end, void* objec if (static_cast<::google::protobuf::uint8>(tag) != 40) goto handle_unusual; ::google::protobuf::uint64 val; ptr = Varint::Parse64(ptr, &val); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ::google::protobuf::Syntax value = static_cast<::google::protobuf::Syntax>(val); msg->set_syntax(value); break; } default: { handle_unusual: (void)&&handle_unusual; - if ((tag & 7) == 4) { - if (!ctx->ValidEndGroup(tag)) goto error; + if ((tag & 7) == 4 || tag == 0) { + bool ok = ctx->ValidEndGroup(tag); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); return ptr; } auto res = UnknownFieldParse(tag, {_InternalParse, msg}, @@ -2098,8 +2104,6 @@ const char* Enum::_InternalParse(const char* begin, const char* end, void* objec } // switch } // while return ptr; -error: - return nullptr; len_delim_till_end: (void)&&len_delim_till_end; return ctx->StoreAndTailCall(ptr, end, {_InternalParse, msg}, {parser_till_end, object}, size); @@ -2111,7 +2115,7 @@ group_continues: (void)&&group_continues; #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool Enum::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!GOOGLE_PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:google.protobuf.Enum) for (;;) { @@ -2555,14 +2559,13 @@ const char* EnumValue::_InternalParse(const char* begin, const char* end, void* while (ptr < end) { ::google::protobuf::uint32 tag; ptr = Varint::Parse32Inline(ptr, &tag); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); switch (tag >> 3) { - case 0: goto error; // string name = 1; case 1: { if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual; ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ctx->extra_parse_data().SetFieldName("google.protobuf.EnumValue.name"); parser_till_end = ::google::protobuf::internal::StringParserUTF8; ::std::string* str = msg->mutable_name(); @@ -2570,8 +2573,8 @@ const char* EnumValue::_InternalParse(const char* begin, const char* end, void* object = str; if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; - ptr = newend; + if (size) ptr = parser_till_end(ptr, newend, object, ctx); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr == newend); break; } // int32 number = 2; @@ -2579,7 +2582,7 @@ const char* EnumValue::_InternalParse(const char* begin, const char* end, void* if (static_cast<::google::protobuf::uint8>(tag) != 16) goto handle_unusual; ::google::protobuf::uint64 val; ptr = Varint::Parse64(ptr, &val); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ::google::protobuf::int32 value = val; msg->set_number(value); break; @@ -2589,21 +2592,24 @@ const char* EnumValue::_InternalParse(const char* begin, const char* end, void* if (static_cast<::google::protobuf::uint8>(tag) != 26) goto handle_unusual; do { ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); parser_till_end = ::google::protobuf::Option::_InternalParse; object = msg->add_options(); if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; + bool ok = ctx->ParseExactRange({parser_till_end, object}, + ptr, newend); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); ptr = newend; if (ptr >= end) break; - } while((*reinterpret_cast(ptr) & 255) == 26 && (ptr += 1)); + } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 26 && (ptr += 1)); break; } default: { handle_unusual: (void)&&handle_unusual; - if ((tag & 7) == 4) { - if (!ctx->ValidEndGroup(tag)) goto error; + if ((tag & 7) == 4 || tag == 0) { + bool ok = ctx->ValidEndGroup(tag); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); return ptr; } auto res = UnknownFieldParse(tag, {_InternalParse, msg}, @@ -2614,8 +2620,6 @@ const char* EnumValue::_InternalParse(const char* begin, const char* end, void* } // switch } // while return ptr; -error: - return nullptr; len_delim_till_end: (void)&&len_delim_till_end; return ctx->StoreAndTailCall(ptr, end, {_InternalParse, msg}, {parser_till_end, object}, size); @@ -2627,7 +2631,7 @@ group_continues: (void)&&group_continues; #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool EnumValue::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!GOOGLE_PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:google.protobuf.EnumValue) for (;;) { @@ -3023,14 +3027,13 @@ const char* Option::_InternalParse(const char* begin, const char* end, void* obj while (ptr < end) { ::google::protobuf::uint32 tag; ptr = Varint::Parse32Inline(ptr, &tag); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); switch (tag >> 3) { - case 0: goto error; // string name = 1; case 1: { if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual; ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ctx->extra_parse_data().SetFieldName("google.protobuf.Option.name"); parser_till_end = ::google::protobuf::internal::StringParserUTF8; ::std::string* str = msg->mutable_name(); @@ -3038,27 +3041,30 @@ const char* Option::_InternalParse(const char* begin, const char* end, void* obj object = str; if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; - ptr = newend; + if (size) ptr = parser_till_end(ptr, newend, object, ctx); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr == newend); break; } // .google.protobuf.Any value = 2; case 2: { if (static_cast<::google::protobuf::uint8>(tag) != 18) goto handle_unusual; ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); parser_till_end = ::google::protobuf::Any::_InternalParse; object = msg->mutable_value(); if (size > end - ptr) goto len_delim_till_end; auto newend = ptr + size; - if (!ctx->ParseExactRange({parser_till_end, object}, ptr, newend)) goto error; + bool ok = ctx->ParseExactRange({parser_till_end, object}, + ptr, newend); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); ptr = newend; break; } default: { handle_unusual: (void)&&handle_unusual; - if ((tag & 7) == 4) { - if (!ctx->ValidEndGroup(tag)) goto error; + if ((tag & 7) == 4 || tag == 0) { + bool ok = ctx->ValidEndGroup(tag); + GOOGLE_PROTOBUF_PARSER_ASSERT(ok); return ptr; } auto res = UnknownFieldParse(tag, {_InternalParse, msg}, @@ -3069,8 +3075,6 @@ const char* Option::_InternalParse(const char* begin, const char* end, void* obj } // switch } // while return ptr; -error: - return nullptr; len_delim_till_end: (void)&&len_delim_till_end; return ctx->StoreAndTailCall(ptr, end, {_InternalParse, msg}, {parser_till_end, object}, size); @@ -3082,7 +3086,7 @@ group_continues: (void)&&group_continues; #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool Option::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { -#define DO_(EXPRESSION) if (!GOOGLE_PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure +#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:google.protobuf.Option) for (;;) { @@ -3317,22 +3321,23 @@ void Option::InternalSwap(Option* other) { } // namespace google namespace google { namespace protobuf { -template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Type* Arena::CreateMaybeMessage< ::google::protobuf::Type >(Arena* arena) { +template<> PROTOBUF_NOINLINE ::google::protobuf::Type* Arena::CreateMaybeMessage< ::google::protobuf::Type >(Arena* arena) { return Arena::CreateMessageInternal< ::google::protobuf::Type >(arena); } -template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Field* Arena::CreateMaybeMessage< ::google::protobuf::Field >(Arena* arena) { +template<> PROTOBUF_NOINLINE ::google::protobuf::Field* Arena::CreateMaybeMessage< ::google::protobuf::Field >(Arena* arena) { return Arena::CreateMessageInternal< ::google::protobuf::Field >(arena); } -template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Enum* Arena::CreateMaybeMessage< ::google::protobuf::Enum >(Arena* arena) { +template<> PROTOBUF_NOINLINE ::google::protobuf::Enum* Arena::CreateMaybeMessage< ::google::protobuf::Enum >(Arena* arena) { return Arena::CreateMessageInternal< ::google::protobuf::Enum >(arena); } -template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::EnumValue* Arena::CreateMaybeMessage< ::google::protobuf::EnumValue >(Arena* arena) { +template<> PROTOBUF_NOINLINE ::google::protobuf::EnumValue* Arena::CreateMaybeMessage< ::google::protobuf::EnumValue >(Arena* arena) { return Arena::CreateMessageInternal< ::google::protobuf::EnumValue >(arena); } -template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Option* Arena::CreateMaybeMessage< ::google::protobuf::Option >(Arena* arena) { +template<> PROTOBUF_NOINLINE ::google::protobuf::Option* Arena::CreateMaybeMessage< ::google::protobuf::Option >(Arena* arena) { return Arena::CreateMessageInternal< ::google::protobuf::Option >(arena); } } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) +#include -- cgit v1.2.3