From f25e7edfa40c12300cf7dd3837b82841d095a79a Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Thu, 28 Jun 2018 13:48:06 -0700 Subject: Add -Og to no-warning-test (#4830) * Add -Og to no-warning-test * Initialize value * Implement PrintFieldName in CompactRepeatedFieldPrinter to prevent Woverloaded-virtual * Update generated code --- src/Makefile.am | 2 +- src/google/protobuf/api.pb.cc | 4 ++-- src/google/protobuf/compiler/cpp/cpp_enum_field.cc | 6 +++--- src/google/protobuf/descriptor.pb.cc | 12 ++++++------ src/google/protobuf/duration.pb.cc | 2 +- src/google/protobuf/empty.pb.cc | 2 +- src/google/protobuf/struct.pb.cc | 8 ++++---- src/google/protobuf/text_format_unittest.cc | 5 +++++ src/google/protobuf/timestamp.pb.cc | 2 +- src/google/protobuf/type.pb.cc | 18 +++++++++--------- src/google/protobuf/wrappers.pb.cc | 18 +++++++++--------- 11 files changed, 42 insertions(+), 37 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 09ab76f7..cb1b1006 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -876,7 +876,7 @@ no_warning_test.cc: no_warning_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la no_warning_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) \ - -Wall -Wextra -Werror -Wno-unused-parameter + -Wall -Wextra -Werror -Wno-unused-parameter -Og 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/api.pb.cc b/src/google/protobuf/api.pb.cc index 6ad9f48d..273307c7 100644 --- a/src/google/protobuf/api.pb.cc +++ b/src/google/protobuf/api.pb.cc @@ -414,7 +414,7 @@ bool Api::MergePartialFromCodedStream( case 7: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(56u /* 56 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); @@ -947,7 +947,7 @@ bool Method::MergePartialFromCodedStream( case 7: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(56u /* 56 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc index 50c7b5f3..828d0be5 100644 --- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc @@ -128,7 +128,7 @@ GenerateCopyConstructorCode(io::Printer* printer) const { void EnumFieldGenerator:: GenerateMergeFromCodedStream(io::Printer* printer) const { printer->Print(variables_, - "int value;\n" + "int value = 0;\n" "DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n" " int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(\n" " input, &value)));\n"); @@ -334,7 +334,7 @@ void RepeatedEnumFieldGenerator:: GenerateMergeFromCodedStream(io::Printer* printer) const { // Don't use ReadRepeatedPrimitive here so that the enum can be validated. printer->Print(variables_, - "int value;\n" + "int value = 0;\n" "DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n" " int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(\n" " input, &value)));\n"); @@ -399,7 +399,7 @@ GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const { "::google::protobuf::io::CodedInputStream::Limit limit = " "input->PushLimit(static_cast(length));\n" "while (input->BytesUntilLimit() > 0) {\n" - " int value;\n" + " int value = 0;\n" " DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<\n" " int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(\n" " input, &value)));\n"); diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 2ccf189c..f3522ec1 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -4507,7 +4507,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( case 4: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); @@ -4527,7 +4527,7 @@ bool FieldDescriptorProto::MergePartialFromCodedStream( case 5: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); @@ -7814,7 +7814,7 @@ bool FileOptions::MergePartialFromCodedStream( case 9: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(72u /* 72 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); @@ -9377,7 +9377,7 @@ bool FieldOptions::MergePartialFromCodedStream( case 1: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); @@ -9439,7 +9439,7 @@ bool FieldOptions::MergePartialFromCodedStream( case 6: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(48u /* 48 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); @@ -11237,7 +11237,7 @@ bool MethodOptions::MergePartialFromCodedStream( case 34: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(16u /* 272 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index 0c67f86e..e8417a78 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -167,7 +167,7 @@ void Duration::ArenaDtor(void* object) { Duration* _this = reinterpret_cast< Duration* >(object); (void)_this; } -void Duration::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void Duration::RegisterArenaDtor(::google::protobuf::Arena*) { } void Duration::SetCachedSize(int size) const { _cached_size_.Set(size); diff --git a/src/google/protobuf/empty.pb.cc b/src/google/protobuf/empty.pb.cc index 7bc46121..163a4f6a 100644 --- a/src/google/protobuf/empty.pb.cc +++ b/src/google/protobuf/empty.pb.cc @@ -156,7 +156,7 @@ void Empty::ArenaDtor(void* object) { Empty* _this = reinterpret_cast< Empty* >(object); (void)_this; } -void Empty::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void Empty::RegisterArenaDtor(::google::protobuf::Arena*) { } void Empty::SetCachedSize(int size) const { _cached_size_.Set(size); diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc index 4bf5d45c..ead81689 100644 --- a/src/google/protobuf/struct.pb.cc +++ b/src/google/protobuf/struct.pb.cc @@ -277,7 +277,7 @@ void Struct::ArenaDtor(void* object) { Struct* _this = reinterpret_cast< Struct* >(object); (void)_this; } -void Struct::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void Struct::RegisterArenaDtor(::google::protobuf::Arena*) { } void Struct::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -730,7 +730,7 @@ void Value::ArenaDtor(void* object) { Value* _this = reinterpret_cast< Value* >(object); (void)_this; } -void Value::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void Value::RegisterArenaDtor(::google::protobuf::Arena*) { } void Value::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -810,7 +810,7 @@ bool Value::MergePartialFromCodedStream( case 1: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); @@ -1225,7 +1225,7 @@ void ListValue::ArenaDtor(void* object) { ListValue* _this = reinterpret_cast< ListValue* >(object); (void)_this; } -void ListValue::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void ListValue::RegisterArenaDtor(::google::protobuf::Arena*) { } void ListValue::SetCachedSize(int size) const { _cached_size_.Set(size); diff --git a/src/google/protobuf/text_format_unittest.cc b/src/google/protobuf/text_format_unittest.cc index 544c37e2..53184130 100644 --- a/src/google/protobuf/text_format_unittest.cc +++ b/src/google/protobuf/text_format_unittest.cc @@ -574,6 +574,11 @@ class CompactRepeatedFieldPrinter : public TextFormat::FastFieldValuePrinter { generator->PrintString(field->name()); } } + // To prevent compiler complaining about Woverloaded-virtual + void PrintFieldName(const Message& message, + const Reflection* reflection, + const FieldDescriptor* field, + TextFormat::BaseTextGenerator* generator) const override {} void PrintMessageStart( const Message& message, int field_index, int field_count, bool single_line_mode, diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc index 3184bd97..4269031f 100644 --- a/src/google/protobuf/timestamp.pb.cc +++ b/src/google/protobuf/timestamp.pb.cc @@ -167,7 +167,7 @@ void Timestamp::ArenaDtor(void* object) { Timestamp* _this = reinterpret_cast< Timestamp* >(object); (void)_this; } -void Timestamp::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void Timestamp::RegisterArenaDtor(::google::protobuf::Arena*) { } void Timestamp::SetCachedSize(int size) const { _cached_size_.Set(size); diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 17d5ce2a..72679df8 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -492,7 +492,7 @@ void Type::ArenaDtor(void* object) { Type* _this = reinterpret_cast< Type* >(object); (void)_this; } -void Type::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void Type::RegisterArenaDtor(::google::protobuf::Arena*) { } void Type::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -609,7 +609,7 @@ bool Type::MergePartialFromCodedStream( case 6: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(48u /* 48 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); @@ -1014,7 +1014,7 @@ void Field::ArenaDtor(void* object) { Field* _this = reinterpret_cast< Field* >(object); (void)_this; } -void Field::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void Field::RegisterArenaDtor(::google::protobuf::Arena*) { } void Field::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -1061,7 +1061,7 @@ bool Field::MergePartialFromCodedStream( case 1: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); @@ -1076,7 +1076,7 @@ bool Field::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); @@ -1698,7 +1698,7 @@ void Enum::ArenaDtor(void* object) { Enum* _this = reinterpret_cast< Enum* >(object); (void)_this; } -void Enum::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void Enum::RegisterArenaDtor(::google::protobuf::Arena*) { } void Enum::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -1797,7 +1797,7 @@ bool Enum::MergePartialFromCodedStream( case 5: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) { - int value; + int value = 0; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); @@ -2140,7 +2140,7 @@ void EnumValue::ArenaDtor(void* object) { EnumValue* _this = reinterpret_cast< EnumValue* >(object); (void)_this; } -void EnumValue::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void EnumValue::RegisterArenaDtor(::google::protobuf::Arena*) { } void EnumValue::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -2520,7 +2520,7 @@ void Option::ArenaDtor(void* object) { Option* _this = reinterpret_cast< Option* >(object); (void)_this; } -void Option::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void Option::RegisterArenaDtor(::google::protobuf::Arena*) { } void Option::SetCachedSize(int size) const { _cached_size_.Set(size); diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc index 386be61d..8f254b82 100644 --- a/src/google/protobuf/wrappers.pb.cc +++ b/src/google/protobuf/wrappers.pb.cc @@ -391,7 +391,7 @@ void DoubleValue::ArenaDtor(void* object) { DoubleValue* _this = reinterpret_cast< DoubleValue* >(object); (void)_this; } -void DoubleValue::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void DoubleValue::RegisterArenaDtor(::google::protobuf::Arena*) { } void DoubleValue::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -642,7 +642,7 @@ void FloatValue::ArenaDtor(void* object) { FloatValue* _this = reinterpret_cast< FloatValue* >(object); (void)_this; } -void FloatValue::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void FloatValue::RegisterArenaDtor(::google::protobuf::Arena*) { } void FloatValue::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -893,7 +893,7 @@ void Int64Value::ArenaDtor(void* object) { Int64Value* _this = reinterpret_cast< Int64Value* >(object); (void)_this; } -void Int64Value::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void Int64Value::RegisterArenaDtor(::google::protobuf::Arena*) { } void Int64Value::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -1146,7 +1146,7 @@ void UInt64Value::ArenaDtor(void* object) { UInt64Value* _this = reinterpret_cast< UInt64Value* >(object); (void)_this; } -void UInt64Value::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void UInt64Value::RegisterArenaDtor(::google::protobuf::Arena*) { } void UInt64Value::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -1399,7 +1399,7 @@ void Int32Value::ArenaDtor(void* object) { Int32Value* _this = reinterpret_cast< Int32Value* >(object); (void)_this; } -void Int32Value::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void Int32Value::RegisterArenaDtor(::google::protobuf::Arena*) { } void Int32Value::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -1652,7 +1652,7 @@ void UInt32Value::ArenaDtor(void* object) { UInt32Value* _this = reinterpret_cast< UInt32Value* >(object); (void)_this; } -void UInt32Value::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void UInt32Value::RegisterArenaDtor(::google::protobuf::Arena*) { } void UInt32Value::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -1905,7 +1905,7 @@ void BoolValue::ArenaDtor(void* object) { BoolValue* _this = reinterpret_cast< BoolValue* >(object); (void)_this; } -void BoolValue::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void BoolValue::RegisterArenaDtor(::google::protobuf::Arena*) { } void BoolValue::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -2161,7 +2161,7 @@ void StringValue::ArenaDtor(void* object) { StringValue* _this = reinterpret_cast< StringValue* >(object); (void)_this; } -void StringValue::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void StringValue::RegisterArenaDtor(::google::protobuf::Arena*) { } void StringValue::SetCachedSize(int size) const { _cached_size_.Set(size); @@ -2433,7 +2433,7 @@ void BytesValue::ArenaDtor(void* object) { BytesValue* _this = reinterpret_cast< BytesValue* >(object); (void)_this; } -void BytesValue::RegisterArenaDtor(::google::protobuf::Arena* arena) { +void BytesValue::RegisterArenaDtor(::google::protobuf::Arena*) { } void BytesValue::SetCachedSize(int size) const { _cached_size_.Set(size); -- cgit v1.2.3