diff --git a/csharp/src/Google.Protobuf.Test/Reflection/FeatureSetDescriptorTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/FeatureSetDescriptorTest.cs index fcc24346fcf6a..50d29c6c7f84c 100644 --- a/csharp/src/Google.Protobuf.Test/Reflection/FeatureSetDescriptorTest.cs +++ b/csharp/src/Google.Protobuf.Test/Reflection/FeatureSetDescriptorTest.cs @@ -18,7 +18,8 @@ public class FeatureSetDescriptorTest { // Canonical serialized form of the edition defaults, generated by embed_edition_defaults. // TODO: Update this automatically. - private const string DefaultsBase64 = "CrEBEqsBCAEQAhgCIAMoATAC6vAEMQj+//////////8BEAEYASABKAEwATgBQAFIAVABWABlzcyMP2oAcAB4AYIBBDIwMjPy8AQxCP7//////////wEQARgBIAEoATABOAFAAUgBUAFYAGXNzIw/agBwAHgBggEEMjAyM/rwBDEI/v//////////ARABGAEgASgBMAE4AUABSAFQAVgAZc3MjD9qAHAAeAGCAQQyMDIzGOYHCrEBEqsBCAIQARgBIAIoATAB6vAEMQj9//////////8BEAEYASABKAEwATgBQAFIAVABWABlzcyMP2oAcAB4AYIBBDIwMjPy8AQxCP3//////////wEQARgBIAEoATABOAFAAUgBUAFYAGXNzIw/agBwAHgBggEEMjAyM/rwBDEI/f//////////ARABGAEgASgBMAE4AUABSAFQAVgAZc3MjD9qAHAAeAGCAQQyMDIzGOcHCsMBEr0BCAEQARgBIAIoATAB6vAENwgBEAEYASABKAEwATgBQAFIAVABWABlzcyMP2oPCAEQAR0AAMA/IgQyMDIzcAF4AYIBBDIwMjPy8AQ3CAEQARgBIAEoATABOAFAAUgBUAFYAGXNzIw/ag8IARABHQAAwD8iBDIwMjNwAXgBggEEMjAyM/rwBDcIARABGAEgASgBMAE4AUABSAFQAVgAZc3MjD9qDwgBEAEdAADAPyIEMjAyM3ABeAGCAQQyMDIzGOgHIOgHKOgH"; + private const string DefaultsBase64 = + "ChMY5gciDAgBEAIYAiADKAEwAioAChMY5wciDAgCEAEYASACKAEwASoAChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH"; [Test] [TestCase(Edition.Proto2)] @@ -29,7 +30,11 @@ public void DefaultsMatchCanonicalSerializedForm(Edition edition) var canonicalDefaults = FeatureSetDefaults.Parser .WithDiscardUnknownFields(true) // Discard language-specific extensions. .ParseFrom(Convert.FromBase64String(DefaultsBase64)); - var canonicalEditionDefaults = canonicalDefaults.Defaults.Single(def => def.Edition == edition).Features; + var canonicalEditionDefaults = new FeatureSet(); + canonicalEditionDefaults.MergeFrom( + canonicalDefaults.Defaults.Single(def => def.Edition == edition).FixedFeatures); + canonicalEditionDefaults.MergeFrom( + canonicalDefaults.Defaults.Single(def => def.Edition == edition).OverridableFeatures); var candidateEditionDefaults = FeatureSetDescriptor.GetEditionDefaults(edition).Proto; Assert.AreEqual(canonicalEditionDefaults, candidateEditionDefaults); diff --git a/src/google/protobuf/compiler/code_generator_unittest.cc b/src/google/protobuf/compiler/code_generator_unittest.cc index 1e62d5db5c08a..c88bb5309212e 100644 --- a/src/google/protobuf/compiler/code_generator_unittest.cc +++ b/src/google/protobuf/compiler/code_generator_unittest.cc @@ -271,14 +271,6 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaults) { EXPECT_THAT(generator.BuildFeatureSetDefaults(), IsOkAndHolds(EqualsProto(R"pb( defaults { - features { - field_presence: EXPLICIT - enum_type: CLOSED - repeated_field_encoding: EXPANDED - utf8_validation: NONE - message_encoding: LENGTH_PREFIXED - json_format: LEGACY_BEST_EFFORT - } edition: EDITION_PROTO2 overridable_features {} fixed_features { @@ -291,14 +283,6 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaults) { } } defaults { - features { - field_presence: IMPLICIT - enum_type: OPEN - repeated_field_encoding: PACKED - utf8_validation: VERIFY - message_encoding: LENGTH_PREFIXED - json_format: ALLOW - } edition: EDITION_PROTO3 overridable_features {} fixed_features { @@ -311,14 +295,6 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaults) { } } defaults { - features { - field_presence: EXPLICIT - enum_type: OPEN - repeated_field_encoding: PACKED - utf8_validation: VERIFY - message_encoding: LENGTH_PREFIXED - json_format: ALLOW - } edition: EDITION_2023 overridable_features { field_presence: EXPLICIT diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index 8318bda0b83f5..6a2db03bafda3 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -1865,14 +1865,6 @@ TEST_F(CommandLineInterfaceTest, EditionDefaults) { FeatureSetDefaults defaults = ReadEditionDefaults("defaults"); EXPECT_THAT(defaults, EqualsProto(R"pb( defaults { - features { - field_presence: EXPLICIT - enum_type: CLOSED - repeated_field_encoding: EXPANDED - utf8_validation: NONE - message_encoding: LENGTH_PREFIXED - json_format: LEGACY_BEST_EFFORT - } edition: EDITION_PROTO2 overridable_features {} fixed_features { @@ -1885,14 +1877,6 @@ TEST_F(CommandLineInterfaceTest, EditionDefaults) { } } defaults { - features { - field_presence: IMPLICIT - enum_type: OPEN - repeated_field_encoding: PACKED - utf8_validation: VERIFY - message_encoding: LENGTH_PREFIXED - json_format: ALLOW - } edition: EDITION_PROTO3 overridable_features {} fixed_features { @@ -1905,14 +1889,6 @@ TEST_F(CommandLineInterfaceTest, EditionDefaults) { } } defaults { - features { - field_presence: EXPLICIT - enum_type: OPEN - repeated_field_encoding: PACKED - utf8_validation: VERIFY - message_encoding: LENGTH_PREFIXED - json_format: ALLOW - } edition: EDITION_2023 overridable_features { field_presence: EXPLICIT @@ -1941,14 +1917,6 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMaximum) { FeatureSetDefaults defaults = ReadEditionDefaults("defaults"); EXPECT_THAT(defaults, EqualsProto(R"pb( defaults { - features { - field_presence: EXPLICIT - enum_type: CLOSED - repeated_field_encoding: EXPANDED - utf8_validation: NONE - message_encoding: LENGTH_PREFIXED - json_format: LEGACY_BEST_EFFORT - } edition: EDITION_PROTO2 overridable_features {} fixed_features { @@ -1961,14 +1929,6 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMaximum) { } } defaults { - features { - field_presence: IMPLICIT - enum_type: OPEN - repeated_field_encoding: PACKED - utf8_validation: VERIFY - message_encoding: LENGTH_PREFIXED - json_format: ALLOW - } edition: EDITION_PROTO3 overridable_features {} fixed_features { @@ -1981,14 +1941,6 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMaximum) { } } defaults { - features { - field_presence: EXPLICIT - enum_type: OPEN - repeated_field_encoding: PACKED - utf8_validation: VERIFY - message_encoding: LENGTH_PREFIXED - json_format: ALLOW - } edition: EDITION_2023 overridable_features { field_presence: EXPLICIT @@ -2018,14 +1970,6 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMinimum) { FeatureSetDefaults defaults = ReadEditionDefaults("defaults"); EXPECT_THAT(defaults, EqualsProto(R"pb( defaults { - features { - field_presence: EXPLICIT - enum_type: CLOSED - repeated_field_encoding: EXPANDED - utf8_validation: NONE - message_encoding: LENGTH_PREFIXED - json_format: LEGACY_BEST_EFFORT - } edition: EDITION_PROTO2 overridable_features {} fixed_features { @@ -2038,14 +1982,6 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMinimum) { } } defaults { - features { - field_presence: IMPLICIT - enum_type: OPEN - repeated_field_encoding: PACKED - utf8_validation: VERIFY - message_encoding: LENGTH_PREFIXED - json_format: ALLOW - } edition: EDITION_PROTO3 overridable_features {} fixed_features { @@ -2058,14 +1994,6 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMinimum) { } } defaults { - features { - field_presence: EXPLICIT - enum_type: OPEN - repeated_field_encoding: PACKED - utf8_validation: VERIFY - message_encoding: LENGTH_PREFIXED - json_format: ALLOW - } edition: EDITION_2023 overridable_features { field_presence: EXPLICIT diff --git a/src/google/protobuf/cpp_edition_defaults.h b/src/google/protobuf/cpp_edition_defaults.h index dc048d16c66ad..f5e1d7667590b 100644 --- a/src/google/protobuf/cpp_edition_defaults.h +++ b/src/google/protobuf/cpp_edition_defaults.h @@ -5,7 +5,7 @@ // the C++ runtime. This is used for feature resolution under Editions. // NOLINTBEGIN // clang-format off -#define PROTOBUF_INTERNAL_CPP_EDITION_DEFAULTS "\n2\022\023\010\001\020\002\030\002 \003(\0010\002\302>\004\010\001\020\003\030\346\007\"\003\302>\000*\023\010\001\020\002\030\002 \003(\0010\002\302>\004\010\001\020\003\n2\022\023\010\002\020\001\030\001 \002(\0010\001\302>\004\010\000\020\003\030\347\007\"\003\302>\000*\023\010\002\020\001\030\001 \002(\0010\001\302>\004\010\000\020\003\n2\022\023\010\001\020\001\030\001 \002(\0010\001\302>\004\010\000\020\003\030\350\007\"\023\010\001\020\001\030\001 \002(\0010\001\302>\004\010\000\020\003*\003\302>\000\n2\022\023\010\001\020\001\030\001 \002(\0010\001\302>\004\010\000\020\001\030\351\007\"\023\010\001\020\001\030\001 \002(\0010\001\302>\004\010\000\020\001*\003\302>\000 \346\007(\351\007" +#define PROTOBUF_INTERNAL_CPP_EDITION_DEFAULTS "\n\035\030\346\007\"\003\302>\000*\023\010\001\020\002\030\002 \003(\0010\002\302>\004\010\001\020\003\n\035\030\347\007\"\003\302>\000*\023\010\002\020\001\030\001 \002(\0010\001\302>\004\010\000\020\003\n\035\030\350\007\"\023\010\001\020\001\030\001 \002(\0010\001\302>\004\010\000\020\003*\003\302>\000\n\035\030\351\007\"\023\010\001\020\001\030\001 \002(\0010\001\302>\004\010\000\020\001*\003\302>\000 \346\007(\351\007" // clang-format on // NOLINTEND diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index ca201dbd3d43f..683bd019cfed4 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -372,7 +372,6 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT inline constexpr FeatureSetDefaults_FeatureSetEditionDefault::Impl_::Impl_( ::_pbi::ConstantInitialized) noexcept : _cached_size_{0}, - features_{nullptr}, overridable_features_{nullptr}, fixed_features_{nullptr}, edition_{static_cast< ::google::protobuf::Edition >(0)} {} @@ -1567,11 +1566,9 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault, _impl_.edition_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault, _impl_.overridable_features_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault, _impl_.fixed_features_), - PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault, _impl_.features_), - 3, - 1, 2, 0, + 1, PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSetDefaults, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSetDefaults, _internal_metadata_), ~0u, // no _extensions_ @@ -1671,12 +1668,12 @@ static const ::_pbi::MigrationSchema {463, 473, -1, sizeof(::google::protobuf::UninterpretedOption_NamePart)}, {475, 490, -1, sizeof(::google::protobuf::UninterpretedOption)}, {497, 511, -1, sizeof(::google::protobuf::FeatureSet)}, - {517, 529, -1, sizeof(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault)}, - {533, 544, -1, sizeof(::google::protobuf::FeatureSetDefaults)}, - {547, 560, -1, sizeof(::google::protobuf::SourceCodeInfo_Location)}, - {565, -1, -1, sizeof(::google::protobuf::SourceCodeInfo)}, - {574, 587, -1, sizeof(::google::protobuf::GeneratedCodeInfo_Annotation)}, - {592, -1, -1, sizeof(::google::protobuf::GeneratedCodeInfo)}, + {517, 528, -1, sizeof(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault)}, + {531, 542, -1, sizeof(::google::protobuf::FeatureSetDefaults)}, + {545, 558, -1, sizeof(::google::protobuf::SourceCodeInfo_Location)}, + {563, -1, -1, sizeof(::google::protobuf::SourceCodeInfo)}, + {572, 585, -1, sizeof(::google::protobuf::GeneratedCodeInfo_Annotation)}, + {590, -1, -1, sizeof(::google::protobuf::GeneratedCodeInfo)}, }; static const ::_pb::Message* const file_default_instances[] = { &::google::protobuf::_FileDescriptorSet_default_instance_._instance, @@ -1931,47 +1928,46 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] AB "\020\001\022\r\n\tDELIMITED\020\002\"H\n\nJsonFormat\022\027\n\023JSON_" "FORMAT_UNKNOWN\020\000\022\t\n\005ALLOW\020\001\022\026\n\022LEGACY_BE" "ST_EFFORT\020\002*\006\010\350\007\020\351\007*\006\010\351\007\020\352\007*\006\010\352\007\020\353\007*\006\010\206N" - "\020\207N*\006\010\213N\020\220N*\006\010\220N\020\221NJ\006\010\347\007\020\350\007\"\261\003\n\022FeatureS" + "\020\207N*\006\010\213N\020\220N*\006\010\220N\020\221NJ\006\010\347\007\020\350\007\"\202\003\n\022FeatureS" "etDefaults\022N\n\010defaults\030\001 \003(\0132<.google.pr" "otobuf.FeatureSetDefaults.FeatureSetEdit" "ionDefault\0221\n\017minimum_edition\030\004 \001(\0162\030.go" "ogle.protobuf.Edition\0221\n\017maximum_edition" - "\030\005 \001(\0162\030.google.protobuf.Edition\032\344\001\n\030Fea" + "\030\005 \001(\0162\030.google.protobuf.Edition\032\265\001\n\030Fea" "tureSetEditionDefault\022)\n\007edition\030\003 \001(\0162\030" ".google.protobuf.Edition\0229\n\024overridable_" "features\030\004 \001(\0132\033.google.protobuf.Feature" "Set\0223\n\016fixed_features\030\005 \001(\0132\033.google.pro" - "tobuf.FeatureSet\022-\n\010features\030\002 \001(\0132\033.goo" - "gle.protobuf.FeatureSet\"\325\001\n\016SourceCodeIn" - "fo\022:\n\010location\030\001 \003(\0132(.google.protobuf.S" - "ourceCodeInfo.Location\032\206\001\n\010Location\022\020\n\004p" - "ath\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020leadi" - "ng_comments\030\003 \001(\t\022\031\n\021trailing_comments\030\004" - " \001(\t\022!\n\031leading_detached_comments\030\006 \003(\t\"" - "\234\002\n\021GeneratedCodeInfo\022A\n\nannotation\030\001 \003(" - "\0132-.google.protobuf.GeneratedCodeInfo.An" - "notation\032\303\001\n\nAnnotation\022\020\n\004path\030\001 \003(\005B\002\020" - "\001\022\023\n\013source_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n" - "\003end\030\004 \001(\005\022H\n\010semantic\030\005 \001(\01626.google.pr" - "otobuf.GeneratedCodeInfo.Annotation.Sema" - "ntic\"(\n\010Semantic\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005A" - "LIAS\020\002*\247\002\n\007Edition\022\023\n\017EDITION_UNKNOWN\020\000\022" - "\023\n\016EDITION_LEGACY\020\204\007\022\023\n\016EDITION_PROTO2\020\346" - "\007\022\023\n\016EDITION_PROTO3\020\347\007\022\021\n\014EDITION_2023\020\350" - "\007\022\021\n\014EDITION_2024\020\351\007\022\027\n\023EDITION_1_TEST_O" - "NLY\020\001\022\027\n\023EDITION_2_TEST_ONLY\020\002\022\035\n\027EDITIO" - "N_99997_TEST_ONLY\020\235\215\006\022\035\n\027EDITION_99998_T" - "EST_ONLY\020\236\215\006\022\035\n\027EDITION_99999_TEST_ONLY\020" - "\237\215\006\022\023\n\013EDITION_MAX\020\377\377\377\377\007B~\n\023com.google.p" - "rotobufB\020DescriptorProtosH\001Z-google.gola" - "ng.org/protobuf/types/descriptorpb\370\001\001\242\002\003" - "GPB\252\002\032Google.Protobuf.Reflection" + "tobuf.FeatureSet\"\325\001\n\016SourceCodeInfo\022:\n\010l" + "ocation\030\001 \003(\0132(.google.protobuf.SourceCo" + "deInfo.Location\032\206\001\n\010Location\022\020\n\004path\030\001 \003" + "(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020leading_comm" + "ents\030\003 \001(\t\022\031\n\021trailing_comments\030\004 \001(\t\022!\n" + "\031leading_detached_comments\030\006 \003(\t\"\234\002\n\021Gen" + "eratedCodeInfo\022A\n\nannotation\030\001 \003(\0132-.goo" + "gle.protobuf.GeneratedCodeInfo.Annotatio" + "n\032\303\001\n\nAnnotation\022\020\n\004path\030\001 \003(\005B\002\020\001\022\023\n\013so" + "urce_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(\005\022\013\n\003end\030\004 " + "\001(\005\022H\n\010semantic\030\005 \001(\01626.google.protobuf." + "GeneratedCodeInfo.Annotation.Semantic\"(\n" + "\010Semantic\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005ALIAS\020\002*" + "\247\002\n\007Edition\022\023\n\017EDITION_UNKNOWN\020\000\022\023\n\016EDIT" + "ION_LEGACY\020\204\007\022\023\n\016EDITION_PROTO2\020\346\007\022\023\n\016ED" + "ITION_PROTO3\020\347\007\022\021\n\014EDITION_2023\020\350\007\022\021\n\014ED" + "ITION_2024\020\351\007\022\027\n\023EDITION_1_TEST_ONLY\020\001\022\027" + "\n\023EDITION_2_TEST_ONLY\020\002\022\035\n\027EDITION_99997" + "_TEST_ONLY\020\235\215\006\022\035\n\027EDITION_99998_TEST_ONL" + "Y\020\236\215\006\022\035\n\027EDITION_99999_TEST_ONLY\020\237\215\006\022\023\n\013" + "EDITION_MAX\020\377\377\377\377\007B~\n\023com.google.protobuf" + "B\020DescriptorProtosH\001Z-google.golang.org/" + "protobuf/types/descriptorpb\370\001\001\242\002\003GPB\252\002\032G" + "oogle.Protobuf.Reflection" }; static ::absl::once_flag descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once; PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto = { false, false, - 10032, + 9985, descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto, "google/protobuf/descriptor.proto", &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once, @@ -12189,13 +12185,10 @@ FeatureSetDefaults_FeatureSetEditionDefault::FeatureSetDefaults_FeatureSetEditio from._internal_metadata_); new (&_impl_) Impl_(internal_visibility(), arena, from._impl_, from); ::uint32_t cached_has_bits = _impl_._has_bits_[0]; - _impl_.features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( - arena, *from._impl_.features_) - : nullptr; - _impl_.overridable_features_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( + _impl_.overridable_features_ = (cached_has_bits & 0x00000001u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( arena, *from._impl_.overridable_features_) : nullptr; - _impl_.fixed_features_ = (cached_has_bits & 0x00000004u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( + _impl_.fixed_features_ = (cached_has_bits & 0x00000002u) ? ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>( arena, *from._impl_.fixed_features_) : nullptr; _impl_.edition_ = from._impl_.edition_; @@ -12210,10 +12203,10 @@ inline PROTOBUF_NDEBUG_INLINE FeatureSetDefaults_FeatureSetEditionDefault::Impl_ inline void FeatureSetDefaults_FeatureSetEditionDefault::SharedCtor(::_pb::Arena* arena) { new (&_impl_) Impl_(internal_visibility(), arena); ::memset(reinterpret_cast(&_impl_) + - offsetof(Impl_, features_), + offsetof(Impl_, overridable_features_), 0, offsetof(Impl_, edition_) - - offsetof(Impl_, features_) + + offsetof(Impl_, overridable_features_) + sizeof(Impl_::edition_)); } FeatureSetDefaults_FeatureSetEditionDefault::~FeatureSetDefaults_FeatureSetEditionDefault() { @@ -12223,7 +12216,6 @@ FeatureSetDefaults_FeatureSetEditionDefault::~FeatureSetDefaults_FeatureSetEditi } inline void FeatureSetDefaults_FeatureSetEditionDefault::SharedDtor() { ABSL_DCHECK(GetArena() == nullptr); - delete _impl_.features_; delete _impl_.overridable_features_; delete _impl_.fixed_features_; _impl_.~Impl_(); @@ -12249,16 +12241,16 @@ FeatureSetDefaults_FeatureSetEditionDefault::GetClassData() const { ::google::protobuf::internal::PrefetchToLocalCache(_data_.tc_table); return _data_.base(); } -constexpr ::_pbi::TcParseTable<2, 4, 4, 0, 2> FeatureSetDefaults_FeatureSetEditionDefault::_table_ = { +constexpr ::_pbi::TcParseTable<2, 3, 3, 0, 2> FeatureSetDefaults_FeatureSetEditionDefault::_table_ = { { PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_._has_bits_), 0, // no _extensions_ 5, 24, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967265, // skipmap + 4294967267, // skipmap offsetof(decltype(_table_), field_entries), - 4, // num_field_entries - 4, // num_aux_entries + 3, // num_field_entries + 3, // num_aux_entries offsetof(decltype(_table_), aux_entries), &_FeatureSetDefaults_FeatureSetEditionDefault_default_instance_._instance, nullptr, // post_loop_handler @@ -12269,33 +12261,27 @@ constexpr ::_pbi::TcParseTable<2, 4, 4, 0, 2> FeatureSetDefaults_FeatureSetEditi }, {{ // optional .google.protobuf.FeatureSet overridable_features = 4; {::_pbi::TcParser::FastMtS1, - {34, 1, 1, PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.overridable_features_)}}, + {34, 0, 0, PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.overridable_features_)}}, // optional .google.protobuf.FeatureSet fixed_features = 5; {::_pbi::TcParser::FastMtS1, - {42, 2, 2, PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.fixed_features_)}}, - // optional .google.protobuf.FeatureSet features = 2; - {::_pbi::TcParser::FastMtS1, - {18, 0, 0, PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.features_)}}, + {42, 1, 1, PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.fixed_features_)}}, + {::_pbi::TcParser::MiniParse, {}}, // optional .google.protobuf.Edition edition = 3; {::_pbi::TcParser::FastEvS1, - {24, 3, 3, PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.edition_)}}, + {24, 2, 2, PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.edition_)}}, }}, {{ 65535, 65535 }}, {{ - // optional .google.protobuf.FeatureSet features = 2; - {PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.features_), _Internal::kHasBitsOffset + 0, 0, - (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, // optional .google.protobuf.Edition edition = 3; - {PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.edition_), _Internal::kHasBitsOffset + 3, 3, + {PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.edition_), _Internal::kHasBitsOffset + 2, 2, (0 | ::_fl::kFcOptional | ::_fl::kEnum)}, // optional .google.protobuf.FeatureSet overridable_features = 4; - {PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.overridable_features_), _Internal::kHasBitsOffset + 1, 1, + {PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.overridable_features_), _Internal::kHasBitsOffset + 0, 0, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, // optional .google.protobuf.FeatureSet fixed_features = 5; - {PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.fixed_features_), _Internal::kHasBitsOffset + 2, 2, + {PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.fixed_features_), _Internal::kHasBitsOffset + 1, 1, (0 | ::_fl::kFcOptional | ::_fl::kMessage | ::_fl::kTvTable)}, }}, {{ - {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, {::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>()}, {::_pbi::FieldAuxEnumData{}, ::google::protobuf::Edition_internal_data_}, @@ -12311,16 +12297,12 @@ PROTOBUF_NOINLINE void FeatureSetDefaults_FeatureSetEditionDefault::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000003u) { if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(_impl_.features_ != nullptr); - _impl_.features_->Clear(); - } - if (cached_has_bits & 0x00000002u) { ABSL_DCHECK(_impl_.overridable_features_ != nullptr); _impl_.overridable_features_->Clear(); } - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000002u) { ABSL_DCHECK(_impl_.fixed_features_ != nullptr); _impl_.fixed_features_->Clear(); } @@ -12338,27 +12320,21 @@ ::uint8_t* FeatureSetDefaults_FeatureSetEditionDefault::_InternalSerialize( (void)cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - // optional .google.protobuf.FeatureSet features = 2; - if (cached_has_bits & 0x00000001u) { - target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( - 2, *_impl_.features_, _impl_.features_->GetCachedSize(), target, stream); - } - // optional .google.protobuf.Edition edition = 3; - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000004u) { target = stream->EnsureSpace(target); target = ::_pbi::WireFormatLite::WriteEnumToArray( 3, this->_internal_edition(), target); } // optional .google.protobuf.FeatureSet overridable_features = 4; - if (cached_has_bits & 0x00000002u) { + if (cached_has_bits & 0x00000001u) { target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( 4, *_impl_.overridable_features_, _impl_.overridable_features_->GetCachedSize(), target, stream); } // optional .google.protobuf.FeatureSet fixed_features = 5; - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000002u) { target = ::google::protobuf::internal::WireFormatLite::InternalWriteMessage( 5, *_impl_.fixed_features_, _impl_.fixed_features_->GetCachedSize(), target, stream); } @@ -12382,27 +12358,21 @@ ::size_t FeatureSetDefaults_FeatureSetEditionDefault::ByteSizeLong() const { ::_pbi::Prefetch5LinesFrom7Lines(reinterpret_cast(this)); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { - // optional .google.protobuf.FeatureSet features = 2; - if (cached_has_bits & 0x00000001u) { - total_size += - 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.features_); - } - + if (cached_has_bits & 0x00000007u) { // optional .google.protobuf.FeatureSet overridable_features = 4; - if (cached_has_bits & 0x00000002u) { + if (cached_has_bits & 0x00000001u) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.overridable_features_); } // optional .google.protobuf.FeatureSet fixed_features = 5; - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000002u) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSize(*_impl_.fixed_features_); } // optional .google.protobuf.Edition edition = 3; - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000004u) { total_size += 1 + ::_pbi::WireFormatLite::EnumSize(this->_internal_edition()); } @@ -12422,17 +12392,8 @@ void FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl(::google::protobuf:: (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000007u) { if (cached_has_bits & 0x00000001u) { - ABSL_DCHECK(from._impl_.features_ != nullptr); - if (_this->_impl_.features_ == nullptr) { - _this->_impl_.features_ = - ::google::protobuf::Message::CopyConstruct<::google::protobuf::FeatureSet>(arena, *from._impl_.features_); - } else { - _this->_impl_.features_->MergeFrom(*from._impl_.features_); - } - } - if (cached_has_bits & 0x00000002u) { ABSL_DCHECK(from._impl_.overridable_features_ != nullptr); if (_this->_impl_.overridable_features_ == nullptr) { _this->_impl_.overridable_features_ = @@ -12441,7 +12402,7 @@ void FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl(::google::protobuf:: _this->_impl_.overridable_features_->MergeFrom(*from._impl_.overridable_features_); } } - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000002u) { ABSL_DCHECK(from._impl_.fixed_features_ != nullptr); if (_this->_impl_.fixed_features_ == nullptr) { _this->_impl_.fixed_features_ = @@ -12450,7 +12411,7 @@ void FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl(::google::protobuf:: _this->_impl_.fixed_features_->MergeFrom(*from._impl_.fixed_features_); } } - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000004u) { _this->_impl_.edition_ = from._impl_.edition_; } } @@ -12469,12 +12430,9 @@ PROTOBUF_NOINLINE bool FeatureSetDefaults_FeatureSetEditionDefault::IsInitialize const MessageLite& msg) { auto& this_ = static_cast(msg); if ((this_._impl_._has_bits_[0] & 0x00000001u) != 0) { - if (!this_._impl_.features_->IsInitialized()) return false; - } - if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { if (!this_._impl_.overridable_features_->IsInitialized()) return false; } - if ((this_._impl_._has_bits_[0] & 0x00000004u) != 0) { + if ((this_._impl_._has_bits_[0] & 0x00000002u) != 0) { if (!this_._impl_.fixed_features_->IsInitialized()) return false; } return true; @@ -12487,9 +12445,9 @@ void FeatureSetDefaults_FeatureSetEditionDefault::InternalSwap(FeatureSetDefault ::google::protobuf::internal::memswap< PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.edition_) + sizeof(FeatureSetDefaults_FeatureSetEditionDefault::_impl_.edition_) - - PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.features_)>( - reinterpret_cast(&_impl_.features_), - reinterpret_cast(&other->_impl_.features_)); + - PROTOBUF_FIELD_OFFSET(FeatureSetDefaults_FeatureSetEditionDefault, _impl_.overridable_features_)>( + reinterpret_cast(&_impl_.overridable_features_), + reinterpret_cast(&other->_impl_.overridable_features_)); } ::google::protobuf::Metadata FeatureSetDefaults_FeatureSetEditionDefault::GetMetadata() const { diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 3b226955679f9..9be6bb2f6722a 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -3758,26 +3758,10 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public // accessors ------------------------------------------------------- enum : int { - kFeaturesFieldNumber = 2, kOverridableFeaturesFieldNumber = 4, kFixedFeaturesFieldNumber = 5, kEditionFieldNumber = 3, }; - // optional .google.protobuf.FeatureSet features = 2; - bool has_features() const; - void clear_features() ; - const ::google::protobuf::FeatureSet& features() const; - PROTOBUF_NODISCARD ::google::protobuf::FeatureSet* release_features(); - ::google::protobuf::FeatureSet* mutable_features(); - void set_allocated_features(::google::protobuf::FeatureSet* value); - void unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value); - ::google::protobuf::FeatureSet* unsafe_arena_release_features(); - - private: - const ::google::protobuf::FeatureSet& _internal_features() const; - ::google::protobuf::FeatureSet* _internal_mutable_features(); - - public: // optional .google.protobuf.FeatureSet overridable_features = 4; bool has_overridable_features() const; void clear_overridable_features() ; @@ -3824,7 +3808,7 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public class _Internal; friend class ::google::protobuf::internal::TcParser; static const ::google::protobuf::internal::TcParseTable< - 2, 4, 4, + 2, 3, 3, 0, 2> _table_; @@ -3847,7 +3831,6 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public const FeatureSetDefaults_FeatureSetEditionDefault& from_msg); ::google::protobuf::internal::HasBits<1> _has_bits_; mutable ::google::protobuf::internal::CachedSize _cached_size_; - ::google::protobuf::FeatureSet* features_; ::google::protobuf::FeatureSet* overridable_features_; ::google::protobuf::FeatureSet* fixed_features_; int edition_; @@ -19104,13 +19087,13 @@ inline void FeatureSet::_internal_set_json_format(::google::protobuf::FeatureSet // optional .google.protobuf.Edition edition = 3; inline bool FeatureSetDefaults_FeatureSetEditionDefault::has_edition() const { - bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; return value; } inline void FeatureSetDefaults_FeatureSetEditionDefault::clear_edition() { ::google::protobuf::internal::TSanWrite(&_impl_); _impl_.edition_ = 0; - _impl_._has_bits_[0] &= ~0x00000008u; + _impl_._has_bits_[0] &= ~0x00000004u; } inline ::google::protobuf::Edition FeatureSetDefaults_FeatureSetEditionDefault::edition() const { // @@protoc_insertion_point(field_get:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition) @@ -19118,7 +19101,7 @@ inline ::google::protobuf::Edition FeatureSetDefaults_FeatureSetEditionDefault:: } inline void FeatureSetDefaults_FeatureSetEditionDefault::set_edition(::google::protobuf::Edition value) { _internal_set_edition(value); - _impl_._has_bits_[0] |= 0x00000008u; + _impl_._has_bits_[0] |= 0x00000004u; // @@protoc_insertion_point(field_set:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition) } inline ::google::protobuf::Edition FeatureSetDefaults_FeatureSetEditionDefault::_internal_edition() const { @@ -19133,14 +19116,14 @@ inline void FeatureSetDefaults_FeatureSetEditionDefault::_internal_set_edition(: // optional .google.protobuf.FeatureSet overridable_features = 4; inline bool FeatureSetDefaults_FeatureSetEditionDefault::has_overridable_features() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; PROTOBUF_ASSUME(!value || _impl_.overridable_features_ != nullptr); return value; } inline void FeatureSetDefaults_FeatureSetEditionDefault::clear_overridable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.overridable_features_ != nullptr) _impl_.overridable_features_->Clear(); - _impl_._has_bits_[0] &= ~0x00000002u; + _impl_._has_bits_[0] &= ~0x00000001u; } inline const ::google::protobuf::FeatureSet& FeatureSetDefaults_FeatureSetEditionDefault::_internal_overridable_features() const { ::google::protobuf::internal::TSanRead(&_impl_); @@ -19158,16 +19141,16 @@ inline void FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_set_alloca } _impl_.overridable_features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(value); if (value != nullptr) { - _impl_._has_bits_[0] |= 0x00000002u; + _impl_._has_bits_[0] |= 0x00000001u; } else { - _impl_._has_bits_[0] &= ~0x00000002u; + _impl_._has_bits_[0] &= ~0x00000001u; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features) } inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::release_overridable_features() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_._has_bits_[0] &= ~0x00000002u; + _impl_._has_bits_[0] &= ~0x00000001u; ::google::protobuf::FeatureSet* released = _impl_.overridable_features_; _impl_.overridable_features_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE @@ -19187,7 +19170,7 @@ inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefau ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features) - _impl_._has_bits_[0] &= ~0x00000002u; + _impl_._has_bits_[0] &= ~0x00000001u; ::google::protobuf::FeatureSet* temp = _impl_.overridable_features_; _impl_.overridable_features_ = nullptr; return temp; @@ -19201,7 +19184,7 @@ inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefau return _impl_.overridable_features_; } inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::mutable_overridable_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { - _impl_._has_bits_[0] |= 0x00000002u; + _impl_._has_bits_[0] |= 0x00000001u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_overridable_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridable_features) return _msg; @@ -19218,9 +19201,9 @@ inline void FeatureSetDefaults_FeatureSetEditionDefault::set_allocated_overridab if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } - _impl_._has_bits_[0] |= 0x00000002u; + _impl_._has_bits_[0] |= 0x00000001u; } else { - _impl_._has_bits_[0] &= ~0x00000002u; + _impl_._has_bits_[0] &= ~0x00000001u; } _impl_.overridable_features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(value); @@ -19229,14 +19212,14 @@ inline void FeatureSetDefaults_FeatureSetEditionDefault::set_allocated_overridab // optional .google.protobuf.FeatureSet fixed_features = 5; inline bool FeatureSetDefaults_FeatureSetEditionDefault::has_fixed_features() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; PROTOBUF_ASSUME(!value || _impl_.fixed_features_ != nullptr); return value; } inline void FeatureSetDefaults_FeatureSetEditionDefault::clear_fixed_features() { ::google::protobuf::internal::TSanWrite(&_impl_); if (_impl_.fixed_features_ != nullptr) _impl_.fixed_features_->Clear(); - _impl_._has_bits_[0] &= ~0x00000004u; + _impl_._has_bits_[0] &= ~0x00000002u; } inline const ::google::protobuf::FeatureSet& FeatureSetDefaults_FeatureSetEditionDefault::_internal_fixed_features() const { ::google::protobuf::internal::TSanRead(&_impl_); @@ -19254,16 +19237,16 @@ inline void FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_set_alloca } _impl_.fixed_features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(value); if (value != nullptr) { - _impl_._has_bits_[0] |= 0x00000004u; + _impl_._has_bits_[0] |= 0x00000002u; } else { - _impl_._has_bits_[0] &= ~0x00000004u; + _impl_._has_bits_[0] &= ~0x00000002u; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features) } inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::release_fixed_features() { ::google::protobuf::internal::TSanWrite(&_impl_); - _impl_._has_bits_[0] &= ~0x00000004u; + _impl_._has_bits_[0] &= ~0x00000002u; ::google::protobuf::FeatureSet* released = _impl_.fixed_features_; _impl_.fixed_features_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE @@ -19283,7 +19266,7 @@ inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefau ::google::protobuf::internal::TSanWrite(&_impl_); // @@protoc_insertion_point(field_release:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features) - _impl_._has_bits_[0] &= ~0x00000004u; + _impl_._has_bits_[0] &= ~0x00000002u; ::google::protobuf::FeatureSet* temp = _impl_.fixed_features_; _impl_.fixed_features_ = nullptr; return temp; @@ -19297,7 +19280,7 @@ inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefau return _impl_.fixed_features_; } inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::mutable_fixed_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { - _impl_._has_bits_[0] |= 0x00000004u; + _impl_._has_bits_[0] |= 0x00000002u; ::google::protobuf::FeatureSet* _msg = _internal_mutable_fixed_features(); // @@protoc_insertion_point(field_mutable:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features) return _msg; @@ -19314,111 +19297,15 @@ inline void FeatureSetDefaults_FeatureSetEditionDefault::set_allocated_fixed_fea if (message_arena != submessage_arena) { value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); } - _impl_._has_bits_[0] |= 0x00000004u; + _impl_._has_bits_[0] |= 0x00000002u; } else { - _impl_._has_bits_[0] &= ~0x00000004u; + _impl_._has_bits_[0] &= ~0x00000002u; } _impl_.fixed_features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(value); // @@protoc_insertion_point(field_set_allocated:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixed_features) } -// optional .google.protobuf.FeatureSet features = 2; -inline bool FeatureSetDefaults_FeatureSetEditionDefault::has_features() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - PROTOBUF_ASSUME(!value || _impl_.features_ != nullptr); - return value; -} -inline void FeatureSetDefaults_FeatureSetEditionDefault::clear_features() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.features_ != nullptr) _impl_.features_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline const ::google::protobuf::FeatureSet& FeatureSetDefaults_FeatureSetEditionDefault::_internal_features() const { - ::google::protobuf::internal::TSanRead(&_impl_); - const ::google::protobuf::FeatureSet* p = _impl_.features_; - return p != nullptr ? *p : reinterpret_cast(::google::protobuf::_FeatureSet_default_instance_); -} -inline const ::google::protobuf::FeatureSet& FeatureSetDefaults_FeatureSetEditionDefault::features() const ABSL_ATTRIBUTE_LIFETIME_BOUND { - // @@protoc_insertion_point(field_get:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features) - return _internal_features(); -} -inline void FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_set_allocated_features(::google::protobuf::FeatureSet* value) { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (GetArena() == nullptr) { - delete reinterpret_cast<::google::protobuf::MessageLite*>(_impl_.features_); - } - _impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(value); - if (value != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features) -} -inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::release_features() { - ::google::protobuf::internal::TSanWrite(&_impl_); - - _impl_._has_bits_[0] &= ~0x00000001u; - ::google::protobuf::FeatureSet* released = _impl_.features_; - _impl_.features_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::google::protobuf::MessageLite*>(released); - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - if (GetArena() == nullptr) { - delete old; - } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArena() != nullptr) { - released = ::google::protobuf::internal::DuplicateIfNonNull(released); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return released; -} -inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::unsafe_arena_release_features() { - ::google::protobuf::internal::TSanWrite(&_impl_); - // @@protoc_insertion_point(field_release:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features) - - _impl_._has_bits_[0] &= ~0x00000001u; - ::google::protobuf::FeatureSet* temp = _impl_.features_; - _impl_.features_ = nullptr; - return temp; -} -inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::_internal_mutable_features() { - ::google::protobuf::internal::TSanWrite(&_impl_); - if (_impl_.features_ == nullptr) { - auto* p = ::google::protobuf::Message::DefaultConstruct<::google::protobuf::FeatureSet>(GetArena()); - _impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(p); - } - return _impl_.features_; -} -inline ::google::protobuf::FeatureSet* FeatureSetDefaults_FeatureSetEditionDefault::mutable_features() ABSL_ATTRIBUTE_LIFETIME_BOUND { - _impl_._has_bits_[0] |= 0x00000001u; - ::google::protobuf::FeatureSet* _msg = _internal_mutable_features(); - // @@protoc_insertion_point(field_mutable:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features) - return _msg; -} -inline void FeatureSetDefaults_FeatureSetEditionDefault::set_allocated_features(::google::protobuf::FeatureSet* value) { - ::google::protobuf::Arena* message_arena = GetArena(); - ::google::protobuf::internal::TSanWrite(&_impl_); - if (message_arena == nullptr) { - delete (_impl_.features_); - } - - if (value != nullptr) { - ::google::protobuf::Arena* submessage_arena = (value)->GetArena(); - if (message_arena != submessage_arena) { - value = ::google::protobuf::internal::GetOwnedMessage(message_arena, value, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - - _impl_.features_ = reinterpret_cast<::google::protobuf::FeatureSet*>(value); - // @@protoc_insertion_point(field_set_allocated:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features) -} - // ------------------------------------------------------------------- // FeatureSetDefaults diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto index ec194b4da058f..8e5e21480a1ab 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -1093,10 +1093,6 @@ message FeatureSetDefaults { // Defaults of features that can't be overridden in this edition. optional FeatureSet fixed_features = 5; - - // TODO Deprecate and remove this field, which is just the - // above two merged. - optional FeatureSet features = 2; } repeated FeatureSetEditionDefault defaults = 1; diff --git a/src/google/protobuf/feature_resolver.cc b/src/google/protobuf/feature_resolver.cc index 80da896fb69f0..44a921f35900e 100644 --- a/src/google/protobuf/feature_resolver.cc +++ b/src/google/protobuf/feature_resolver.cc @@ -382,11 +382,6 @@ absl::StatusOr FeatureResolver::CompileDefaults( fixed_defaults_dynamic->SerializeAsString()); edition_defaults->mutable_overridable_features()->MergeFromString( overridable_defaults_dynamic->SerializeAsString()); - // TODO Remove this once `features` is deprecated. - edition_defaults->mutable_features()->MergeFromString( - fixed_defaults_dynamic->SerializeAsString()); - edition_defaults->mutable_features()->MergeFromString( - overridable_defaults_dynamic->SerializeAsString()); } return defaults; } diff --git a/src/google/protobuf/feature_resolver_test.cc b/src/google/protobuf/feature_resolver_test.cc index a4f577d336357..ba8d6c6749fce 100644 --- a/src/google/protobuf/feature_resolver_test.cc +++ b/src/google/protobuf/feature_resolver_test.cc @@ -207,7 +207,7 @@ TEST(FeatureResolverTest, DefaultsGeneratedPoolCustom) { ASSERT_OK(defaults); ASSERT_EQ(defaults->defaults().size(), 3); ASSERT_EQ(defaults->defaults().at(2).edition(), EDITION_2023); - FeatureSet merged = defaults->defaults().at(2).features(); + FeatureSet merged = defaults->defaults().at(2).overridable_features(); EXPECT_EQ(merged.field_presence(), FeatureSet::EXPLICIT); EXPECT_TRUE(merged.HasExtension(pb::test)); @@ -292,10 +292,6 @@ TEST(FeatureResolverTest, CompileDefaultsFixedFutureFeature) { const auto& edition_defaults = defaults->defaults(2); ASSERT_EQ(edition_defaults.edition(), EDITION_2023); - EXPECT_TRUE( - edition_defaults.features().GetExtension(pb::test).has_future_feature()); - EXPECT_EQ(edition_defaults.features().GetExtension(pb::test).future_feature(), - pb::VALUE1); EXPECT_TRUE(edition_defaults.fixed_features() .GetExtension(pb::test) .has_future_feature()); @@ -318,11 +314,6 @@ TEST(FeatureResolverTest, CompileDefaultsFixedRemovedFeature) { const auto& edition_defaults = defaults->defaults(3); ASSERT_EQ(edition_defaults.edition(), EDITION_2024); - EXPECT_TRUE( - edition_defaults.features().GetExtension(pb::test).has_removed_feature()); - EXPECT_EQ( - edition_defaults.features().GetExtension(pb::test).removed_feature(), - pb::VALUE3); EXPECT_TRUE(edition_defaults.fixed_features() .GetExtension(pb::test) .has_removed_feature()); @@ -347,11 +338,6 @@ TEST(FeatureResolverTest, CompileDefaultsOverridable) { const auto& edition_defaults = defaults->defaults(2); ASSERT_EQ(edition_defaults.edition(), EDITION_2023); - EXPECT_TRUE( - edition_defaults.features().GetExtension(pb::test).has_removed_feature()); - EXPECT_EQ( - edition_defaults.features().GetExtension(pb::test).removed_feature(), - pb::VALUE2); EXPECT_FALSE(edition_defaults.fixed_features() .GetExtension(pb::test) .has_removed_feature()); @@ -382,10 +368,7 @@ TEST(FeatureResolverTest, CreateUnknownEdition) { FeatureSetDefaults defaults = ParseTextOrDie(R"pb( minimum_edition: EDITION_UNKNOWN maximum_edition: EDITION_99999_TEST_ONLY - defaults { - edition: EDITION_UNKNOWN - features {} - } + defaults { edition: EDITION_UNKNOWN } )pb"); EXPECT_THAT(FeatureResolver::Create(EDITION_2023, defaults), HasError(HasSubstr("Invalid edition UNKNOWN"))); @@ -395,7 +378,7 @@ TEST(FeatureResolverTest, CreateMissingEdition) { FeatureSetDefaults defaults = ParseTextOrDie(R"pb( minimum_edition: EDITION_UNKNOWN maximum_edition: EDITION_99999_TEST_ONLY - defaults { features {} } + defaults {} )pb"); EXPECT_THAT(FeatureResolver::Create(EDITION_2023, defaults), HasError(HasSubstr("Invalid edition UNKNOWN"))); @@ -1342,15 +1325,6 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) { maximum_edition: EDITION_99999_TEST_ONLY defaults { edition: EDITION_PROTO2 - features { - field_presence: EXPLICIT - enum_type: CLOSED - repeated_field_encoding: EXPANDED - utf8_validation: NONE - message_encoding: LENGTH_PREFIXED - json_format: LEGACY_BEST_EFFORT - [pb.test] { file_feature: VALUE1 } - } overridable_features { [pb.test] {} } @@ -1366,15 +1340,6 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) { } defaults { edition: EDITION_PROTO3 - features { - field_presence: IMPLICIT - enum_type: OPEN - repeated_field_encoding: PACKED - utf8_validation: VERIFY - message_encoding: LENGTH_PREFIXED - json_format: ALLOW - [pb.test] { file_feature: VALUE1 } - } overridable_features { [pb.test] {} } @@ -1390,15 +1355,6 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) { } defaults { edition: EDITION_2023 - features { - field_presence: EXPLICIT - enum_type: OPEN - repeated_field_encoding: PACKED - utf8_validation: VERIFY - message_encoding: LENGTH_PREFIXED - json_format: ALLOW - [pb.test] { file_feature: VALUE2 } - } overridable_features { field_presence: EXPLICIT enum_type: OPEN @@ -1414,15 +1370,6 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) { } defaults { edition: EDITION_99998_TEST_ONLY - features { - field_presence: EXPLICIT - enum_type: OPEN - repeated_field_encoding: PACKED - utf8_validation: VERIFY - message_encoding: LENGTH_PREFIXED - json_format: ALLOW - [pb.test] { file_feature: VALUE3 } - } overridable_features { field_presence: EXPLICIT enum_type: OPEN diff --git a/upb/reflection/stage0/google/protobuf/descriptor.upb.c b/upb/reflection/stage0/google/protobuf/descriptor.upb.c index d4a3572d609c4..4770b2662f58a 100644 --- a/upb/reflection/stage0/google/protobuf/descriptor.upb.c +++ b/upb/reflection/stage0/google/protobuf/descriptor.upb.c @@ -360,7 +360,7 @@ const upb_MiniTable* google__protobuf__FeatureSetDefaults_msg_init() { const upb_MiniTable* google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init() { static upb_MiniTable* mini_table = NULL; - static const char* mini_descriptor = "$a3433"; + static const char* mini_descriptor = "$b433"; if (mini_table) return mini_table; mini_table = upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), @@ -368,7 +368,6 @@ const upb_MiniTable* google__protobuf__FeatureSetDefaults__FeatureSetEditionDefa upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 3), google_protobuf_Edition_enum_init()); upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 4), google__protobuf__FeatureSet_msg_init()); upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 5), google__protobuf__FeatureSet_msg_init()); - upb_MiniTable_SetSubMessage(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 2), google__protobuf__FeatureSet_msg_init()); return mini_table; } diff --git a/upb/reflection/stage0/google/protobuf/descriptor.upb.h b/upb/reflection/stage0/google/protobuf/descriptor.upb.h index e51993fc3dda3..33287809bffb5 100644 --- a/upb/reflection/stage0/google/protobuf/descriptor.upb.h +++ b/upb/reflection/stage0/google/protobuf/descriptor.upb.h @@ -5993,22 +5993,6 @@ UPB_INLINE char* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_ser (void)upb_Encode(UPB_UPCAST(msg), google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init(), options, arena, &ptr, len); return ptr; } -UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { - const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init(), 2); - upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); -} -UPB_INLINE const google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { - const google_protobuf_FeatureSet* default_val = NULL; - const google_protobuf_FeatureSet* ret; - const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init(), 2); - _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, - &default_val, &ret); - return ret; -} -UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_features(const google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { - const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init(), 2); - return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); -} UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_clear_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg) { const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init(), 3); upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); @@ -6058,18 +6042,6 @@ UPB_INLINE bool google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_has_ return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } -UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, google_protobuf_FeatureSet* value) { - const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init(), 2); - upb_Message_SetBaseField((upb_Message *)msg, &field, &value); -} -UPB_INLINE struct google_protobuf_FeatureSet* google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_mutable_features(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault* msg, upb_Arena* arena) { - struct google_protobuf_FeatureSet* sub = (struct google_protobuf_FeatureSet*)google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_features(msg); - if (sub == NULL) { - sub = (struct google_protobuf_FeatureSet*)_upb_Message_New(google__protobuf__FeatureSet_msg_init(), arena); - if (sub) google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_features(msg, sub); - } - return sub; -} UPB_INLINE void google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault_set_edition(google_protobuf_FeatureSetDefaults_FeatureSetEditionDefault *msg, int32_t value) { const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init(), 3); upb_Message_SetBaseField((upb_Message *)msg, &field, &value);