diff options
Diffstat (limited to 'src/google/protobuf/struct.pb.cc')
-rw-r--r-- | src/google/protobuf/struct.pb.cc | 137 |
1 files changed, 76 insertions, 61 deletions
diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 4294f407..10e33ca2 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -13,10 +13,6 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> -// This is a temporary google only hack -#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS -#include "third_party/protobuf/version.h" -#endif // @@protoc_insertion_point(includes) #include <google/protobuf/port_def.inc> @@ -75,7 +71,7 @@ static void InitDefaultsListValue_google_2fprotobuf_2fstruct_2eproto() { ::google::protobuf::ListValue::InitAsDefaultInstance(); } -LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_ListValue_google_2fprotobuf_2fstruct_2eproto = +PROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_ListValue_google_2fprotobuf_2fstruct_2eproto = {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsListValue_google_2fprotobuf_2fstruct_2eproto}, {}}; void InitDefaults_google_2fprotobuf_2fstruct_2eproto() { @@ -86,26 +82,26 @@ void InitDefaults_google_2fprotobuf_2fstruct_2eproto() { const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fstruct_2eproto[1]; constexpr ::google::protobuf::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fstruct_2eproto = nullptr; -const ::google::protobuf::uint32 TableStruct_google_2fprotobuf_2fstruct_2eproto::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, _internal_metadata_), +const ::google::protobuf::uint32 TableStruct_google_2fprotobuf_2fstruct_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + PROTOBUF_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, _has_bits_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, key_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, value_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, key_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, value_), 0, 1, ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Struct, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct, fields_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Struct, fields_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Value, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Value, _internal_metadata_), ~0u, // no _extensions_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Value, _oneof_case_[0]), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Value, _oneof_case_[0]), ~0u, // no _weak_field_map_ offsetof(::google::protobuf::ValueDefaultTypeInternal, null_value_), offsetof(::google::protobuf::ValueDefaultTypeInternal, number_value_), @@ -113,15 +109,15 @@ const ::google::protobuf::uint32 TableStruct_google_2fprotobuf_2fstruct_2eproto: offsetof(::google::protobuf::ValueDefaultTypeInternal, bool_value_), offsetof(::google::protobuf::ValueDefaultTypeInternal, struct_value_), offsetof(::google::protobuf::ValueDefaultTypeInternal, list_value_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Value, kind_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::Value, kind_), ~0u, // no _has_bits_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ListValue, _internal_metadata_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::ListValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ListValue, values_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::ListValue, values_), }; -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, 7, sizeof(::google::protobuf::Struct_FieldsEntry_DoNotUse)}, { 9, -1, sizeof(::google::protobuf::Struct)}, { 15, -1, sizeof(::google::protobuf::Value)}, @@ -207,7 +203,22 @@ void Struct_FieldsEntry_DoNotUse::MergeFrom( } #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER -const char* Struct_FieldsEntry_DoNotUse::_InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx) { return end; } +bool Struct_FieldsEntry_DoNotUse::_ParseMap(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx) { + using MF = ::google::protobuf::internal::MapField< + Struct_FieldsEntry_DoNotUse, EntryKeyType, EntryValueType, + kEntryKeyFieldType, kEntryValueFieldType, + kEntryDefaultEnumValue>; + auto mf = static_cast<MF*>(object); + Parser<MF, ::google::protobuf::Map<EntryKeyType, EntryValueType>> parser(mf); +#define DO_(x) if (!(x)) return false + DO_(parser.ParseMap(begin, end)); + DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( + parser.key().data(), static_cast<int>(parser.key().length()), + ::google::protobuf::internal::WireFormatLite::PARSE, + "google.protobuf.Struct.FieldsEntry.key")); +#undef DO_ + return true; +} #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER @@ -294,29 +305,32 @@ const char* Struct::_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; // map<string, .google.protobuf.Value> fields = 1; case 1: { if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual; do { ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; - parser_till_end = ::google::protobuf::Struct_FieldsEntry_DoNotUse::_InternalParse; - object = msg->mutable_fields(); + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); + parser_till_end = ::google::protobuf::internal::SlowMapEntryParser; + auto parse_map = ::google::protobuf::Struct_FieldsEntry_DoNotUse::_ParseMap; + ctx->extra_parse_data().payload.clear(); + ctx->extra_parse_data().parse_map = parse_map; + object = &msg->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; + GOOGLE_PROTOBUF_PARSER_ASSERT(parse_map(ptr, newend, object, ctx)); ptr = newend; if (ptr >= end) break; - } while((*reinterpret_cast<const ::google::protobuf::uint64*>(ptr) & 255) == 10 && (ptr += 1)); + } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 10 && (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}, @@ -327,8 +341,6 @@ const char* Struct::_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); @@ -340,7 +352,7 @@ group_continues: (void)&&group_continues; #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool Struct::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.Struct) for (;;) { @@ -842,15 +854,14 @@ const char* Value::_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.NullValue null_value = 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::NullValue value = static_cast<::google::protobuf::NullValue>(val); msg->set_null_value(value); break; @@ -868,7 +879,7 @@ const char* Value::_InternalParse(const char* begin, const char* end, void* obje case 3: { if (static_cast<::google::protobuf::uint8>(tag) != 26) goto handle_unusual; ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); ctx->extra_parse_data().SetFieldName("google.protobuf.Value.string_value"); parser_till_end = ::google::protobuf::internal::StringParserUTF8; ::std::string* str = msg->mutable_string_value(); @@ -876,8 +887,8 @@ const char* Value::_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; } // bool bool_value = 4; @@ -885,7 +896,7 @@ const char* Value::_InternalParse(const char* begin, const char* end, void* obje if (static_cast<::google::protobuf::uint8>(tag) != 32) 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_bool_value(value); break; @@ -894,12 +905,14 @@ const char* Value::_InternalParse(const char* begin, const char* end, void* obje 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::Struct::_InternalParse; object = msg->mutable_struct_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; } @@ -907,19 +920,22 @@ const char* Value::_InternalParse(const char* begin, const char* end, void* obje 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); parser_till_end = ::google::protobuf::ListValue::_InternalParse; object = msg->mutable_list_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}, @@ -930,8 +946,6 @@ const char* Value::_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); @@ -943,7 +957,7 @@ group_continues: (void)&&group_continues; #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool Value::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.Value) for (;;) { @@ -1404,29 +1418,31 @@ const char* ListValue::_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; // repeated .google.protobuf.Value values = 1; case 1: { if (static_cast<::google::protobuf::uint8>(tag) != 10) goto handle_unusual; do { ptr = Varint::Parse32Inline(ptr, &size); - if (!ptr) goto error; + GOOGLE_PROTOBUF_PARSER_ASSERT(ptr); parser_till_end = ::google::protobuf::Value::_InternalParse; object = msg->add_values(); 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<const ::google::protobuf::uint64*>(ptr) & 255) == 10 && (ptr += 1)); + } while ((::google::protobuf::io::UnalignedLoad<::google::protobuf::uint64>(ptr) & 255) == 10 && (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}, @@ -1437,8 +1453,6 @@ const char* ListValue::_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); @@ -1450,7 +1464,7 @@ group_continues: (void)&&group_continues; #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool ListValue::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.ListValue) for (;;) { @@ -1643,19 +1657,20 @@ void ListValue::InternalSwap(ListValue* other) { } // namespace google namespace google { namespace protobuf { -template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Struct_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage< ::google::protobuf::Struct_FieldsEntry_DoNotUse >(Arena* arena) { +template<> PROTOBUF_NOINLINE ::google::protobuf::Struct_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage< ::google::protobuf::Struct_FieldsEntry_DoNotUse >(Arena* arena) { return Arena::CreateMessageInternal< ::google::protobuf::Struct_FieldsEntry_DoNotUse >(arena); } -template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Struct* Arena::CreateMaybeMessage< ::google::protobuf::Struct >(Arena* arena) { +template<> PROTOBUF_NOINLINE ::google::protobuf::Struct* Arena::CreateMaybeMessage< ::google::protobuf::Struct >(Arena* arena) { return Arena::CreateMessageInternal< ::google::protobuf::Struct >(arena); } -template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Value* Arena::CreateMaybeMessage< ::google::protobuf::Value >(Arena* arena) { +template<> PROTOBUF_NOINLINE ::google::protobuf::Value* Arena::CreateMaybeMessage< ::google::protobuf::Value >(Arena* arena) { return Arena::CreateMessageInternal< ::google::protobuf::Value >(arena); } -template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::ListValue* Arena::CreateMaybeMessage< ::google::protobuf::ListValue >(Arena* arena) { +template<> PROTOBUF_NOINLINE ::google::protobuf::ListValue* Arena::CreateMaybeMessage< ::google::protobuf::ListValue >(Arena* arena) { return Arena::CreateMessageInternal< ::google::protobuf::ListValue >(arena); } } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) +#include <google/protobuf/port_undef.inc> |