|
|
@ -1137,12 +1137,18 @@ void FileGenerator::GenerateReflectionInitializationCode(io::Printer* p) { |
|
|
|
} |
|
|
|
} |
|
|
|
)cc"); |
|
|
|
)cc"); |
|
|
|
|
|
|
|
|
|
|
|
p->Emit({{"dummy", UniqueName("dynamic_init_dummy", file_, options_)}}, |
|
|
|
// For descriptor.proto we want to avoid doing any dynamic initialization,
|
|
|
|
R"cc( |
|
|
|
// because in some situations that would otherwise pull in a lot of
|
|
|
|
// Force running AddDescriptors() at dynamic initialization time.
|
|
|
|
// unnecessary code that can't be stripped by --gc-sections. Descriptor
|
|
|
|
PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 |
|
|
|
// initialization will still be performed lazily when it's needed.
|
|
|
|
static ::_pbi::AddDescriptorsRunner $dummy$(&$desc_table$); |
|
|
|
if (file_->name() != "net/proto2/proto/descriptor.proto") { |
|
|
|
)cc"); |
|
|
|
p->Emit({{"dummy", UniqueName("dynamic_init_dummy", file_, options_)}}, |
|
|
|
|
|
|
|
R"cc( |
|
|
|
|
|
|
|
// Force running AddDescriptors() at dynamic initialization time.
|
|
|
|
|
|
|
|
PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 |
|
|
|
|
|
|
|
static ::_pbi::AddDescriptorsRunner $dummy$(&$desc_table$); |
|
|
|
|
|
|
|
)cc"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// However, we must provide a way to force initialize the default instances
|
|
|
|
// However, we must provide a way to force initialize the default instances
|
|
|
|
// of FileDescriptorProto which will be used during registration of other
|
|
|
|
// of FileDescriptorProto which will be used during registration of other
|
|
|
|