Remove temporary opt-in for extension support of weak descriptor messages.

PiperOrigin-RevId: 640168936
pull/16998/head
Protobuf Team Bot 6 months ago committed by Copybara-Service
parent 6a70bcf575
commit d3a0f59af1
  1. 30
      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;
}

Loading…
Cancel
Save