Sfoglia il codice sorgente

Get rid of some build warnings.

Feng Xiao 10 anni fa
parent
commit
9173ba22a9

+ 1 - 0
configure.ac

@@ -46,6 +46,7 @@ AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_CXX
 AC_LANG([C++])
 AC_LANG([C++])
 ACX_USE_SYSTEM_EXTENSIONS
 ACX_USE_SYSTEM_EXTENSIONS
+AM_PROG_AR
 AM_CONDITIONAL(GCC, test "$GCC" = yes)   # let the Makefile know if we're gcc
 AM_CONDITIONAL(GCC, test "$GCC" = yes)   # let the Makefile know if we're gcc
 
 
 # test_util.cc takes forever to compile with GCC and optimization turned on.
 # test_util.cc takes forever to compile with GCC and optimization turned on.

+ 3 - 3
src/google/protobuf/arena.cc

@@ -46,10 +46,10 @@ void Arena::Init(const ArenaOptions& options) {
   max_block_size_ = options.max_block_size;
   max_block_size_ = options.max_block_size;
   block_alloc = options.block_alloc;
   block_alloc = options.block_alloc;
   block_dealloc = options.block_dealloc;
   block_dealloc = options.block_dealloc;
-  blocks_ = NULL;
-  hint_ = NULL;
+  blocks_ = 0;
+  hint_ = 0;
   owns_first_block_ = true;
   owns_first_block_ = true;
-  cleanup_list_ = NULL;
+  cleanup_list_ = 0;
 
 
   if (options.initial_block != NULL && options.initial_block_size > 0) {
   if (options.initial_block != NULL && options.initial_block_size > 0) {
     // Add first unowned block to list.
     // Add first unowned block to list.

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

@@ -144,6 +144,8 @@ const char* FileDescriptor::SyntaxName(FileDescriptor::Syntax syntax) {
     case SYNTAX_UNKNOWN:
     case SYNTAX_UNKNOWN:
       return "unknown";
       return "unknown";
   }
   }
+  GOOGLE_LOG(FATAL) << "can't reach here.";
+  return NULL;
 }
 }
 
 
 static const char * const kNonLinkedWeakMessageReplacementName = "google.protobuf.Empty";
 static const char * const kNonLinkedWeakMessageReplacementName = "google.protobuf.Empty";

+ 2 - 0
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
     // Do not add a default statement. Let the compiler complain when someone
     // adds a new wire type.
     // adds a new wire type.
   }
   }
+  GOOGLE_LOG(FATAL) << "can't reach here.";
+  return false;
 }
 }
 
 
 // Registry stuff.
 // Registry stuff.

+ 2 - 2
src/google/protobuf/generated_message_reflection.cc

@@ -487,11 +487,11 @@ void GeneratedMessageReflection::SwapOneofField(
   double temp_double;
   double temp_double;
   bool temp_bool;
   bool temp_bool;
   int temp_int;
   int temp_int;
-  Message* temp_message;
+  Message* temp_message = NULL;
   string temp_string;
   string temp_string;
 
 
   // Stores message1's oneof field to a temp variable.
   // Stores message1's oneof field to a temp variable.
-  const FieldDescriptor* field1;
+  const FieldDescriptor* field1 = NULL;
   if (oneof_case1 > 0) {
   if (oneof_case1 > 0) {
     field1 = descriptor_->FindFieldByNumber(oneof_case1);
     field1 = descriptor_->FindFieldByNumber(oneof_case1);
     //oneof_descriptor->field(oneof_case1);
     //oneof_descriptor->field(oneof_case1);

+ 3 - 2
src/google/protobuf/stubs/common.h

@@ -381,8 +381,9 @@ struct CompileAssert {
 
 
 #undef GOOGLE_COMPILE_ASSERT
 #undef GOOGLE_COMPILE_ASSERT
 #define GOOGLE_COMPILE_ASSERT(expr, msg) \
 #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:
 // Implementation details of COMPILE_ASSERT:

+ 0 - 2
src/google/protobuf/stubs/map_util.h

@@ -353,7 +353,6 @@ template <class Collection>
 void InsertOrDie(Collection* const collection,
 void InsertOrDie(Collection* const collection,
                  const typename Collection::value_type::first_type& key,
                  const typename Collection::value_type::first_type& key,
                  const typename Collection::value_type::second_type& data) {
                  const typename Collection::value_type::second_type& data) {
-  typedef typename Collection::value_type value_type;
   GOOGLE_CHECK(InsertIfNotPresent(collection, key, data))
   GOOGLE_CHECK(InsertIfNotPresent(collection, key, data))
       << "duplicate key: " << key;
       << "duplicate key: " << key;
 }
 }
@@ -364,7 +363,6 @@ void InsertOrDieNoPrint(
     Collection* const collection,
     Collection* const collection,
     const typename Collection::value_type::first_type& key,
     const typename Collection::value_type::first_type& key,
     const typename Collection::value_type::second_type& data) {
     const typename Collection::value_type::second_type& data) {
-  typedef typename Collection::value_type value_type;
   GOOGLE_CHECK(InsertIfNotPresent(collection, key, data)) << "duplicate key.";
   GOOGLE_CHECK(InsertIfNotPresent(collection, key, data)) << "duplicate key.";
 }
 }