From 97d50e306e576dadf2184e643b7c934da45730c8 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Wed, 9 Aug 2017 16:34:42 -0700 Subject: [PATCH] Make code free of missing-field-initializers warnings --- src/Makefile.am | 3 +- src/google/protobuf/any.pb.cc | 2 +- src/google/protobuf/api.pb.cc | 6 +-- src/google/protobuf/compiler/cpp/cpp_file.cc | 2 +- .../protobuf/compiler/cpp/cpp_message.cc | 2 +- src/google/protobuf/compiler/plugin.pb.cc | 8 +-- src/google/protobuf/descriptor.pb.cc | 52 +++++++++---------- src/google/protobuf/duration.pb.cc | 2 +- src/google/protobuf/empty.pb.cc | 2 +- src/google/protobuf/field_mask.pb.cc | 2 +- src/google/protobuf/map_entry.h | 4 +- src/google/protobuf/source_context.pb.cc | 2 +- src/google/protobuf/struct.pb.cc | 8 +-- src/google/protobuf/timestamp.pb.cc | 2 +- src/google/protobuf/type.pb.cc | 10 ++-- src/google/protobuf/wrappers.pb.cc | 18 +++---- 16 files changed, 64 insertions(+), 61 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index a0c325dc6f..7515b54288 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -930,7 +930,8 @@ no_warning_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \ ../gmock/gtest/lib/libgtest_main.la no_warning_test_CPPFLAGS = -I$(srcdir)/../gmock/gtest/include no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \ - -Wall -Werror -Werror=missing-declarations + -Wall -Werror -Werror=missing-declarations \ + -Werror=missing-field-initializers nodist_no_warning_test_SOURCES = no_warning_test.cc $(protoc_outputs) TESTS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test \ diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc index ace7998643..7d53821256 100644 --- a/src/google/protobuf/any.pb.cc +++ b/src/google/protobuf/any.pb.cc @@ -45,7 +45,7 @@ PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField }; PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, }; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc index 830fffbb24..96a5074dcf 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -55,9 +55,9 @@ PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField }; PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, }; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc index a1c13cf563..a066a6a7c7 100644 --- a/src/google/protobuf/compiler/cpp/cpp_file.cc +++ b/src/google/protobuf/compiler/cpp/cpp_file.cc @@ -609,7 +609,7 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) { } if (message_generators_.empty()) { - printer->Print("{ NULL, NULL, 0, -1, -1, false },\n"); + printer->Print("{ NULL, NULL, 0, -1, -1, -1, -1, NULL, false },\n"); } printer->Outdent(); diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index 36cbf5d743..63ebb3c50d 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -1628,7 +1628,7 @@ GenerateExtraDefaultFields(io::Printer* printer) { bool MessageGenerator::GenerateParseTable(io::Printer* printer, size_t offset, size_t aux_offset) { if (!table_driven_) { - printer->Print("{ NULL, NULL, 0, -1, -1, false },\n"); + printer->Print("{ NULL, NULL, 0, -1, -1, -1, -1, NULL, false },\n"); return false; } diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index ac6f59dcc2..07883a3737 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -61,10 +61,10 @@ PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField }; PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, }; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 33e2f9b417..69c0ab0d37 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -171,32 +171,32 @@ PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField }; PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, }; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index ec1aa2717a..ad0eeb45da 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -45,7 +45,7 @@ PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField }; PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, }; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/empty.pb.cc b/src/google/protobuf/empty.pb.cc index 09ef019b73..6d2ea338aa 100644 --- a/src/google/protobuf/empty.pb.cc +++ b/src/google/protobuf/empty.pb.cc @@ -45,7 +45,7 @@ PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField }; PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, }; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc index 6e867037cd..afc3db56e7 100644 --- a/src/google/protobuf/field_mask.pb.cc +++ b/src/google/protobuf/field_mask.pb.cc @@ -45,7 +45,7 @@ PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField }; PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, }; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/map_entry.h b/src/google/protobuf/map_entry.h index 7c618b82a8..afe809b28a 100644 --- a/src/google/protobuf/map_entry.h +++ b/src/google/protobuf/map_entry.h @@ -101,7 +101,9 @@ class MapEntry GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MapEntry, _internal_metadata_), -1, -1, - sizeof(MapEntry)}; + sizeof(MapEntry), + -1, + }; const Reflection* reflection = new GeneratedMessageReflection( descriptor, schema, DescriptorPool::generated_pool(), MessageFactory::generated_factory()); diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc index 5d9907726a..a69739c493 100644 --- a/src/google/protobuf/source_context.pb.cc +++ b/src/google/protobuf/source_context.pb.cc @@ -45,7 +45,7 @@ PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField }; PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, }; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 73c36bd7f6..02d9306ed3 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -67,10 +67,10 @@ PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField }; PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, }; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc index f01ff345fb..44ddc749a8 100644 --- a/src/google/protobuf/timestamp.pb.cc +++ b/src/google/protobuf/timestamp.pb.cc @@ -45,7 +45,7 @@ PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField }; PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, }; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 47d425f54c..abb52395dc 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -66,11 +66,11 @@ PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField }; PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, }; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc index 6d1bd21ced..d76e8aa63b 100644 --- a/src/google/protobuf/wrappers.pb.cc +++ b/src/google/protobuf/wrappers.pb.cc @@ -85,15 +85,15 @@ PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField }; PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, - { NULL, NULL, 0, -1, -1, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, + { NULL, NULL, 0, -1, -1, -1, -1, NULL, false }, }; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {