From 23aada230b2478c7a07fe7612489eb8e79b9c379 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 3 Sep 2024 09:11:52 -0700 Subject: [PATCH] Add `[[deprecated]]` attribute when generating enums and classes. When the user adds `option deprecated = true` for an `enum` or `message`, we should add the `[[deprecated]]` attribute to the generated C++ `enum` or `class`. PiperOrigin-RevId: 670583253 --- ci/Linux.bazelrc | 2 +- ci/macOS.bazelrc | 2 +- src/google/protobuf/compiler/cpp/enum.cc | 3 +- src/google/protobuf/compiler/cpp/message.cc | 4 +- .../protobuf/compiler/java/java_features.pb.h | 3 +- src/google/protobuf/compiler/plugin.pb.h | 12 ++- src/google/protobuf/cpp_features.pb.h | 3 +- src/google/protobuf/descriptor.pb.h | 99 ++++++++++++------- src/google/protobuf/unittest.proto | 7 ++ 9 files changed, 92 insertions(+), 43 deletions(-) diff --git a/ci/Linux.bazelrc b/ci/Linux.bazelrc index 657dcdc5f53b..b4ec98f8c796 100644 --- a/ci/Linux.bazelrc +++ b/ci/Linux.bazelrc @@ -1,4 +1,4 @@ import common.bazelrc build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 -build --copt="-Werror" --copt="-Wno-sign-compare" --copt="-Wno-sign-conversion" --copt="-Wno-error=sign-conversion" +build --copt="-Werror" --copt="-Wno-sign-compare" --copt="-Wno-sign-conversion" --copt="-Wno-error=sign-conversion" --copt="-Wno-deprecated-declarations" diff --git a/ci/macOS.bazelrc b/ci/macOS.bazelrc index 21a44acf3392..e426b59f5799 100644 --- a/ci/macOS.bazelrc +++ b/ci/macOS.bazelrc @@ -1,6 +1,6 @@ import common.bazelrc build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 -build --copt="-Werror" --copt="-Wno-sign-compare" --copt="-Wno-sign-conversion" --copt="-Wno-error=sign-conversion" +build --copt="-Werror" --copt="-Wno-sign-compare" --copt="-Wno-sign-conversion" --copt="-Wno-error=sign-conversion" --copt="-Wno-deprecated-declarations" common --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1 common --xcode_version_config=@com_google_protobuf//.github:host_xcodes \ No newline at end of file diff --git a/src/google/protobuf/compiler/cpp/enum.cc b/src/google/protobuf/compiler/cpp/enum.cc index ba56b4bb5af4..969c657d7988 100644 --- a/src/google/protobuf/compiler/cpp/enum.cc +++ b/src/google/protobuf/compiler/cpp/enum.cc @@ -44,6 +44,7 @@ absl::flat_hash_map EnumVars( const EnumValueDescriptor* min, const EnumValueDescriptor* max) { auto classname = ClassName(enum_, false); return { + {"DEPRECATED", enum_->options().deprecated() ? "[[deprecated]]" : ""}, {"Enum", std::string(enum_->name())}, {"Enum_", ResolveKeyword(enum_->name())}, {"Msg_Enum", classname}, @@ -162,7 +163,7 @@ void EnumGenerator::GenerateDefinition(io::Printer* p) { }}, }, R"cc( - enum $Msg_Enum_annotated$ : int { + enum $DEPRECATED $$Msg_Enum_annotated$ : int { $values$, $open_enum_sentinels$, }; diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc index 2d8c806106d1..23755a13b9e1 100644 --- a/src/google/protobuf/compiler/cpp/message.cc +++ b/src/google/protobuf/compiler/cpp/message.cc @@ -501,6 +501,7 @@ std::vector ClassVars(const Descriptor* desc, Options opts) { {"Msg", ClassName(desc, false)}, {"pkg::Msg", QualifiedClassName(desc, opts)}, {"pkg.Msg", desc->full_name()}, + {"deprecated", desc->options().deprecated() ? "[[deprecated]]" : ""}, // Old-style names, to be removed once all usages are gone in this and // other files. @@ -2060,7 +2061,8 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { )cc"); }}}, R"cc( - class $dllexport_decl $$classname$ final : public $superclass$ + class $dllexport_decl $$deprecated $$classname$ final + : public $superclass$ /* @@protoc_insertion_point(class_definition:$full_name$) */ { public: inline $classname$() : $classname$(nullptr) {} diff --git a/src/google/protobuf/compiler/java/java_features.pb.h b/src/google/protobuf/compiler/java/java_features.pb.h index add37c10b348..5ff2b9de6726 100644 --- a/src/google/protobuf/compiler/java/java_features.pb.h +++ b/src/google/protobuf/compiler/java/java_features.pb.h @@ -98,7 +98,8 @@ inline bool JavaFeatures_Utf8Validation_Parse(absl::string_view name, JavaFeatur // ------------------------------------------------------------------- -class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message +class PROTOC_EXPORT JavaFeatures final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:pb.JavaFeatures) */ { public: inline JavaFeatures() : JavaFeatures(nullptr) {} diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index e34fd5976b33..3fafe89543d8 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -115,7 +115,8 @@ inline bool CodeGeneratorResponse_Feature_Parse(absl::string_view name, CodeGene // ------------------------------------------------------------------- -class PROTOC_EXPORT Version final : public ::google::protobuf::Message +class PROTOC_EXPORT Version final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.Version) */ { public: inline Version() : Version(nullptr) {} @@ -351,7 +352,8 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf::Message +class PROTOC_EXPORT CodeGeneratorResponse_File final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse.File) */ { public: inline CodeGeneratorResponse_File() : CodeGeneratorResponse_File(nullptr) {} @@ -603,7 +605,8 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf }; // ------------------------------------------------------------------- -class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Message +class PROTOC_EXPORT CodeGeneratorResponse final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse) */ { public: inline CodeGeneratorResponse() : CodeGeneratorResponse(nullptr) {} @@ -879,7 +882,8 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes }; // ------------------------------------------------------------------- -class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Message +class PROTOC_EXPORT CodeGeneratorRequest final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorRequest) */ { public: inline CodeGeneratorRequest() : CodeGeneratorRequest(nullptr) {} diff --git a/src/google/protobuf/cpp_features.pb.h b/src/google/protobuf/cpp_features.pb.h index 22d009042b1c..97d4744bce40 100644 --- a/src/google/protobuf/cpp_features.pb.h +++ b/src/google/protobuf/cpp_features.pb.h @@ -99,7 +99,8 @@ inline bool CppFeatures_StringType_Parse(absl::string_view name, CppFeatures_Str // ------------------------------------------------------------------- -class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message +class PROTOBUF_EXPORT CppFeatures final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:pb.CppFeatures) */ { public: inline CppFeatures() : CppFeatures(nullptr) {} diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index de114bfda9f8..fb1df692acea 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -701,7 +701,8 @@ inline bool Edition_Parse(absl::string_view name, Edition* value) { // ------------------------------------------------------------------- -class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::protobuf::Message +class PROTOBUF_EXPORT UninterpretedOption_NamePart final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UninterpretedOption.NamePart) */ { public: inline UninterpretedOption_NamePart() : UninterpretedOption_NamePart(nullptr) {} @@ -916,7 +917,8 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf::Message +class PROTOBUF_EXPORT SourceCodeInfo_Location final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.SourceCodeInfo.Location) */ { public: inline SourceCodeInfo_Location() : SourceCodeInfo_Location(nullptr) {} @@ -1198,7 +1200,8 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::protobuf::Message +class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.GeneratedCodeInfo.Annotation) */ { public: inline GeneratedCodeInfo_Annotation() : GeneratedCodeInfo_Annotation(nullptr) {} @@ -1475,7 +1478,8 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::protobuf::Message +class PROTOBUF_EXPORT FieldOptions_FeatureSupport final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FieldOptions.FeatureSupport) */ { public: inline FieldOptions_FeatureSupport() : FieldOptions_FeatureSupport(nullptr) {} @@ -1711,7 +1715,8 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::protobuf::Message +class PROTOBUF_EXPORT FieldOptions_EditionDefault final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FieldOptions.EditionDefault) */ { public: inline FieldOptions_EditionDefault() : FieldOptions_EditionDefault(nullptr) {} @@ -1921,7 +1926,8 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message +class PROTOBUF_EXPORT FeatureSet final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FeatureSet) */ { public: inline FeatureSet() : FeatureSet(nullptr) {} @@ -2483,7 +2489,8 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google::protobuf::Message +class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ExtensionRangeOptions.Declaration) */ { public: inline ExtensionRangeOptions_Declaration() : ExtensionRangeOptions_Declaration(nullptr) {} @@ -2738,7 +2745,8 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::google::protobuf::Message +class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumDescriptorProto.EnumReservedRange) */ { public: inline EnumDescriptorProto_EnumReservedRange() : EnumDescriptorProto_EnumReservedRange(nullptr) {} @@ -2942,7 +2950,8 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::protobuf::Message +class PROTOBUF_EXPORT DescriptorProto_ReservedRange final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DescriptorProto.ReservedRange) */ { public: inline DescriptorProto_ReservedRange() : DescriptorProto_ReservedRange(nullptr) {} @@ -3146,7 +3155,8 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Message +class PROTOBUF_EXPORT UninterpretedOption final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UninterpretedOption) */ { public: inline UninterpretedOption() : UninterpretedOption(nullptr) {} @@ -3445,7 +3455,8 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message +class PROTOBUF_EXPORT SourceCodeInfo final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.SourceCodeInfo) */ { public: inline SourceCodeInfo() : SourceCodeInfo(nullptr) {} @@ -3642,7 +3653,8 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Message +class PROTOBUF_EXPORT GeneratedCodeInfo final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.GeneratedCodeInfo) */ { public: inline GeneratedCodeInfo() : GeneratedCodeInfo(nullptr) {} @@ -3839,7 +3851,8 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public ::google::protobuf::Message +class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) */ { public: inline FeatureSetDefaults_FeatureSetEditionDefault() : FeatureSetDefaults_FeatureSetEditionDefault(nullptr) {} @@ -4069,7 +4082,8 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message +class PROTOBUF_EXPORT ServiceOptions final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ServiceOptions) */ { public: inline ServiceOptions() : ServiceOptions(nullptr) {} @@ -4481,7 +4495,8 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message +class PROTOBUF_EXPORT OneofOptions final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.OneofOptions) */ { public: inline OneofOptions() : OneofOptions(nullptr) {} @@ -4880,7 +4895,8 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message +class PROTOBUF_EXPORT MethodOptions final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.MethodOptions) */ { public: inline MethodOptions() : MethodOptions(nullptr) {} @@ -5325,7 +5341,8 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message +class PROTOBUF_EXPORT MessageOptions final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.MessageOptions) */ { public: inline MessageOptions() : MessageOptions(nullptr) {} @@ -5789,7 +5806,8 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message +class PROTOBUF_EXPORT FileOptions final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FileOptions) */ { public: inline FileOptions() : FileOptions(nullptr) {} @@ -6515,7 +6533,8 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message +class PROTOBUF_EXPORT FieldOptions final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FieldOptions) */ { public: inline FieldOptions() : FieldOptions(nullptr) {} @@ -7177,7 +7196,8 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Message +class PROTOBUF_EXPORT FeatureSetDefaults final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FeatureSetDefaults) */ { public: inline FeatureSetDefaults() : FeatureSetDefaults(nullptr) {} @@ -7406,7 +7426,8 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::Message +class PROTOBUF_EXPORT ExtensionRangeOptions final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ExtensionRangeOptions) */ { public: inline ExtensionRangeOptions() : ExtensionRangeOptions(nullptr) {} @@ -7857,7 +7878,8 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Message +class PROTOBUF_EXPORT EnumValueOptions final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumValueOptions) */ { public: inline EnumValueOptions() : EnumValueOptions(nullptr) {} @@ -8299,7 +8321,8 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message +class PROTOBUF_EXPORT EnumOptions final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumOptions) */ { public: inline EnumOptions() : EnumOptions(nullptr) {} @@ -8737,7 +8760,8 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Message +class PROTOBUF_EXPORT OneofDescriptorProto final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.OneofDescriptorProto) */ { public: inline OneofDescriptorProto() : OneofDescriptorProto(nullptr) {} @@ -8956,7 +8980,8 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Me }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::Message +class PROTOBUF_EXPORT MethodDescriptorProto final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.MethodDescriptorProto) */ { public: inline MethodDescriptorProto() : MethodDescriptorProto(nullptr) {} @@ -9239,7 +9264,8 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Message +class PROTOBUF_EXPORT FieldDescriptorProto final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FieldDescriptorProto) */ { public: inline FieldDescriptorProto() : FieldDescriptorProto(nullptr) {} @@ -9654,7 +9680,8 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf::Message +class PROTOBUF_EXPORT EnumValueDescriptorProto final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumValueDescriptorProto) */ { public: inline EnumValueDescriptorProto() : EnumValueDescriptorProto(nullptr) {} @@ -9886,7 +9913,8 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::protobuf::Message +class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DescriptorProto.ExtensionRange) */ { public: inline DescriptorProto_ExtensionRange() : DescriptorProto_ExtensionRange(nullptr) {} @@ -10112,7 +10140,8 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf::Message +class PROTOBUF_EXPORT ServiceDescriptorProto final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ServiceDescriptorProto) */ { public: inline ServiceDescriptorProto() : ServiceDescriptorProto(nullptr) {} @@ -10350,7 +10379,8 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Message +class PROTOBUF_EXPORT EnumDescriptorProto final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumDescriptorProto) */ { public: inline EnumDescriptorProto() : EnumDescriptorProto(nullptr) {} @@ -10632,7 +10662,8 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message +class PROTOBUF_EXPORT DescriptorProto final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DescriptorProto) */ { public: inline DescriptorProto() : DescriptorProto(nullptr) {} @@ -11010,7 +11041,8 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Message +class PROTOBUF_EXPORT FileDescriptorProto final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FileDescriptorProto) */ { public: inline FileDescriptorProto() : FileDescriptorProto(nullptr) {} @@ -11437,7 +11469,8 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes }; // ------------------------------------------------------------------- -class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Message +class PROTOBUF_EXPORT FileDescriptorSet final + : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FileDescriptorSet) */ { public: inline FileDescriptorSet() : FileDescriptorSet(nullptr) {} diff --git a/src/google/protobuf/unittest.proto b/src/google/protobuf/unittest.proto index 9561ee6b1452..6e97be2f37b1 100644 --- a/src/google/protobuf/unittest.proto +++ b/src/google/protobuf/unittest.proto @@ -201,6 +201,13 @@ enum ForeignEnum { FOREIGN_LARGE = 123456; // Large enough to escape the Boxed Integer cache. } +enum TestDeprecatedEnum { + option deprecated = true; + TEST_DEPRECATED_ENUM_UNSPECIFIED = 0; + TEST_DEPRECATED_ENUM_VALUE1 = 1; + TEST_DEPRECATED_ENUM_VALUE2 = 2; +} + message TestReservedFields { reserved 2, 15, 9 to 11; reserved "bar", "baz";