From d3a0f59af1715686925af3acb3cc8266eaa3b969 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 4 Jun 2024 08:52:18 -0700 Subject: [PATCH] Remove temporary opt-in for extension support of weak descriptor messages. PiperOrigin-RevId: 640168936 --- src/google/protobuf/compiler/cpp/extension.cc | 30 ++----------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/src/google/protobuf/compiler/cpp/extension.cc b/src/google/protobuf/compiler/cpp/extension.cc index 84020ab8dc..1d95d61a55 100644 --- a/src/google/protobuf/compiler/cpp/extension.cc +++ b/src/google/protobuf/compiler/cpp/extension.cc @@ -209,7 +209,6 @@ void ExtensionGenerator::GenerateRegistration(io::Printer* p, if (using_implicit_weak_descriptors) { p->Emit({{"enum_name", ClassName(descriptor_->enum_type(), true)}}, R"cc( -#if defined(PROTOBUF_INTERNAL_TEMPORARY_WEAK_EXTENSION_OPT_IN) (::_pbi::ExtensionSet::ShouldRegisterAtThisTime( {{&$extendee_table$, $extendee_index$}}, $preregister$) ? ::_pbi::ExtensionSet::RegisterEnumExtension( @@ -218,10 +217,8 @@ void ExtensionGenerator::GenerateRegistration(io::Printer* p, $number$, $field_type$, $repeated$, $packed$, $enum_name$_IsValid) : (void)0), -#else )cc"); - } - if (priority == kInitPriority102) { + } else if (priority == kInitPriority102) { p->Emit({{"enum_name", ClassName(descriptor_->enum_type(), true)}}, R"cc( ::_pbi::ExtensionSet::RegisterEnumExtension( @@ -229,11 +226,6 @@ void ExtensionGenerator::GenerateRegistration(io::Printer* p, $repeated$, $packed$, $enum_name$_IsValid), )cc"); } - if (using_implicit_weak_descriptors) { - p->Emit(R"cc( -#endif - )cc"); - } break; case FieldDescriptor::CPPTYPE_MESSAGE: { @@ -261,7 +253,6 @@ void ExtensionGenerator::GenerateRegistration(io::Printer* p, {"extension_index", find_index(descriptor_->message_type())}, }, R"cc( -#if defined(PROTOBUF_INTERNAL_TEMPORARY_WEAK_EXTENSION_OPT_IN) (::_pbi::ExtensionSet::ShouldRegisterAtThisTime( {{&$extendee_table$, $extendee_index$}, {&$extension_table$, $extension_index$}}, @@ -274,10 +265,8 @@ void ExtensionGenerator::GenerateRegistration(io::Printer* p, &$extension_table$, $extension_index$, true), $verify$, ::_pbi::LazyAnnotation::$lazy$) : (void)0), -#else )cc"); - } - if (priority == kInitPriority102) { + } else if (priority == kInitPriority102) { p->Emit(R"cc( ::_pbi::ExtensionSet::RegisterMessageExtension( &$extendee$::default_instance(), $number$, $field_type$, @@ -285,18 +274,12 @@ void ExtensionGenerator::GenerateRegistration(io::Printer* p, $verify$, ::_pbi::LazyAnnotation::$lazy$), )cc"); } - if (using_implicit_weak_descriptors) { - p->Emit(R"cc( -#endif - )cc"); - } break; } default: if (using_implicit_weak_descriptors) { p->Emit(R"cc( -#if defined(PROTOBUF_INTERNAL_TEMPORARY_WEAK_EXTENSION_OPT_IN) (::_pbi::ExtensionSet::ShouldRegisterAtThisTime( {{&$extendee_table$, $extendee_index$}}, $preregister$) ? ::_pbi::ExtensionSet::RegisterExtension( @@ -305,10 +288,8 @@ void ExtensionGenerator::GenerateRegistration(io::Printer* p, true), $number$, $field_type$, $repeated$, $packed$) : (void)0), -#else )cc"); - } - if (priority == kInitPriority102) { + } else if (priority == kInitPriority102) { p->Emit( R"cc( ::_pbi::ExtensionSet::RegisterExtension( @@ -316,11 +297,6 @@ void ExtensionGenerator::GenerateRegistration(io::Printer* p, $repeated$, $packed$), )cc"); } - if (using_implicit_weak_descriptors) { - p->Emit(R"cc( -#endif - )cc"); - } break; }