From a69deb64773fe67f1a9b8dfe383c44e767a85f10 Mon Sep 17 00:00:00 2001 From: "kenton@google.com" Date: Tue, 23 Sep 2008 20:03:24 +0000 Subject: Explicitly identify superclass in initializer lists for generated message classes. This avoids a warning when using GCC's -pedantic option. --- src/google/protobuf/compiler/cpp/cpp_message.cc | 3 + src/google/protobuf/descriptor.pb.cc | 96 ++++++++++++++++--------- 2 files changed, 67 insertions(+), 32 deletions(-) diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index afd99314..4967b898 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -712,6 +712,9 @@ GenerateInitializerList(io::Printer* printer) { printer->Indent(); printer->Indent(); + printer->Print( + "::google::protobuf::Message(),\n"); + if (descriptor_->extension_range_count() > 0) { printer->Print( "_extensions_(&$classname$_descriptor_,\n" diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index a37731d6..5918a875 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -358,14 +358,16 @@ const int FileDescriptorSet::_offsets_[1] = { }; FileDescriptorSet::FileDescriptorSet() - : _cached_size_(0) { + : ::google::protobuf::Message(), + _cached_size_(0) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); if (this == &default_instance_) { } } FileDescriptorSet::FileDescriptorSet(const FileDescriptorSet& from) - : _cached_size_(0) { + : ::google::protobuf::Message(), + _cached_size_(0) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); MergeFrom(from); } @@ -530,7 +532,8 @@ const int FileDescriptorProto::_offsets_[8] = { }; FileDescriptorProto::FileDescriptorProto() - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), package_(const_cast< ::std::string*>(&_default_package_)), options_(NULL) { @@ -541,7 +544,8 @@ FileDescriptorProto::FileDescriptorProto() } FileDescriptorProto::FileDescriptorProto(const FileDescriptorProto& from) - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), package_(const_cast< ::std::string*>(&_default_package_)), options_(NULL) { @@ -917,7 +921,8 @@ const int DescriptorProto_ExtensionRange::_offsets_[2] = { }; DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange() - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), start_(0), end_(0) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -926,7 +931,8 @@ DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange() } DescriptorProto_ExtensionRange::DescriptorProto_ExtensionRange(const DescriptorProto_ExtensionRange& from) - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), start_(0), end_(0) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -1127,7 +1133,8 @@ const int DescriptorProto::_offsets_[7] = { }; DescriptorProto::DescriptorProto() - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), options_(NULL) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -1137,7 +1144,8 @@ DescriptorProto::DescriptorProto() } DescriptorProto::DescriptorProto(const DescriptorProto& from) - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), options_(NULL) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -1565,7 +1573,8 @@ const int FieldDescriptorProto::_offsets_[8] = { }; FieldDescriptorProto::FieldDescriptorProto() - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), number_(0), label_(1), @@ -1581,7 +1590,8 @@ FieldDescriptorProto::FieldDescriptorProto() } FieldDescriptorProto::FieldDescriptorProto(const FieldDescriptorProto& from) - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), number_(0), label_(1), @@ -1984,7 +1994,8 @@ const int EnumDescriptorProto::_offsets_[3] = { }; EnumDescriptorProto::EnumDescriptorProto() - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), options_(NULL) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -1994,7 +2005,8 @@ EnumDescriptorProto::EnumDescriptorProto() } EnumDescriptorProto::EnumDescriptorProto(const EnumDescriptorProto& from) - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), options_(NULL) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -2222,7 +2234,8 @@ const int EnumValueDescriptorProto::_offsets_[3] = { }; EnumValueDescriptorProto::EnumValueDescriptorProto() - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), number_(0), options_(NULL) { @@ -2233,7 +2246,8 @@ EnumValueDescriptorProto::EnumValueDescriptorProto() } EnumValueDescriptorProto::EnumValueDescriptorProto(const EnumValueDescriptorProto& from) - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), number_(0), options_(NULL) { @@ -2463,7 +2477,8 @@ const int ServiceDescriptorProto::_offsets_[3] = { }; ServiceDescriptorProto::ServiceDescriptorProto() - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), options_(NULL) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -2473,7 +2488,8 @@ ServiceDescriptorProto::ServiceDescriptorProto() } ServiceDescriptorProto::ServiceDescriptorProto(const ServiceDescriptorProto& from) - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), options_(NULL) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -2703,7 +2719,8 @@ const int MethodDescriptorProto::_offsets_[4] = { }; MethodDescriptorProto::MethodDescriptorProto() - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), input_type_(const_cast< ::std::string*>(&_default_input_type_)), output_type_(const_cast< ::std::string*>(&_default_output_type_)), @@ -2715,7 +2732,8 @@ MethodDescriptorProto::MethodDescriptorProto() } MethodDescriptorProto::MethodDescriptorProto(const MethodDescriptorProto& from) - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), name_(const_cast< ::std::string*>(&_default_name_)), input_type_(const_cast< ::std::string*>(&_default_input_type_)), output_type_(const_cast< ::std::string*>(&_default_output_type_)), @@ -3006,7 +3024,8 @@ const int FileOptions::_offsets_[4] = { }; FileOptions::FileOptions() - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), java_package_(const_cast< ::std::string*>(&_default_java_package_)), java_outer_classname_(const_cast< ::std::string*>(&_default_java_outer_classname_)), java_multiple_files_(false), @@ -3017,7 +3036,8 @@ FileOptions::FileOptions() } FileOptions::FileOptions(const FileOptions& from) - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), java_package_(const_cast< ::std::string*>(&_default_java_package_)), java_outer_classname_(const_cast< ::std::string*>(&_default_java_outer_classname_)), java_multiple_files_(false), @@ -3277,7 +3297,8 @@ const int MessageOptions::_offsets_[1] = { }; MessageOptions::MessageOptions() - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), message_set_wire_format_(false) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); if (this == &default_instance_) { @@ -3285,7 +3306,8 @@ MessageOptions::MessageOptions() } MessageOptions::MessageOptions(const MessageOptions& from) - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), message_set_wire_format_(false) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); MergeFrom(from); @@ -3463,7 +3485,8 @@ const int FieldOptions::_offsets_[2] = { }; FieldOptions::FieldOptions() - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), ctype_(1), experimental_map_key_(const_cast< ::std::string*>(&_default_experimental_map_key_)) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -3472,7 +3495,8 @@ FieldOptions::FieldOptions() } FieldOptions::FieldOptions(const FieldOptions& from) - : _cached_size_(0), + : ::google::protobuf::Message(), + _cached_size_(0), ctype_(1), experimental_map_key_(const_cast< ::std::string*>(&_default_experimental_map_key_)) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -3666,14 +3690,16 @@ const int EnumOptions::_offsets_[1] = { }; EnumOptions::EnumOptions() - : _cached_size_(0) { + : ::google::protobuf::Message(), + _cached_size_(0) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); if (this == &default_instance_) { } } EnumOptions::EnumOptions(const EnumOptions& from) - : _cached_size_(0) { + : ::google::protobuf::Message(), + _cached_size_(0) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); MergeFrom(from); } @@ -3779,14 +3805,16 @@ const int EnumValueOptions::_offsets_[1] = { }; EnumValueOptions::EnumValueOptions() - : _cached_size_(0) { + : ::google::protobuf::Message(), + _cached_size_(0) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); if (this == &default_instance_) { } } EnumValueOptions::EnumValueOptions(const EnumValueOptions& from) - : _cached_size_(0) { + : ::google::protobuf::Message(), + _cached_size_(0) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); MergeFrom(from); } @@ -3892,14 +3920,16 @@ const int ServiceOptions::_offsets_[1] = { }; ServiceOptions::ServiceOptions() - : _cached_size_(0) { + : ::google::protobuf::Message(), + _cached_size_(0) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); if (this == &default_instance_) { } } ServiceOptions::ServiceOptions(const ServiceOptions& from) - : _cached_size_(0) { + : ::google::protobuf::Message(), + _cached_size_(0) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); MergeFrom(from); } @@ -4005,14 +4035,16 @@ const int MethodOptions::_offsets_[1] = { }; MethodOptions::MethodOptions() - : _cached_size_(0) { + : ::google::protobuf::Message(), + _cached_size_(0) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); if (this == &default_instance_) { } } MethodOptions::MethodOptions(const MethodOptions& from) - : _cached_size_(0) { + : ::google::protobuf::Message(), + _cached_size_(0) { ::memset(_has_bits_, 0, sizeof(_has_bits_)); MergeFrom(from); } -- cgit v1.2.3