From 6103d4ed13d21e96cb0989fa7d38d83061da0281 Mon Sep 17 00:00:00 2001 From: "pliard@google.com" Date: Fri, 4 May 2012 11:16:09 +0000 Subject: Don't call AddDesc() at static init time in LITE_RUNTIME mode. This patch makes the generation of StaticDescriptorInitializer_$filename$ depend on whether LITE_RUNTIME is enabled. Note that this works only when extensions are not used. This lets us significantly decrease the number of static initializers generated by protoc in LITE_RUNTIME mode (used in Chromium). In LITE_RUNTIME mode, $adddescriptorsname$() is called the first time that default_instance() is called (rather than being called during static init). To benefit from this patch in LITE_RUNTIME mode without extensions, compile with -DGOOGLE_PROTOBUF_NO_STATIC_INIT. BUG=351 --- src/google/protobuf/compiler/cpp/cpp_file.cc | 48 +++++++---- src/google/protobuf/compiler/cpp/cpp_helpers.cc | 60 ++++++++++++++ src/google/protobuf/compiler/cpp/cpp_helpers.h | 22 +++++ src/google/protobuf/compiler/cpp/cpp_message.cc | 94 ++++++++++++++++++---- .../protobuf/compiler/cpp/cpp_message_field.cc | 12 ++- src/google/protobuf/compiler/plugin.pb.cc | 11 +-- src/google/protobuf/descriptor.pb.cc | 62 +++++++++----- 7 files changed, 247 insertions(+), 62 deletions(-) (limited to 'src/google') diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc index 312ebc86..f4930610 100644 --- a/src/google/protobuf/compiler/cpp/cpp_file.cc +++ b/src/google/protobuf/compiler/cpp/cpp_file.cc @@ -381,11 +381,12 @@ void FileGenerator::GenerateSource(io::Printer* printer) { void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { // AddDescriptors() is a file-level procedure which adds the encoded - // FileDescriptorProto for this .proto file to the global DescriptorPool - // for generated files (DescriptorPool::generated_pool()). It always runs - // at static initialization time, so all files will be registered before - // main() starts. This procedure also constructs default instances and - // registers extensions. + // FileDescriptorProto for this .proto file to the global DescriptorPool for + // generated files (DescriptorPool::generated_pool()). It either runs at + // static initialization time (by default) or when default_instance() is + // called for the first time (in LITE_RUNTIME mode with + // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER flag enabled). This procedure also + // constructs default instances and registers extensions. // // Its sibling, AssignDescriptors(), actually pulls the compiled // FileDescriptor from the DescriptorPool and uses it to populate all of @@ -489,22 +490,27 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { printer->Outdent(); printer->Print( - "}\n"); + "}\n\n"); // ----------------------------------------------------------------- // Now generate the AddDescriptors() function. - printer->Print( - "\n" + PrintHandlingOptionalStaticInitializers( + file_, printer, + // With static initializers. + // Note that we don't need any special synchronization in the following code + // because it is called at static init time before any threads exist. "void $adddescriptorsname$() {\n" - // We don't need any special synchronization here because this code is - // called at static init time before any threads exist. " static bool already_here = false;\n" " if (already_here) return;\n" " already_here = true;\n" - " GOOGLE_PROTOBUF_VERIFY_VERSION;\n" - "\n", + " GOOGLE_PROTOBUF_VERIFY_VERSION;\n", + // Without. + "void $adddescriptorsname$_impl() {\n" + " GOOGLE_PROTOBUF_VERIFY_VERSION;\n", + // Vars. "adddescriptorsname", GlobalAddDescriptorsName(file_->name())); + printer->Indent(); // Call the AddDescriptors() methods for all of our dependencies, to make @@ -572,17 +578,27 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { "shutdownfilename", GlobalShutdownFileName(file_->name())); printer->Outdent(); - printer->Print( "}\n" - "\n" + "\n"); + + PrintHandlingOptionalStaticInitializers( + file_, printer, + // With static initializers. "// Force AddDescriptors() to be called at static initialization time.\n" "struct StaticDescriptorInitializer_$filename$ {\n" " StaticDescriptorInitializer_$filename$() {\n" " $adddescriptorsname$();\n" " }\n" - "} static_descriptor_initializer_$filename$_;\n" - "\n", + "} static_descriptor_initializer_$filename$_;\n", + // Without. + "::google::protobuf::GoogleOnceType $adddescriptorsname$_once_ =\n" + " GOOGLE_PROTOBUF_ONCE_INIT;\n" + "void $adddescriptorsname$() {\n" + " ::google::protobuf::GoogleOnceInit(&$adddescriptorsname$_once_,\n" + " &$adddescriptorsname$_impl);\n" + "}\n", + // Vars. "adddescriptorsname", GlobalAddDescriptorsName(file_->name()), "filename", FilenameIdentifier(file_->name())); } diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/src/google/protobuf/compiler/cpp/cpp_helpers.cc index 25b05a85..c4b868c2 100644 --- a/src/google/protobuf/compiler/cpp/cpp_helpers.cc +++ b/src/google/protobuf/compiler/cpp/cpp_helpers.cc @@ -33,10 +33,12 @@ // Sanjay Ghemawat, Jeff Dean, and others. #include +#include #include #include #include +#include #include #include #include @@ -105,6 +107,20 @@ string UnderscoresToCamelCase(const string& input, bool cap_next_letter) { return result; } +// Returns whether the provided descriptor has an extension. This includes its +// nested types. +bool HasExtension(const Descriptor* descriptor) { + if (descriptor->extension_count() > 0) { + return true; + } + for (int i = 0; i < descriptor->nested_type_count(); ++i) { + if (HasExtension(descriptor->nested_type(i))) { + return true; + } + } + return false; +} + } // namespace const char kThickSeparator[] = @@ -341,6 +357,50 @@ string EscapeTrigraphs(const string& to_escape) { return StringReplace(to_escape, "?", "\\?", true); } +bool StaticInitializersForced(const FileDescriptor* file) { + if (HasDescriptorMethods(file) || file->extension_count() > 0) { + return true; + } + for (int i = 0; i < file->message_type_count(); ++i) { + if (HasExtension(file->message_type(i))) { + return true; + } + } + return false; +} + +void PrintHandlingOptionalStaticInitializers( + const FileDescriptor* file, io::Printer* printer, + const char* with_static_init, const char* without_static_init, + const char* var1, const string& val1, + const char* var2, const string& val2) { + map vars; + if (var1) { + vars[var1] = val1; + } + if (var2) { + vars[var2] = val2; + } + PrintHandlingOptionalStaticInitializers( + vars, file, printer, with_static_init, without_static_init); +} + +void PrintHandlingOptionalStaticInitializers( + const map& vars, const FileDescriptor* file, + io::Printer* printer, const char* with_static_init, + const char* without_static_init) { + if (StaticInitializersForced(file)) { + printer->Print(vars, with_static_init); + } else { + printer->Print(vars, (string( + "#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER\n") + + without_static_init + + "#else\n" + + with_static_init + + "#endif\n").c_str()); + } +} + } // namespace cpp } // namespace compiler } // namespace protobuf diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.h b/src/google/protobuf/compiler/cpp/cpp_helpers.h index b13d53be..662a7c31 100644 --- a/src/google/protobuf/compiler/cpp/cpp_helpers.h +++ b/src/google/protobuf/compiler/cpp/cpp_helpers.h @@ -35,12 +35,18 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__ #define GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__ +#include #include #include #include namespace google { namespace protobuf { + +namespace io { +class Printer; +} + namespace compiler { namespace cpp { @@ -150,6 +156,22 @@ inline bool HasFastArraySerialization(const FileDescriptor* file) { return file->options().optimize_for() == FileOptions::SPEED; } +// Returns whether we have to generate code with static initializers. +bool StaticInitializersForced(const FileDescriptor* file); + +// Prints 'with_static_init' if static initializers have to be used for the +// provided file. Otherwise emits both 'with_static_init' and +// 'without_static_init' using #ifdef. +void PrintHandlingOptionalStaticInitializers( + const FileDescriptor* file, io::Printer* printer, + const char* with_static_init, const char* without_static_init, + const char* var1 = NULL, const string& val1 = "", + const char* var2 = NULL, const string& val2 = ""); + +void PrintHandlingOptionalStaticInitializers( + const map& vars, const FileDescriptor* file, + io::Printer* printer, const char* with_static_init, + const char* without_static_init); } // namespace cpp } // namespace compiler diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index c4e6fb2c..1c158be0 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -493,6 +493,19 @@ GenerateClassDefinition(io::Printer* printer) { "static const $classname$& default_instance();\n" "\n"); + if (!StaticInitializersForced(descriptor_->file())) { + printer->Print(vars, + "#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER\n" + "// Returns the internal default instance pointer. This function can\n" + "// return NULL thus should not be used by the user. This is intended\n" + "// for Protobuf internal code. Please use default_instance() declared\n" + "// above instead.\n" + "static inline const $classname$* internal_default_instance() {\n" + " return default_instance_;\n" + "}\n" + "#endif\n" + "\n"); + } printer->Print(vars, "void Swap($classname$* other);\n" @@ -660,11 +673,17 @@ GenerateClassDefinition(io::Printer* printer) { // Declare AddDescriptors(), BuildDescriptors(), and ShutdownFile() as // friends so that they can access private static variables like // default_instance_ and reflection_. - printer->Print( + PrintHandlingOptionalStaticInitializers( + descriptor_->file(), printer, + // With static initializers. "friend void $dllexport_decl$ $adddescriptorsname$();\n", + // Without. + "friend void $dllexport_decl$ $adddescriptorsname$_impl();\n", + // Vars. "dllexport_decl", dllexport_decl_, "adddescriptorsname", - GlobalAddDescriptorsName(descriptor_->file()->name())); + GlobalAddDescriptorsName(descriptor_->file()->name())); + printer->Print( "friend void $assigndescriptorsname$();\n" "friend void $shutdownfilename$();\n" @@ -981,8 +1000,12 @@ GenerateSharedDestructorCode(io::Printer* printer) { .GenerateDestructorCode(printer); } - printer->Print( - "if (this != default_instance_) {\n"); + PrintHandlingOptionalStaticInitializers( + descriptor_->file(), printer, + // With static initializers. + "if (this != default_instance_) {\n", + // Without. + "if (this != &default_instance()) {\n"); // We need to delete all embedded messages. // TODO(kenton): If we make unset messages point at default instances @@ -1034,10 +1057,16 @@ GenerateStructors(io::Printer* printer) { if (!field->is_repeated() && field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - printer->Print( - " $name$_ = const_cast< $type$*>(&$type$::default_instance());\n", - "name", FieldName(field), - "type", FieldMessageTypeName(field)); + PrintHandlingOptionalStaticInitializers( + descriptor_->file(), printer, + // With static initializers. + " $name$_ = const_cast< $type$*>(&$type$::default_instance());\n", + // Without. + " $name$_ = const_cast< $type$*>(\n" + " $type$::internal_default_instance());\n", + // Vars. + "name", FieldName(field), + "type", FieldMessageTypeName(field)); } } printer->Print( @@ -1093,8 +1122,20 @@ GenerateStructors(io::Printer* printer) { } printer->Print( - "const $classname$& $classname$::default_instance() {\n" - " if (default_instance_ == NULL) $adddescriptorsname$();" + "const $classname$& $classname$::default_instance() {\n", + "classname", classname_); + + PrintHandlingOptionalStaticInitializers( + descriptor_->file(), printer, + // With static initializers. + " if (default_instance_ == NULL) $adddescriptorsname$();\n", + // Without. + " $adddescriptorsname$();\n", + // Vars. + "adddescriptorsname", + GlobalAddDescriptorsName(descriptor_->file()->name())); + + printer->Print( " return *default_instance_;\n" "}\n" "\n" @@ -1106,7 +1147,6 @@ GenerateStructors(io::Printer* printer) { "classname", classname_, "adddescriptorsname", GlobalAddDescriptorsName(descriptor_->file()->name())); - } void MessageGenerator:: @@ -1377,11 +1417,22 @@ GenerateMergeFromCodedStream(io::Printer* printer) { // Special-case MessageSet. printer->Print( "bool $classname$::MergePartialFromCodedStream(\n" - " ::google::protobuf::io::CodedInputStream* input) {\n" + " ::google::protobuf::io::CodedInputStream* input) {\n", + "classname", classname_); + + PrintHandlingOptionalStaticInitializers( + descriptor_->file(), printer, + // With static initializers. " return _extensions_.ParseMessageSet(input, default_instance_,\n" - " mutable_unknown_fields());\n" - "}\n", + " mutable_unknown_fields());\n", + // Without. + " return _extensions_.ParseMessageSet(input, &default_instance(),\n" + " mutable_unknown_fields());\n", + // Vars. "classname", classname_); + + printer->Print( + "}\n"); return; } @@ -1541,12 +1592,21 @@ GenerateMergeFromCodedStream(io::Printer* printer) { } printer->Print(") {\n"); if (HasUnknownFields(descriptor_->file())) { - printer->Print( + PrintHandlingOptionalStaticInitializers( + descriptor_->file(), printer, + // With static initializers. " DO_(_extensions_.ParseField(tag, input, default_instance_,\n" + " mutable_unknown_fields()));\n", + // Without. + " DO_(_extensions_.ParseField(tag, input, &default_instance(),\n" " mutable_unknown_fields()));\n"); } else { - printer->Print( - " DO_(_extensions_.ParseField(tag, input, default_instance_));\n"); + PrintHandlingOptionalStaticInitializers( + descriptor_->file(), printer, + // With static initializers. + " DO_(_extensions_.ParseField(tag, input, default_instance_));\n", + // Without. + " DO_(_extensions_.ParseField(tag, input, &default_instance()));\n"); } printer->Print( " continue;\n" diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/src/google/protobuf/compiler/cpp/cpp_message_field.cc index 23e75b87..7c785e7e 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message_field.cc @@ -82,8 +82,16 @@ GenerateAccessorDeclarations(io::Printer* printer) const { void MessageFieldGenerator:: GenerateInlineAccessorDefinitions(io::Printer* printer) const { printer->Print(variables_, - "inline const $type$& $classname$::$name$() const {\n" - " return $name$_ != NULL ? *$name$_ : *default_instance_->$name$_;\n" + "inline const $type$& $classname$::$name$() const {\n"); + + PrintHandlingOptionalStaticInitializers( + variables_, descriptor_->file(), printer, + // With static initializers. + " return $name$_ != NULL ? *$name$_ : *default_instance_->$name$_;\n", + // Without. + " return $name$_ != NULL ? *$name$_ : *default_instance().$name$_;\n"); + + printer->Print(variables_, "}\n" "inline $type$* $classname$::mutable_$name$() {\n" " set_has_$name$();\n" diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index ad4b4deb..dc188c96 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -124,7 +124,6 @@ void protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto() { if (already_here) return; already_here = true; GOOGLE_PROTOBUF_VERIFY_VERSION; - ::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( "\n%google/protobuf/compiler/plugin.proto\022" @@ -155,7 +154,6 @@ struct StaticDescriptorInitializer_google_2fprotobuf_2fcompiler_2fplugin_2eproto } } static_descriptor_initializer_google_2fprotobuf_2fcompiler_2fplugin_2eproto_; - // =================================================================== #ifndef _MSC_VER @@ -207,7 +205,8 @@ const ::google::protobuf::Descriptor* CodeGeneratorRequest::descriptor() { } const CodeGeneratorRequest& CodeGeneratorRequest::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + return *default_instance_; } CodeGeneratorRequest* CodeGeneratorRequest::default_instance_ = NULL; @@ -530,7 +529,8 @@ const ::google::protobuf::Descriptor* CodeGeneratorResponse_File::descriptor() { } const CodeGeneratorResponse_File& CodeGeneratorResponse_File::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + return *default_instance_; } CodeGeneratorResponse_File* CodeGeneratorResponse_File::default_instance_ = NULL; @@ -859,7 +859,8 @@ const ::google::protobuf::Descriptor* CodeGeneratorResponse::descriptor() { } const CodeGeneratorResponse& CodeGeneratorResponse::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); + return *default_instance_; } CodeGeneratorResponse* CodeGeneratorResponse::default_instance_ = NULL; diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 87303ef8..5697b38a 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -553,7 +553,6 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { if (already_here) return; already_here = true; GOOGLE_PROTOBUF_VERIFY_VERSION; - ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( "\n google/protobuf/descriptor.proto\022\017goog" "le.protobuf\"G\n\021FileDescriptorSet\0222\n\004file" @@ -706,7 +705,6 @@ struct StaticDescriptorInitializer_google_2fprotobuf_2fdescriptor_2eproto { } } static_descriptor_initializer_google_2fprotobuf_2fdescriptor_2eproto_; - // =================================================================== #ifndef _MSC_VER @@ -752,7 +750,8 @@ const ::google::protobuf::Descriptor* FileDescriptorSet::descriptor() { } const FileDescriptorSet& FileDescriptorSet::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } FileDescriptorSet* FileDescriptorSet::default_instance_ = NULL; @@ -979,7 +978,8 @@ const ::google::protobuf::Descriptor* FileDescriptorProto::descriptor() { } const FileDescriptorProto& FileDescriptorProto::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } FileDescriptorProto* FileDescriptorProto::default_instance_ = NULL; @@ -1559,7 +1559,8 @@ const ::google::protobuf::Descriptor* DescriptorProto_ExtensionRange::descriptor } const DescriptorProto_ExtensionRange& DescriptorProto_ExtensionRange::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } DescriptorProto_ExtensionRange* DescriptorProto_ExtensionRange::default_instance_ = NULL; @@ -1816,7 +1817,8 @@ const ::google::protobuf::Descriptor* DescriptorProto::descriptor() { } const DescriptorProto& DescriptorProto::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } DescriptorProto* DescriptorProto::default_instance_ = NULL; @@ -2392,7 +2394,8 @@ const ::google::protobuf::Descriptor* FieldDescriptorProto::descriptor() { } const FieldDescriptorProto& FieldDescriptorProto::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } FieldDescriptorProto* FieldDescriptorProto::default_instance_ = NULL; @@ -2947,7 +2950,8 @@ const ::google::protobuf::Descriptor* EnumDescriptorProto::descriptor() { } const EnumDescriptorProto& EnumDescriptorProto::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } EnumDescriptorProto* EnumDescriptorProto::default_instance_ = NULL; @@ -3263,7 +3267,8 @@ const ::google::protobuf::Descriptor* EnumValueDescriptorProto::descriptor() { } const EnumValueDescriptorProto& EnumValueDescriptorProto::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } EnumValueDescriptorProto* EnumValueDescriptorProto::default_instance_ = NULL; @@ -3574,7 +3579,8 @@ const ::google::protobuf::Descriptor* ServiceDescriptorProto::descriptor() { } const ServiceDescriptorProto& ServiceDescriptorProto::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } ServiceDescriptorProto* ServiceDescriptorProto::default_instance_ = NULL; @@ -3898,7 +3904,8 @@ const ::google::protobuf::Descriptor* MethodDescriptorProto::descriptor() { } const MethodDescriptorProto& MethodDescriptorProto::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } MethodDescriptorProto* MethodDescriptorProto::default_instance_ = NULL; @@ -4311,7 +4318,8 @@ const ::google::protobuf::Descriptor* FileOptions::descriptor() { } const FileOptions& FileOptions::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } FileOptions* FileOptions::default_instance_ = NULL; @@ -4872,7 +4880,8 @@ const ::google::protobuf::Descriptor* MessageOptions::descriptor() { } const MessageOptions& MessageOptions::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } MessageOptions* MessageOptions::default_instance_ = NULL; @@ -5207,7 +5216,8 @@ const ::google::protobuf::Descriptor* FieldOptions::descriptor() { } const FieldOptions& FieldOptions::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } FieldOptions* FieldOptions::default_instance_ = NULL; @@ -5604,7 +5614,8 @@ const ::google::protobuf::Descriptor* EnumOptions::descriptor() { } const EnumOptions& EnumOptions::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } EnumOptions* EnumOptions::default_instance_ = NULL; @@ -5828,7 +5839,8 @@ const ::google::protobuf::Descriptor* EnumValueOptions::descriptor() { } const EnumValueOptions& EnumValueOptions::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } EnumValueOptions* EnumValueOptions::default_instance_ = NULL; @@ -6052,7 +6064,8 @@ const ::google::protobuf::Descriptor* ServiceOptions::descriptor() { } const ServiceOptions& ServiceOptions::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } ServiceOptions* ServiceOptions::default_instance_ = NULL; @@ -6276,7 +6289,8 @@ const ::google::protobuf::Descriptor* MethodOptions::descriptor() { } const MethodOptions& MethodOptions::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } MethodOptions* MethodOptions::default_instance_ = NULL; @@ -6506,7 +6520,8 @@ const ::google::protobuf::Descriptor* UninterpretedOption_NamePart::descriptor() } const UninterpretedOption_NamePart& UninterpretedOption_NamePart::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } UninterpretedOption_NamePart* UninterpretedOption_NamePart::default_instance_ = NULL; @@ -6784,7 +6799,8 @@ const ::google::protobuf::Descriptor* UninterpretedOption::descriptor() { } const UninterpretedOption& UninterpretedOption::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } UninterpretedOption* UninterpretedOption::default_instance_ = NULL; @@ -7255,7 +7271,8 @@ const ::google::protobuf::Descriptor* SourceCodeInfo_Location::descriptor() { } const SourceCodeInfo_Location& SourceCodeInfo_Location::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } SourceCodeInfo_Location* SourceCodeInfo_Location::default_instance_ = NULL; @@ -7543,7 +7560,8 @@ const ::google::protobuf::Descriptor* SourceCodeInfo::descriptor() { } const SourceCodeInfo& SourceCodeInfo::default_instance() { - if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_; + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; } SourceCodeInfo* SourceCodeInfo::default_instance_ = NULL; -- cgit v1.2.3