From 9173ba22a9ff70697cea92356b9b96cdff71e4ca Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Tue, 2 Dec 2014 15:28:11 -0800 Subject: Get rid of some build warnings. --- src/google/protobuf/arena.cc | 6 +++--- src/google/protobuf/descriptor.cc | 2 ++ src/google/protobuf/extension_set.cc | 2 ++ src/google/protobuf/generated_message_reflection.cc | 4 ++-- src/google/protobuf/stubs/common.h | 5 +++-- src/google/protobuf/stubs/map_util.h | 2 -- 6 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc index be0d9e34..1cb6441e 100644 --- a/src/google/protobuf/arena.cc +++ b/src/google/protobuf/arena.cc @@ -46,10 +46,10 @@ void Arena::Init(const ArenaOptions& options) { max_block_size_ = options.max_block_size; block_alloc = options.block_alloc; block_dealloc = options.block_dealloc; - blocks_ = NULL; - hint_ = NULL; + blocks_ = 0; + hint_ = 0; owns_first_block_ = true; - cleanup_list_ = NULL; + cleanup_list_ = 0; if (options.initial_block != NULL && options.initial_block_size > 0) { // Add first unowned block to list. diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index 7bc172a8..19d49cab 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -144,6 +144,8 @@ const char* FileDescriptor::SyntaxName(FileDescriptor::Syntax syntax) { case SYNTAX_UNKNOWN: return "unknown"; } + GOOGLE_LOG(FATAL) << "can't reach here."; + return NULL; } static const char * const kNonLinkedWeakMessageReplacementName = "google.protobuf.Empty"; diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc index d6ebe4c3..49087131 100644 --- a/src/google/protobuf/extension_set.cc +++ b/src/google/protobuf/extension_set.cc @@ -71,6 +71,8 @@ inline bool is_packable(WireFormatLite::WireType type) { // Do not add a default statement. Let the compiler complain when someone // adds a new wire type. } + GOOGLE_LOG(FATAL) << "can't reach here."; + return false; } // Registry stuff. diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc index b4e98acd..b500b9c5 100644 --- a/src/google/protobuf/generated_message_reflection.cc +++ b/src/google/protobuf/generated_message_reflection.cc @@ -487,11 +487,11 @@ void GeneratedMessageReflection::SwapOneofField( double temp_double; bool temp_bool; int temp_int; - Message* temp_message; + Message* temp_message = NULL; string temp_string; // Stores message1's oneof field to a temp variable. - const FieldDescriptor* field1; + const FieldDescriptor* field1 = NULL; if (oneof_case1 > 0) { field1 = descriptor_->FindFieldByNumber(oneof_case1); //oneof_descriptor->field(oneof_case1); diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index b7e11749..c0cfd414 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -381,8 +381,9 @@ struct CompileAssert { #undef GOOGLE_COMPILE_ASSERT #define GOOGLE_COMPILE_ASSERT(expr, msg) \ - typedef ::google::protobuf::internal::CompileAssert<(bool(expr))> \ - msg[bool(expr) ? 1 : -1] + ::google::protobuf::internal::CompileAssert<(bool(expr))> \ + msg[bool(expr) ? 1 : -1]; \ + (void)msg // Implementation details of COMPILE_ASSERT: diff --git a/src/google/protobuf/stubs/map_util.h b/src/google/protobuf/stubs/map_util.h index 7495cb6a..4cccbbed 100644 --- a/src/google/protobuf/stubs/map_util.h +++ b/src/google/protobuf/stubs/map_util.h @@ -353,7 +353,6 @@ template void InsertOrDie(Collection* const collection, const typename Collection::value_type::first_type& key, const typename Collection::value_type::second_type& data) { - typedef typename Collection::value_type value_type; GOOGLE_CHECK(InsertIfNotPresent(collection, key, data)) << "duplicate key: " << key; } @@ -364,7 +363,6 @@ void InsertOrDieNoPrint( Collection* const collection, const typename Collection::value_type::first_type& key, const typename Collection::value_type::second_type& data) { - typedef typename Collection::value_type value_type; GOOGLE_CHECK(InsertIfNotPresent(collection, key, data)) << "duplicate key."; } -- cgit v1.2.3