Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an enforce_naming_style feature which will be implemented in Edition 2024. #19892

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions editions/generated_files_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions php/internal_generated_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 15 additions & 0 deletions src/google/protobuf/compiler/code_generator_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -292,6 +293,7 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaults) {
utf8_validation: VERIFY
message_encoding: LENGTH_PREFIXED
json_format: ALLOW
enforce_naming_style: STYLE_LEGACY
}
}
defaults {
Expand All @@ -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
Expand Down
34 changes: 33 additions & 1 deletion src/google/protobuf/compiler/command_line_interface_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -2023,6 +2024,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaults) {
utf8_validation: VERIFY
message_encoding: LENGTH_PREFIXED
json_format: ALLOW
enforce_naming_style: STYLE_LEGACY
}
}
defaults {
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -2075,6 +2078,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMaximum) {
utf8_validation: VERIFY
message_encoding: LENGTH_PREFIXED
json_format: ALLOW
enforce_naming_style: STYLE_LEGACY
}
}
defaults {
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -2128,6 +2146,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMinimum) {
utf8_validation: VERIFY
message_encoding: LENGTH_PREFIXED
json_format: ALLOW
enforce_naming_style: STYLE_LEGACY
}
}
defaults {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/google/protobuf/cpp_edition_defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading
Loading