Pārlūkot izejas kodu

Put AddDescriptorsImpl() in anonymous namespace

AddDescriptorsImpl() is a private static implementation detail,
and needs to be declared but won't be used from outside the
source file.  Place it inside an anonymous namespace to fix a
previous build error that would result in more restrictive
build enviornments that use -Werror=missing-declarations or
similar compiler flags.
Brad Larson 8 gadi atpakaļ
vecāks
revīzija
b6da2262e8

+ 2 - 0
src/google/protobuf/any.pb.cc

@@ -102,6 +102,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -118,6 +119,7 @@ void AddDescriptorsImpl() {
     "google/protobuf/any.proto", &protobuf_RegisterTypes);
     "google/protobuf/any.proto", &protobuf_RegisterTypes);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);

+ 2 - 0
src/google/protobuf/api.pb.cc

@@ -146,6 +146,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -177,6 +178,7 @@ void AddDescriptorsImpl() {
   ::google::protobuf::protobuf_google_2fprotobuf_2ftype_2eproto::AddDescriptors();
   ::google::protobuf::protobuf_google_2fprotobuf_2ftype_2eproto::AddDescriptors();
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);

+ 2 - 0
src/google/protobuf/compiler/cpp/cpp_file.cc

@@ -811,6 +811,7 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) {
 
 
   // Now generate the AddDescriptors() function.
   // Now generate the AddDescriptors() function.
   printer->Print(
   printer->Print(
+      "namespace {\n"
       "void AddDescriptorsImpl() {\n"
       "void AddDescriptorsImpl() {\n"
       "  InitDefaults();\n");
       "  InitDefaults();\n");
 
 
@@ -882,6 +883,7 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) {
   printer->Outdent();
   printer->Outdent();
   printer->Print(
   printer->Print(
       "}\n"
       "}\n"
+      "} // anonymous namespace\n"
       "\n"
       "\n"
       "void AddDescriptors() {\n"
       "void AddDescriptors() {\n"
       "  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);\n"
       "  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);\n"

+ 2 - 0
src/google/protobuf/compiler/plugin.pb.cc

@@ -169,6 +169,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -196,6 +197,7 @@ void AddDescriptorsImpl() {
   ::google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::AddDescriptors();
   ::google::protobuf::protobuf_google_2fprotobuf_2fdescriptor_2eproto::AddDescriptors();
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);

+ 2 - 0
src/google/protobuf/compiler/profile.pb.cc

@@ -143,6 +143,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -162,6 +163,7 @@ void AddDescriptorsImpl() {
     "google/protobuf/compiler/profile.proto", &protobuf_RegisterTypes);
     "google/protobuf/compiler/profile.proto", &protobuf_RegisterTypes);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);

+ 2 - 0
src/google/protobuf/descriptor.pb.cc

@@ -663,6 +663,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -815,6 +816,7 @@ void AddDescriptorsImpl() {
     "google/protobuf/descriptor.proto", &protobuf_RegisterTypes);
     "google/protobuf/descriptor.proto", &protobuf_RegisterTypes);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);

+ 2 - 0
src/google/protobuf/duration.pb.cc

@@ -102,6 +102,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -118,6 +119,7 @@ void AddDescriptorsImpl() {
     "google/protobuf/duration.proto", &protobuf_RegisterTypes);
     "google/protobuf/duration.proto", &protobuf_RegisterTypes);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);

+ 2 - 0
src/google/protobuf/empty.pb.cc

@@ -100,6 +100,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -115,6 +116,7 @@ void AddDescriptorsImpl() {
     "google/protobuf/empty.proto", &protobuf_RegisterTypes);
     "google/protobuf/empty.proto", &protobuf_RegisterTypes);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);

+ 2 - 0
src/google/protobuf/field_mask.pb.cc

@@ -101,6 +101,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -117,6 +118,7 @@ void AddDescriptorsImpl() {
     "google/protobuf/field_mask.proto", &protobuf_RegisterTypes);
     "google/protobuf/field_mask.proto", &protobuf_RegisterTypes);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);

+ 2 - 0
src/google/protobuf/source_context.pb.cc

@@ -101,6 +101,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -118,6 +119,7 @@ void AddDescriptorsImpl() {
     "google/protobuf/source_context.proto", &protobuf_RegisterTypes);
     "google/protobuf/source_context.proto", &protobuf_RegisterTypes);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);

+ 2 - 0
src/google/protobuf/struct.pb.cc

@@ -161,6 +161,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -188,6 +189,7 @@ void AddDescriptorsImpl() {
     "google/protobuf/struct.proto", &protobuf_RegisterTypes);
     "google/protobuf/struct.proto", &protobuf_RegisterTypes);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);

+ 2 - 0
src/google/protobuf/timestamp.pb.cc

@@ -102,6 +102,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -118,6 +119,7 @@ void AddDescriptorsImpl() {
     "google/protobuf/timestamp.proto", &protobuf_RegisterTypes);
     "google/protobuf/timestamp.proto", &protobuf_RegisterTypes);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);

+ 2 - 0
src/google/protobuf/type.pb.cc

@@ -187,6 +187,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -239,6 +240,7 @@ void AddDescriptorsImpl() {
   ::google::protobuf::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::AddDescriptors();
   ::google::protobuf::protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::AddDescriptors();
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);

+ 2 - 0
src/google/protobuf/wrappers.pb.cc

@@ -213,6 +213,7 @@ void InitDefaults() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
   ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
 }
 }
+namespace {
 void AddDescriptorsImpl() {
 void AddDescriptorsImpl() {
   InitDefaults();
   InitDefaults();
   static const char descriptor[] = {
   static const char descriptor[] = {
@@ -235,6 +236,7 @@ void AddDescriptorsImpl() {
     "google/protobuf/wrappers.proto", &protobuf_RegisterTypes);
     "google/protobuf/wrappers.proto", &protobuf_RegisterTypes);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
   ::google::protobuf::internal::OnShutdown(&TableStruct::Shutdown);
 }
 }
+} // anonymous namespace
 
 
 void AddDescriptors() {
 void AddDescriptors() {
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
   static GOOGLE_PROTOBUF_DECLARE_ONCE(once);