diff --git a/editions/generated_files_test.cc b/editions/generated_files_test.cc index 22aaa18f8ccc2..d39ed129d7c0c 100644 --- a/editions/generated_files_test.cc +++ b/editions/generated_files_test.cc @@ -146,6 +146,7 @@ TEST(Generated, EditionDefaults2023InternalFeatures) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING diff --git a/php/internal_generated_files.bzl b/php/internal_generated_files.bzl index be2cba8efcdb3..e84e658e2fce5 100644 --- a/php/internal_generated_files.bzl +++ b/php/internal_generated_files.bzl @@ -58,6 +58,7 @@ DESCRIPTOR_GENERATED_FILES = [ "src/Google/Protobuf/Internal/ExtensionRangeOptions/VerificationState.php", "src/Google/Protobuf/Internal/FeatureSet.php", "src/Google/Protobuf/Internal/FeatureSet/EnumType.php", + "src/Google/Protobuf/Internal/FeatureSet/EnforceNamingStyle.php", "src/Google/Protobuf/Internal/FeatureSet/FieldPresence.php", "src/Google/Protobuf/Internal/FeatureSet/JsonFormat.php", "src/Google/Protobuf/Internal/FeatureSet/MessageEncoding.php", diff --git a/src/google/protobuf/compiler/code_generator_unittest.cc b/src/google/protobuf/compiler/code_generator_unittest.cc index b7b9b7cfcfc58..001356cfe7ef5 100644 --- a/src/google/protobuf/compiler/code_generator_unittest.cc +++ b/src/google/protobuf/compiler/code_generator_unittest.cc @@ -280,6 +280,7 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaults) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -292,6 +293,7 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -304,6 +306,19 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaults) { message_encoding: LENGTH_PREFIXED json_format: ALLOW } + fixed_features { enforce_naming_style: STYLE_LEGACY } + } + defaults { + edition: EDITION_2024 + overridable_features { + field_presence: EXPLICIT + enum_type: OPEN + repeated_field_encoding: PACKED + utf8_validation: VERIFY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW + enforce_naming_style: STYLE2024 + } fixed_features {} } minimum_edition: EDITION_PROTO2 diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index f05b62af89796..848ce650460c5 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -2011,6 +2011,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaults) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -2023,6 +2024,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -2035,7 +2037,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaults) { message_encoding: LENGTH_PREFIXED json_format: ALLOW } - fixed_features {} + fixed_features { enforce_naming_style: STYLE_LEGACY } } minimum_edition: EDITION_PROTO2 maximum_edition: EDITION_2023 @@ -2063,6 +2065,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMaximum) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -2075,6 +2078,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMaximum) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -2087,6 +2091,19 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMaximum) { message_encoding: LENGTH_PREFIXED json_format: ALLOW } + fixed_features { enforce_naming_style: STYLE_LEGACY } + } + defaults { + edition: EDITION_2024 + overridable_features { + field_presence: EXPLICIT + enum_type: OPEN + repeated_field_encoding: PACKED + utf8_validation: VERIFY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW + enforce_naming_style: STYLE2024 + } fixed_features {} } minimum_edition: EDITION_PROTO2 @@ -2116,6 +2133,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMinimum) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -2128,6 +2146,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMinimum) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY } } defaults { @@ -2140,6 +2159,19 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMinimum) { message_encoding: LENGTH_PREFIXED json_format: ALLOW } + fixed_features { enforce_naming_style: STYLE_LEGACY } + } + defaults { + edition: EDITION_2024 + overridable_features { + field_presence: EXPLICIT + enum_type: OPEN + repeated_field_encoding: PACKED + utf8_validation: VERIFY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW + enforce_naming_style: STYLE2024 + } fixed_features {} } minimum_edition: EDITION_99997_TEST_ONLY diff --git a/src/google/protobuf/cpp_edition_defaults.h b/src/google/protobuf/cpp_edition_defaults.h index 52e5fd65aef7f..7f64ab099df5d 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 "\n\037\030\204\007\"\003\302>\000*\025\010\001\020\002\030\002 \003(\0010\002\302>\006\010\001\020\003\030\000\n\037\030\347\007\"\003\302>\000*\025\010\002\020\001\030\001 \002(\0010\001\302>\006\010\000\020\003\030\000\n\037\030\350\007\"\023\010\001\020\001\030\001 \002(\0010\001\302>\004\010\000\020\003*\005\302>\002\030\000\n\037\030\351\007\"\025\010\001\020\001\030\001 \002(\0010\001\302>\006\010\000\020\001\030\001*\003\302>\000 \346\007(\351\007" +#define PROTOBUF_INTERNAL_CPP_EDITION_DEFAULTS "\n!\030\204\007\"\003\302>\000*\027\010\001\020\002\030\002 \003(\0010\0028\002\302>\006\010\001\020\003\030\000\n!\030\347\007\"\003\302>\000*\027\010\002\020\001\030\001 \002(\0010\0018\002\302>\006\010\000\020\003\030\000\n!\030\350\007\"\023\010\001\020\001\030\001 \002(\0010\001\302>\004\010\000\020\003*\0078\002\302>\002\030\000\n!\030\351\007\"\027\010\001\020\001\030\001 \002(\0010\0018\001\302>\006\010\000\020\001\030\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 ee014389efbf9..08644218a0a1d 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -213,7 +213,8 @@ inline constexpr FeatureSet::Impl_::Impl_( repeated_field_encoding_{static_cast< ::google::protobuf::FeatureSet_RepeatedFieldEncoding >(0)}, utf8_validation_{static_cast< ::google::protobuf::FeatureSet_Utf8Validation >(0)}, message_encoding_{static_cast< ::google::protobuf::FeatureSet_MessageEncoding >(0)}, - json_format_{static_cast< ::google::protobuf::FeatureSet_JsonFormat >(0)} {} + json_format_{static_cast< ::google::protobuf::FeatureSet_JsonFormat >(0)}, + enforce_naming_style_{static_cast< ::google::protobuf::FeatureSet_EnforceNamingStyle >(0)} {} template PROTOBUF_CONSTEXPR FeatureSet::FeatureSet(::_pbi::ConstantInitialized) @@ -1233,7 +1234,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_EXPORT } // namespace protobuf } // namespace google static const ::_pb::EnumDescriptor* PROTOBUF_NONNULL - file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[17]; + file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[18]; static constexpr const ::_pb::ServiceDescriptor *PROTOBUF_NONNULL *PROTOBUF_NULLABLE file_level_service_descriptors_google_2fprotobuf_2fdescriptor_2eproto = nullptr; const ::uint32_t @@ -1752,12 +1753,14 @@ const ::uint32_t PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSet, _impl_.utf8_validation_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSet, _impl_.message_encoding_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSet, _impl_.json_format_), + PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSet, _impl_.enforce_naming_style_), 0, 1, 2, 3, 4, 5, + 6, PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault, _internal_metadata_), ~0u, // no _extensions_ @@ -1870,13 +1873,13 @@ static const ::_pbi::MigrationSchema {449, 461, -1, sizeof(::google::protobuf::MethodOptions)}, {465, 475, -1, sizeof(::google::protobuf::UninterpretedOption_NamePart)}, {477, 492, -1, sizeof(::google::protobuf::UninterpretedOption)}, - {499, 513, -1, sizeof(::google::protobuf::FeatureSet)}, - {519, 530, -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)}, + {499, 514, -1, sizeof(::google::protobuf::FeatureSet)}, + {521, 532, -1, sizeof(::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault)}, + {535, 546, -1, sizeof(::google::protobuf::FeatureSetDefaults)}, + {549, 562, -1, sizeof(::google::protobuf::SourceCodeInfo_Location)}, + {567, -1, -1, sizeof(::google::protobuf::SourceCodeInfo)}, + {576, 589, -1, sizeof(::google::protobuf::GeneratedCodeInfo_Annotation)}, + {594, -1, -1, sizeof(::google::protobuf::GeneratedCodeInfo)}, }; static const ::_pb::Message* PROTOBUF_NONNULL const file_default_instances[] = { &::google::protobuf::_FileDescriptorSet_default_instance_._instance, @@ -2103,7 +2106,7 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] AB "\030\005 \001(\003\022\024\n\014double_value\030\006 \001(\001\022\024\n\014string_v" "alue\030\007 \001(\014\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010N" "amePart\022\021\n\tname_part\030\001 \002(\t\022\024\n\014is_extensi" - "on\030\002 \002(\010\"\311\t\n\nFeatureSet\022\202\001\n\016field_presen" + "on\030\002 \002(\010\"\274\013\n\nFeatureSet\022\202\001\n\016field_presen" "ce\030\001 \001(\0162).google.protobuf.FeatureSet.Fi" "eldPresenceB\?\210\001\001\230\001\004\230\001\001\242\001\r\022\010EXPLICIT\030\204\007\242\001" "\r\022\010IMPLICIT\030\347\007\242\001\r\022\010EXPLICIT\030\350\007\262\001\003\010\350\007\022b\n\t" @@ -2121,59 +2124,65 @@ const char descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto[] AB "ED\030\204\007\262\001\003\010\350\007\022v\n\013json_format\030\006 \001(\0162&.googl" "e.protobuf.FeatureSet.JsonFormatB9\210\001\001\230\001\003" "\230\001\006\230\001\001\242\001\027\022\022LEGACY_BEST_EFFORT\030\204\007\242\001\n\022\005ALL" - "OW\030\347\007\262\001\003\010\350\007\"\\\n\rFieldPresence\022\032\n\026FIELD_PR" - "ESENCE_UNKNOWN\020\000\022\014\n\010EXPLICIT\020\001\022\014\n\010IMPLIC" - "IT\020\002\022\023\n\017LEGACY_REQUIRED\020\003\"7\n\010EnumType\022\025\n" - "\021ENUM_TYPE_UNKNOWN\020\000\022\010\n\004OPEN\020\001\022\n\n\006CLOSED" - "\020\002\"V\n\025RepeatedFieldEncoding\022#\n\037REPEATED_" - "FIELD_ENCODING_UNKNOWN\020\000\022\n\n\006PACKED\020\001\022\014\n\010" - "EXPANDED\020\002\"I\n\016Utf8Validation\022\033\n\027UTF8_VAL" - "IDATION_UNKNOWN\020\000\022\n\n\006VERIFY\020\002\022\010\n\004NONE\020\003\"" - "\004\010\001\020\001\"S\n\017MessageEncoding\022\034\n\030MESSAGE_ENCO" - "DING_UNKNOWN\020\000\022\023\n\017LENGTH_PREFIXED\020\001\022\r\n\tD" - "ELIMITED\020\002\"H\n\nJsonFormat\022\027\n\023JSON_FORMAT_" - "UNKNOWN\020\000\022\t\n\005ALLOW\020\001\022\026\n\022LEGACY_BEST_EFFO" - "RT\020\002*\006\010\350\007\020\213N*\006\010\213N\020\220N*\006\010\220N\020\221NJ\006\010\347\007\020\350\007\"\230\003\n" - "\022FeatureSetDefaults\022N\n\010defaults\030\001 \003(\0132<." - "google.protobuf.FeatureSetDefaults.Featu" - "reSetEditionDefault\0221\n\017minimum_edition\030\004" - " \001(\0162\030.google.protobuf.Edition\0221\n\017maximu" - "m_edition\030\005 \001(\0162\030.google.protobuf.Editio" - "n\032\313\001\n\030FeatureSetEditionDefault\022)\n\007editio" - "n\030\003 \001(\0162\030.google.protobuf.Edition\0229\n\024ove" - "rridable_features\030\004 \001(\0132\033.google.protobu" - "f.FeatureSet\0223\n\016fixed_features\030\005 \001(\0132\033.g" - "oogle.protobuf.FeatureSetJ\004\010\001\020\002J\004\010\002\020\003R\010f" - "eatures\"\343\001\n\016SourceCodeInfo\022:\n\010location\030\001" - " \003(\0132(.google.protobuf.SourceCodeInfo.Lo" - "cation\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_comments\030\003 \001(" - "\t\022\031\n\021trailing_comments\030\004 \001(\t\022!\n\031leading_" - "detached_comments\030\006 \003(\t*\014\010\200\354\312\377\001\020\201\354\312\377\001\"\234\002" - "\n\021GeneratedCodeInfo\022A\n\nannotation\030\001 \003(\0132" - "-.google.protobuf.GeneratedCodeInfo.Anno" - "tation\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\003e" - "nd\030\004 \001(\005\022H\n\010semantic\030\005 \001(\01626.google.prot" - "obuf.GeneratedCodeInfo.Annotation.Semant" - "ic\"(\n\010Semantic\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005ALI" - "AS\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_ONL" - "Y\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_TES" - "T_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.pro" - "tobufB\020DescriptorProtosH\001Z-google.golang" - ".org/protobuf/types/descriptorpb\370\001\001\242\002\003GP" - "B\252\002\032Google.Protobuf.Reflection" + "OW\030\347\007\262\001\003\010\350\007\022\227\001\n\024enforce_naming_style\030\007 \001" + "(\0162..google.protobuf.FeatureSet.EnforceN" + "amingStyleBI\210\001\002\230\001\001\230\001\002\230\001\003\230\001\004\230\001\005\230\001\006\230\001\007\230\001\010\230" + "\001\t\242\001\021\022\014STYLE_LEGACY\030\204\007\242\001\016\022\tSTYLE2024\030\351\007\262" + "\001\003\010\351\007\"\\\n\rFieldPresence\022\032\n\026FIELD_PRESENCE" + "_UNKNOWN\020\000\022\014\n\010EXPLICIT\020\001\022\014\n\010IMPLICIT\020\002\022\023" + "\n\017LEGACY_REQUIRED\020\003\"7\n\010EnumType\022\025\n\021ENUM_" + "TYPE_UNKNOWN\020\000\022\010\n\004OPEN\020\001\022\n\n\006CLOSED\020\002\"V\n\025" + "RepeatedFieldEncoding\022#\n\037REPEATED_FIELD_" + "ENCODING_UNKNOWN\020\000\022\n\n\006PACKED\020\001\022\014\n\010EXPAND" + "ED\020\002\"I\n\016Utf8Validation\022\033\n\027UTF8_VALIDATIO" + "N_UNKNOWN\020\000\022\n\n\006VERIFY\020\002\022\010\n\004NONE\020\003\"\004\010\001\020\001\"" + "S\n\017MessageEncoding\022\034\n\030MESSAGE_ENCODING_U" + "NKNOWN\020\000\022\023\n\017LENGTH_PREFIXED\020\001\022\r\n\tDELIMIT" + "ED\020\002\"H\n\nJsonFormat\022\027\n\023JSON_FORMAT_UNKNOW" + "N\020\000\022\t\n\005ALLOW\020\001\022\026\n\022LEGACY_BEST_EFFORT\020\002\"W" + "\n\022EnforceNamingStyle\022 \n\034ENFORCE_NAMING_S" + "TYLE_UNKNOWN\020\000\022\r\n\tSTYLE2024\020\001\022\020\n\014STYLE_L" + "EGACY\020\002*\006\010\350\007\020\213N*\006\010\213N\020\220N*\006\010\220N\020\221NJ\006\010\347\007\020\350\007\"" + "\230\003\n\022FeatureSetDefaults\022N\n\010defaults\030\001 \003(\013" + "2<.google.protobuf.FeatureSetDefaults.Fe" + "atureSetEditionDefault\0221\n\017minimum_editio" + "n\030\004 \001(\0162\030.google.protobuf.Edition\0221\n\017max" + "imum_edition\030\005 \001(\0162\030.google.protobuf.Edi" + "tion\032\313\001\n\030FeatureSetEditionDefault\022)\n\007edi" + "tion\030\003 \001(\0162\030.google.protobuf.Edition\0229\n\024" + "overridable_features\030\004 \001(\0132\033.google.prot" + "obuf.FeatureSet\0223\n\016fixed_features\030\005 \001(\0132" + "\033.google.protobuf.FeatureSetJ\004\010\001\020\002J\004\010\002\020\003" + "R\010features\"\343\001\n\016SourceCodeInfo\022:\n\010locatio" + "n\030\001 \003(\0132(.google.protobuf.SourceCodeInfo" + ".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_comments\030\003" + " \001(\t\022\031\n\021trailing_comments\030\004 \001(\t\022!\n\031leadi" + "ng_detached_comments\030\006 \003(\t*\014\010\200\354\312\377\001\020\201\354\312\377\001" + "\"\234\002\n\021GeneratedCodeInfo\022A\n\nannotation\030\001 \003" + "(\0132-.google.protobuf.GeneratedCodeInfo.A" + "nnotation\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.p" + "rotobuf.GeneratedCodeInfo.Annotation.Sem" + "antic\"(\n\010Semantic\022\010\n\004NONE\020\000\022\007\n\003SET\020\001\022\t\n\005" + "ALIAS\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_" + "ONLY\020\001\022\027\n\023EDITION_2_TEST_ONLY\020\002\022\035\n\027EDITI" + "ON_99997_TEST_ONLY\020\235\215\006\022\035\n\027EDITION_99998_" + "TEST_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." + "protobufB\020DescriptorProtosH\001Z-google.gol" + "ang.org/protobuf/types/descriptorpb\370\001\001\242\002" + "\003GPB\252\002\032Google.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, - 10110, + 10353, descriptor_table_protodef_google_2fprotobuf_2fdescriptor_2eproto, "google/protobuf/descriptor.proto", &descriptor_table_google_2fprotobuf_2fdescriptor_2eproto_once, @@ -2324,15 +2333,21 @@ const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_JsonFormat } PROTOBUF_CONSTINIT const uint32_t FeatureSet_JsonFormat_internal_data_[] = { 196608u, 0u, }; -const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL GeneratedCodeInfo_Annotation_Semantic_descriptor() { +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_EnforceNamingStyle_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[15]; } +PROTOBUF_CONSTINIT const uint32_t FeatureSet_EnforceNamingStyle_internal_data_[] = { + 196608u, 0u, }; +const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL GeneratedCodeInfo_Annotation_Semantic_descriptor() { + ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); + return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[16]; +} PROTOBUF_CONSTINIT const uint32_t GeneratedCodeInfo_Annotation_Semantic_internal_data_[] = { 196608u, 0u, }; const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL Edition_descriptor() { ::google::protobuf::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto); - return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[16]; + return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[17]; } PROTOBUF_CONSTINIT const uint32_t Edition_internal_data_[] = { 196608u, 589824u, 99997u, 1000u, 99999u, 998u, 1001u, 99998u, 2147483647u, 900u, 999u, }; @@ -13315,9 +13330,9 @@ FeatureSet::FeatureSet( offsetof(Impl_, field_presence_), reinterpret_cast(&from._impl_) + offsetof(Impl_, field_presence_), - offsetof(Impl_, json_format_) - + offsetof(Impl_, enforce_naming_style_) - offsetof(Impl_, field_presence_) + - sizeof(Impl_::json_format_)); + sizeof(Impl_::enforce_naming_style_)); // @@protoc_insertion_point(copy_constructor:google.protobuf.FeatureSet) } @@ -13332,9 +13347,9 @@ inline void FeatureSet::SharedCtor(::_pb::Arena* PROTOBUF_NULLABLE arena) { ::memset(reinterpret_cast(&_impl_) + offsetof(Impl_, field_presence_), 0, - offsetof(Impl_, json_format_) - + offsetof(Impl_, enforce_naming_style_) - offsetof(Impl_, field_presence_) + - sizeof(Impl_::json_format_)); + sizeof(Impl_::enforce_naming_style_)); } FeatureSet::~FeatureSet() { // @@protoc_insertion_point(destructor:google.protobuf.FeatureSet) @@ -13400,17 +13415,17 @@ const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL FeatureSet::GetC ::google::protobuf::internal::PrefetchToLocalCache(FeatureSet_class_data_.tc_table); return FeatureSet_class_data_.base(); } -constexpr ::_pbi::TcParseTable<3, 6, 6, 0, 2> +constexpr ::_pbi::TcParseTable<3, 7, 7, 0, 2> FeatureSet::_table_ = { { PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_._extensions_), - 6, 56, // max_field_number, fast_idx_mask + 7, 56, // max_field_number, fast_idx_mask offsetof(decltype(_table_), field_lookup_table), - 4294967232, // skipmap + 4294967168, // skipmap offsetof(decltype(_table_), field_entries), - 6, // num_field_entries - 6, // num_aux_entries + 7, // num_field_entries + 7, // num_aux_entries offsetof(decltype(_table_), aux_entries), FeatureSet_class_data_.base(), nullptr, // post_loop_handler @@ -13438,7 +13453,9 @@ FeatureSet::_table_ = { // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { {::_pbi::TcParser::FastEr0S1, {48, 5, 2, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.json_format_)}}, - {::_pbi::TcParser::MiniParse, {}}, + // optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { + {::_pbi::TcParser::FastEr0S1, + {56, 6, 2, PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.enforce_naming_style_)}}, }}, {{ 65535, 65535 }}, {{ @@ -13460,6 +13477,9 @@ FeatureSet::_table_ = { // optional .google.protobuf.FeatureSet.JsonFormat json_format = 6 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_FILE, edition_defaults = { {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.json_format_), _Internal::kHasBitsOffset + 5, 5, (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, + // optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { + {PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.enforce_naming_style_), _Internal::kHasBitsOffset + 6, 6, + (0 | ::_fl::kFcOptional | ::_fl::kEnumRange)}, }}, {{ {0, 4}, @@ -13468,6 +13488,7 @@ FeatureSet::_table_ = { {::_pbi::FieldAuxEnumData{}, ::google::protobuf::FeatureSet_Utf8Validation_internal_data_}, {0, 3}, {0, 3}, + {0, 3}, }}, {{ }}, @@ -13481,10 +13502,10 @@ PROTOBUF_NOINLINE void FeatureSet::Clear() { _impl_._extensions_.Clear(); cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { + if (cached_has_bits & 0x0000007fu) { ::memset(&_impl_.field_presence_, 0, static_cast<::size_t>( - reinterpret_cast(&_impl_.json_format_) - - reinterpret_cast(&_impl_.field_presence_)) + sizeof(_impl_.json_format_)); + reinterpret_cast(&_impl_.enforce_naming_style_) - + reinterpret_cast(&_impl_.field_presence_)) + sizeof(_impl_.enforce_naming_style_)); } _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::google::protobuf::UnknownFieldSet>(); @@ -13548,6 +13569,13 @@ ::uint8_t* PROTOBUF_NONNULL FeatureSet::_InternalSerialize( 6, this_._internal_json_format(), target); } + // optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteEnumToArray( + 7, this_._internal_enforce_naming_style(), target); + } + // All extensions. target = this_._impl_._extensions_._InternalSerializeAll(&default_instance(), target, stream); @@ -13577,7 +13605,7 @@ ::size_t FeatureSet::ByteSizeLong() const { ::_pbi::Prefetch5LinesFrom7Lines(&this_); cached_has_bits = this_._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { + if (cached_has_bits & 0x0000007fu) { // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { if (cached_has_bits & 0x00000001u) { total_size += 1 + @@ -13608,6 +13636,11 @@ ::size_t FeatureSet::ByteSizeLong() const { total_size += 1 + ::_pbi::WireFormatLite::EnumSize(this_._internal_json_format()); } + // optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { + if (cached_has_bits & 0x00000040u) { + total_size += 1 + + ::_pbi::WireFormatLite::EnumSize(this_._internal_enforce_naming_style()); + } } return this_.MaybeComputeUnknownFieldsSize(total_size, &this_._impl_._cached_size_); @@ -13622,7 +13655,7 @@ void FeatureSet::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goog (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { + if (cached_has_bits & 0x0000007fu) { if (cached_has_bits & 0x00000001u) { _this->_impl_.field_presence_ = from._impl_.field_presence_; } @@ -13641,6 +13674,9 @@ void FeatureSet::MergeImpl(::google::protobuf::MessageLite& to_msg, const ::goog if (cached_has_bits & 0x00000020u) { _this->_impl_.json_format_ = from._impl_.json_format_; } + if (cached_has_bits & 0x00000040u) { + _this->_impl_.enforce_naming_style_ = from._impl_.enforce_naming_style_; + } } _this->_impl_._has_bits_[0] |= cached_has_bits; _this->_impl_._extensions_.MergeFrom(&default_instance(), from._impl_._extensions_); @@ -13669,8 +13705,8 @@ void FeatureSet::InternalSwap(FeatureSet* PROTOBUF_RESTRICT PROTOBUF_NONNULL oth _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::google::protobuf::internal::memswap< - PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.json_format_) - + sizeof(FeatureSet::_impl_.json_format_) + PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.enforce_naming_style_) + + sizeof(FeatureSet::_impl_.enforce_naming_style_) - PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_.field_presence_)>( reinterpret_cast(&_impl_.field_presence_), reinterpret_cast(&other->_impl_.field_presence_)); diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index e14c5168896df..ca33551a67297 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -59,6 +59,8 @@ enum Edition : int; PROTOBUF_EXPORT extern const uint32_t Edition_internal_data_[]; enum ExtensionRangeOptions_VerificationState : int; PROTOBUF_EXPORT extern const uint32_t ExtensionRangeOptions_VerificationState_internal_data_[]; +enum FeatureSet_EnforceNamingStyle : int; +PROTOBUF_EXPORT extern const uint32_t FeatureSet_EnforceNamingStyle_internal_data_[]; enum FeatureSet_EnumType : int; PROTOBUF_EXPORT extern const uint32_t FeatureSet_EnumType_internal_data_[]; enum FeatureSet_FieldPresence : int; @@ -228,6 +230,9 @@ template <> internal::EnumTraitsT<::google::protobuf::ExtensionRangeOptions_VerificationState_internal_data_> internal::EnumTraitsImpl::value<::google::protobuf::ExtensionRangeOptions_VerificationState>; template <> +internal::EnumTraitsT<::google::protobuf::FeatureSet_EnforceNamingStyle_internal_data_> + internal::EnumTraitsImpl::value<::google::protobuf::FeatureSet_EnforceNamingStyle>; +template <> internal::EnumTraitsT<::google::protobuf::FeatureSet_EnumType_internal_data_> internal::EnumTraitsImpl::value<::google::protobuf::FeatureSet_EnumType>; template <> @@ -799,6 +804,39 @@ inline bool FeatureSet_JsonFormat_Parse( return ::google::protobuf::internal::ParseNamedEnum(FeatureSet_JsonFormat_descriptor(), name, value); } +enum FeatureSet_EnforceNamingStyle : int { + FeatureSet_EnforceNamingStyle_ENFORCE_NAMING_STYLE_UNKNOWN = 0, + FeatureSet_EnforceNamingStyle_STYLE2024 = 1, + FeatureSet_EnforceNamingStyle_STYLE_LEGACY = 2, +}; + +PROTOBUF_EXPORT extern const uint32_t FeatureSet_EnforceNamingStyle_internal_data_[]; +inline constexpr FeatureSet_EnforceNamingStyle FeatureSet_EnforceNamingStyle_EnforceNamingStyle_MIN = + static_cast(0); +inline constexpr FeatureSet_EnforceNamingStyle FeatureSet_EnforceNamingStyle_EnforceNamingStyle_MAX = + static_cast(2); +inline bool FeatureSet_EnforceNamingStyle_IsValid(int value) { + return 0 <= value && value <= 2; +} +inline constexpr int FeatureSet_EnforceNamingStyle_EnforceNamingStyle_ARRAYSIZE = 2 + 1; +PROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL FeatureSet_EnforceNamingStyle_descriptor(); +template +const std::string& FeatureSet_EnforceNamingStyle_Name(T value) { + static_assert(std::is_same::value || + std::is_integral::value, + "Incorrect type passed to EnforceNamingStyle_Name()."); + return FeatureSet_EnforceNamingStyle_Name(static_cast(value)); +} +template <> +inline const std::string& FeatureSet_EnforceNamingStyle_Name(FeatureSet_EnforceNamingStyle value) { + return ::google::protobuf::internal::NameOfDenseEnum( + static_cast(value)); +} +inline bool FeatureSet_EnforceNamingStyle_Parse( + absl::string_view name, FeatureSet_EnforceNamingStyle* PROTOBUF_NONNULL value) { + return ::google::protobuf::internal::ParseNamedEnum(FeatureSet_EnforceNamingStyle_descriptor(), name, + value); +} enum GeneratedCodeInfo_Annotation_Semantic : int { GeneratedCodeInfo_Annotation_Semantic_NONE = 0, GeneratedCodeInfo_Annotation_Semantic_SET = 1, @@ -2366,6 +2404,27 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message absl::string_view name, JsonFormat* PROTOBUF_NONNULL value) { return FeatureSet_JsonFormat_Parse(name, value); } + using EnforceNamingStyle = FeatureSet_EnforceNamingStyle; + static constexpr EnforceNamingStyle ENFORCE_NAMING_STYLE_UNKNOWN = FeatureSet_EnforceNamingStyle_ENFORCE_NAMING_STYLE_UNKNOWN; + static constexpr EnforceNamingStyle STYLE2024 = FeatureSet_EnforceNamingStyle_STYLE2024; + static constexpr EnforceNamingStyle STYLE_LEGACY = FeatureSet_EnforceNamingStyle_STYLE_LEGACY; + static inline bool EnforceNamingStyle_IsValid(int value) { + return FeatureSet_EnforceNamingStyle_IsValid(value); + } + static constexpr EnforceNamingStyle EnforceNamingStyle_MIN = FeatureSet_EnforceNamingStyle_EnforceNamingStyle_MIN; + static constexpr EnforceNamingStyle EnforceNamingStyle_MAX = FeatureSet_EnforceNamingStyle_EnforceNamingStyle_MAX; + static constexpr int EnforceNamingStyle_ARRAYSIZE = FeatureSet_EnforceNamingStyle_EnforceNamingStyle_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL EnforceNamingStyle_descriptor() { + return FeatureSet_EnforceNamingStyle_descriptor(); + } + template + static inline const std::string& EnforceNamingStyle_Name(T value) { + return FeatureSet_EnforceNamingStyle_Name(value); + } + static inline bool EnforceNamingStyle_Parse( + absl::string_view name, EnforceNamingStyle* PROTOBUF_NONNULL value) { + return FeatureSet_EnforceNamingStyle_Parse(name, value); + } // accessors ------------------------------------------------------- enum : int { @@ -2375,6 +2434,7 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message kUtf8ValidationFieldNumber = 4, kMessageEncodingFieldNumber = 5, kJsonFormatFieldNumber = 6, + kEnforceNamingStyleFieldNumber = 7, }; // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { bool has_field_presence() const; @@ -2441,6 +2501,17 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message ::google::protobuf::FeatureSet_JsonFormat _internal_json_format() const; void _internal_set_json_format(::google::protobuf::FeatureSet_JsonFormat value); + public: + // optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { + bool has_enforce_naming_style() const; + void clear_enforce_naming_style() ; + ::google::protobuf::FeatureSet_EnforceNamingStyle enforce_naming_style() const; + void set_enforce_naming_style(::google::protobuf::FeatureSet_EnforceNamingStyle value); + + private: + ::google::protobuf::FeatureSet_EnforceNamingStyle _internal_enforce_naming_style() const; + void _internal_set_enforce_naming_style(::google::protobuf::FeatureSet_EnforceNamingStyle value); + public: template _table_; @@ -2652,6 +2723,7 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message int utf8_validation_; int message_encoding_; int json_format_; + int enforce_naming_style_; PROTOBUF_TSAN_DECLARE_MEMBER }; union { Impl_ _impl_; }; @@ -20222,6 +20294,37 @@ inline void FeatureSet::_internal_set_json_format(::google::protobuf::FeatureSet _impl_.json_format_ = value; } +// optional .google.protobuf.FeatureSet.EnforceNamingStyle enforce_naming_style = 7 [retention = RETENTION_SOURCE, targets = TARGET_TYPE_FILE, targets = TARGET_TYPE_EXTENSION_RANGE, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_ONEOF, targets = TARGET_TYPE_ENUM, targets = TARGET_TYPE_ENUM_ENTRY, targets = TARGET_TYPE_SERVICE, targets = TARGET_TYPE_METHOD, edition_defaults = { +inline bool FeatureSet::has_enforce_naming_style() const { + bool value = (_impl_._has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline void FeatureSet::clear_enforce_naming_style() { + ::google::protobuf::internal::TSanWrite(&_impl_); + _impl_.enforce_naming_style_ = 0; + _impl_._has_bits_[0] &= ~0x00000040u; +} +inline ::google::protobuf::FeatureSet_EnforceNamingStyle FeatureSet::enforce_naming_style() const { + // @@protoc_insertion_point(field_get:google.protobuf.FeatureSet.enforce_naming_style) + return _internal_enforce_naming_style(); +} +inline void FeatureSet::set_enforce_naming_style(::google::protobuf::FeatureSet_EnforceNamingStyle value) { + _internal_set_enforce_naming_style(value); + _impl_._has_bits_[0] |= 0x00000040u; + // @@protoc_insertion_point(field_set:google.protobuf.FeatureSet.enforce_naming_style) +} +inline ::google::protobuf::FeatureSet_EnforceNamingStyle FeatureSet::_internal_enforce_naming_style() const { + ::google::protobuf::internal::TSanRead(&_impl_); + return static_cast<::google::protobuf::FeatureSet_EnforceNamingStyle>(_impl_.enforce_naming_style_); +} +inline void FeatureSet::_internal_set_enforce_naming_style(::google::protobuf::FeatureSet_EnforceNamingStyle value) { + ::google::protobuf::internal::TSanWrite(&_impl_); + + assert(::google::protobuf::internal::ValidateEnum( + value, ::google::protobuf::FeatureSet_EnforceNamingStyle_internal_data_)); + _impl_.enforce_naming_style_ = value; +} + // ------------------------------------------------------------------- // FeatureSetDefaults_FeatureSetEditionDefault @@ -21284,6 +21387,12 @@ inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protob return ::google::protobuf::FeatureSet_JsonFormat_descriptor(); } template <> +struct is_proto_enum<::google::protobuf::FeatureSet_EnforceNamingStyle> : std::true_type {}; +template <> +inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::FeatureSet_EnforceNamingStyle>() { + return ::google::protobuf::FeatureSet_EnforceNamingStyle_descriptor(); +} +template <> struct is_proto_enum<::google::protobuf::GeneratedCodeInfo_Annotation_Semantic> : std::true_type {}; template <> inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::google::protobuf::GeneratedCodeInfo_Annotation_Semantic>() { diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto index dd2d0fbf491f5..ac3de48de1f12 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -1098,6 +1098,29 @@ message FeatureSet { edition_defaults = { edition: EDITION_PROTO3, value: "ALLOW" } ]; + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0; + STYLE2024 = 1; + STYLE_LEGACY = 2; + } + optional EnforceNamingStyle enforce_naming_style = 7 [ + retention = RETENTION_SOURCE, + targets = TARGET_TYPE_FILE, + targets = TARGET_TYPE_EXTENSION_RANGE, + targets = TARGET_TYPE_MESSAGE, + targets = TARGET_TYPE_FIELD, + targets = TARGET_TYPE_ONEOF, + targets = TARGET_TYPE_ENUM, + targets = TARGET_TYPE_ENUM_ENTRY, + targets = TARGET_TYPE_SERVICE, + targets = TARGET_TYPE_METHOD, + feature_support = { + edition_introduced: EDITION_2024, + }, + edition_defaults = { edition: EDITION_LEGACY, value: "STYLE_LEGACY" }, + edition_defaults = { edition: EDITION_2024, value: "STYLE2024" } + ]; + reserved 999; extensions 1000 to 9994 [ diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc index 94f3fd2088fce..d8bcac9a87336 100644 --- a/src/google/protobuf/descriptor_unittest.cc +++ b/src/google/protobuf/descriptor_unittest.cc @@ -7881,6 +7881,7 @@ TEST_F(FeaturesTest, Proto2Features) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: true string_type: STRING @@ -7893,6 +7894,7 @@ TEST_F(FeaturesTest, Proto2Features) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: true string_type: STRING @@ -7905,6 +7907,7 @@ TEST_F(FeaturesTest, Proto2Features) { utf8_validation: NONE message_encoding: DELIMITED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: true string_type: STRING @@ -7982,6 +7985,7 @@ TEST_F(FeaturesTest, Proto3Features) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -7994,6 +7998,7 @@ TEST_F(FeaturesTest, Proto3Features) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -8174,6 +8179,7 @@ TEST_F(FeaturesTest, Edition2023Defaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -8257,6 +8263,7 @@ TEST_F(FeaturesTest, Edition2024Defaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE2024 [pb.cpp] { legacy_closed_enum: false string_type: VIEW @@ -8290,6 +8297,7 @@ TEST_F(FeaturesBaseTest, DefaultEdition2023Defaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -8318,6 +8326,7 @@ TEST_F(FeaturesTest, ClearsOptions) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -8686,6 +8695,7 @@ TEST_F(FeaturesTest, NoOptions) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -8719,6 +8729,7 @@ TEST_F(FeaturesTest, FileFeatures) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -8800,6 +8811,7 @@ TEST_F(FeaturesTest, MessageFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -8911,6 +8923,7 @@ TEST_F(FeaturesTest, FieldFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9385,6 +9398,7 @@ TEST_F(FeaturesTest, EnumFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9500,6 +9514,7 @@ TEST_F(FeaturesTest, EnumValueFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9599,6 +9614,7 @@ TEST_F(FeaturesTest, OneofFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9707,6 +9723,7 @@ TEST_F(FeaturesTest, ExtensionRangeFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9800,6 +9817,7 @@ TEST_F(FeaturesTest, ServiceFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -9870,6 +9888,7 @@ TEST_F(FeaturesTest, MethodFeaturesDefault) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -10967,6 +10986,7 @@ TEST_F(FeaturesTest, UninterpretedOptions) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.cpp] { legacy_closed_enum: false string_type: STRING @@ -11687,6 +11707,7 @@ TEST_F(DescriptorPoolFeaturesTest, OverrideDefaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY } } minimum_edition: EDITION_PROTO2 @@ -11709,6 +11730,7 @@ TEST_F(DescriptorPoolFeaturesTest, OverrideDefaults) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY )pb")); } diff --git a/src/google/protobuf/feature_resolver.cc b/src/google/protobuf/feature_resolver.cc index 6791b26992095..958ab5d340b05 100644 --- a/src/google/protobuf/feature_resolver.cc +++ b/src/google/protobuf/feature_resolver.cc @@ -351,6 +351,8 @@ absl::Status ValidateMergedFeatures(const FeatureSet& features) { CHECK_ENUM_FEATURE(utf8_validation, Utf8Validation, UTF8_VALIDATION) CHECK_ENUM_FEATURE(message_encoding, MessageEncoding, MESSAGE_ENCODING) CHECK_ENUM_FEATURE(json_format, JsonFormat, JSON_FORMAT) + CHECK_ENUM_FEATURE(enforce_naming_style, EnforceNamingStyle, + ENFORCE_NAMING_STYLE) #undef CHECK_ENUM_FEATURE diff --git a/src/google/protobuf/feature_resolver_test.cc b/src/google/protobuf/feature_resolver_test.cc index 60b1f7b565fd7..48c2bbfdd0f46 100644 --- a/src/google/protobuf/feature_resolver_test.cc +++ b/src/google/protobuf/feature_resolver_test.cc @@ -1846,6 +1846,7 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) { utf8_validation: NONE message_encoding: LENGTH_PREFIXED json_format: LEGACY_BEST_EFFORT + enforce_naming_style: STYLE_LEGACY [pb.test] { file_feature: VALUE1 } } } @@ -1861,6 +1862,7 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE_LEGACY [pb.test] { file_feature: VALUE1 } } } @@ -1875,6 +1877,23 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) { json_format: ALLOW [pb.test] { file_feature: VALUE2 } } + fixed_features { + enforce_naming_style: STYLE_LEGACY + [pb.test] {} + } + } + defaults { + edition: EDITION_2024 + overridable_features { + field_presence: EXPLICIT + enum_type: OPEN + repeated_field_encoding: PACKED + utf8_validation: VERIFY + message_encoding: LENGTH_PREFIXED + json_format: ALLOW + enforce_naming_style: STYLE2024 + [pb.test] { file_feature: VALUE2 } + } fixed_features { [pb.test] {} } @@ -1888,6 +1907,7 @@ TEST_F(FeatureResolverPoolTest, CompileDefaultsMinimumCovered) { utf8_validation: VERIFY message_encoding: LENGTH_PREFIXED json_format: ALLOW + enforce_naming_style: STYLE2024 [pb.test] { file_feature: VALUE3 } } fixed_features { diff --git a/upb/reflection/stage0/google/protobuf/descriptor.upb.c b/upb/reflection/stage0/google/protobuf/descriptor.upb.c index f252ddc3262ed..728859e0dc0fa 100644 --- a/upb/reflection/stage0/google/protobuf/descriptor.upb.c +++ b/upb/reflection/stage0/google/protobuf/descriptor.upb.c @@ -332,7 +332,7 @@ const upb_MiniTable* google__protobuf__UninterpretedOption__NamePart_msg_init() const upb_MiniTable* google__protobuf__FeatureSet_msg_init() { static upb_MiniTable* mini_table = NULL; - static const char* mini_descriptor = "$P444444"; + static const char* mini_descriptor = "$P4444444"; if (mini_table) return mini_table; mini_table = upb_MiniTable_Build(mini_descriptor, strlen(mini_descriptor), @@ -343,6 +343,7 @@ const upb_MiniTable* google__protobuf__FeatureSet_msg_init() { upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 4), google__protobuf__FeatureSet__Utf8Validation_enum_init()); upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 5), google__protobuf__FeatureSet__MessageEncoding_enum_init()); upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 6), google__protobuf__FeatureSet__JsonFormat_enum_init()); + upb_MiniTable_SetSubEnum(mini_table, (upb_MiniTableField*)upb_MiniTable_FindFieldByNumber(mini_table, 7), google__protobuf__FeatureSet__EnforceNamingStyle_enum_init()); return mini_table; } @@ -435,6 +436,16 @@ const upb_MiniTableEnum* google__protobuf__ExtensionRangeOptions__VerificationSt return mini_table; } +const upb_MiniTableEnum* google__protobuf__FeatureSet__EnforceNamingStyle_enum_init() { + static const upb_MiniTableEnum* mini_table = NULL; + static const char* mini_descriptor = "!)"; + if (mini_table) return mini_table; + mini_table = + upb_MiniTableEnum_Build(mini_descriptor, strlen(mini_descriptor), + upb_BootstrapArena(), NULL); + return mini_table; +} + const upb_MiniTableEnum* google__protobuf__FeatureSet__EnumType_enum_init() { static const upb_MiniTableEnum* mini_table = NULL; static const char* mini_descriptor = "!)"; diff --git a/upb/reflection/stage0/google/protobuf/descriptor.upb.h b/upb/reflection/stage0/google/protobuf/descriptor.upb.h index 5f5fb70150990..7edf8747507bd 100644 --- a/upb/reflection/stage0/google/protobuf/descriptor.upb.h +++ b/upb/reflection/stage0/google/protobuf/descriptor.upb.h @@ -53,6 +53,7 @@ extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo_msg_init(void); extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo__Annotation_msg_init(void); extern const upb_MiniTableEnum* google__protobuf__Edition_enum_init(void); extern const upb_MiniTableEnum* google__protobuf__ExtensionRangeOptions__VerificationState_enum_init(void); +extern const upb_MiniTableEnum* google__protobuf__FeatureSet__EnforceNamingStyle_enum_init(void); extern const upb_MiniTableEnum* google__protobuf__FeatureSet__EnumType_enum_init(void); extern const upb_MiniTableEnum* google__protobuf__FeatureSet__FieldPresence_enum_init(void); extern const upb_MiniTableEnum* google__protobuf__FeatureSet__JsonFormat_enum_init(void); @@ -123,6 +124,12 @@ typedef enum { google_protobuf_ExtensionRangeOptions_UNVERIFIED = 1 } google_protobuf_ExtensionRangeOptions_VerificationState; +typedef enum { + google_protobuf_FeatureSet_ENFORCE_NAMING_STYLE_UNKNOWN = 0, + google_protobuf_FeatureSet_STYLE2024 = 1, + google_protobuf_FeatureSet_STYLE_LEGACY = 2 +} google_protobuf_FeatureSet_EnforceNamingStyle; + typedef enum { google_protobuf_FeatureSet_ENUM_TYPE_UNKNOWN = 0, google_protobuf_FeatureSet_OPEN = 1, @@ -5820,6 +5827,22 @@ UPB_INLINE bool google_protobuf_FeatureSet_has_json_format(const google_protobuf const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 6); return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); } +UPB_INLINE void google_protobuf_FeatureSet_clear_enforce_naming_style(google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 7); + upb_Message_ClearBaseField(UPB_UPCAST(msg), &field); +} +UPB_INLINE int32_t google_protobuf_FeatureSet_enforce_naming_style(const google_protobuf_FeatureSet* msg) { + int32_t default_val = 0; + int32_t ret; + const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 7); + _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, + &default_val, &ret); + return ret; +} +UPB_INLINE bool google_protobuf_FeatureSet_has_enforce_naming_style(const google_protobuf_FeatureSet* msg) { + const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 7); + return upb_Message_HasBaseField(UPB_UPCAST(msg), &field); +} UPB_INLINE void google_protobuf_FeatureSet_set_field_presence(google_protobuf_FeatureSet *msg, int32_t value) { const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 1); @@ -5845,6 +5868,10 @@ UPB_INLINE void google_protobuf_FeatureSet_set_json_format(google_protobuf_Featu const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 6); upb_Message_SetBaseField((upb_Message *)msg, &field, &value); } +UPB_INLINE void google_protobuf_FeatureSet_set_enforce_naming_style(google_protobuf_FeatureSet *msg, int32_t value) { + const upb_MiniTableField field = *upb_MiniTable_FindFieldByNumber(google__protobuf__FeatureSet_msg_init(), 7); + upb_Message_SetBaseField((upb_Message *)msg, &field, &value); +} /* google.protobuf.FeatureSetDefaults */