Browse Source

Merge pull request #653 from airtimemedia/master

Various compilation fixes
Feng Xiao 10 years ago
parent
commit
dc80689af3

+ 1 - 0
cmake/libprotobuf-lite.cmake

@@ -24,6 +24,7 @@ set(libprotobuf_lite_files
 
 add_library(libprotobuf-lite ${libprotobuf_lite_files})
 target_link_libraries(libprotobuf-lite ${CMAKE_THREAD_LIBS_INIT})
+target_include_directories(libprotobuf-lite PUBLIC ${protobuf_source_dir}/src)
 set_target_properties(libprotobuf-lite PROPERTIES
     COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS
     OUTPUT_NAME ${LIB_PREFIX}protobuf-lite)

+ 1 - 0
cmake/libprotobuf.cmake

@@ -54,6 +54,7 @@ set(libprotobuf_files
 
 add_library(libprotobuf ${libprotobuf_lite_files} ${libprotobuf_files})
 target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES})
+target_include_directories(libprotobuf PUBLIC ${protobuf_source_dir}/src)
 set_target_properties(libprotobuf PROPERTIES
     COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS
     OUTPUT_NAME ${LIB_PREFIX}protobuf)

+ 1 - 3
src/google/protobuf/compiler/java/java_map_field.cc

@@ -156,9 +156,7 @@ ImmutableMapFieldGenerator(const FieldDescriptor* descriptor,
                                        int messageBitIndex,
                                        int builderBitIndex,
                                        Context* context)
-  : descriptor_(descriptor), messageBitIndex_(messageBitIndex),
-    builderBitIndex_(builderBitIndex), context_(context),
-    name_resolver_(context->GetNameResolver())  {
+  : descriptor_(descriptor), name_resolver_(context->GetNameResolver())  {
   SetMessageVariables(descriptor, messageBitIndex, builderBitIndex,
                       context->GetFieldGeneratorInfo(descriptor),
                       name_resolver_, &variables_);

+ 0 - 3
src/google/protobuf/compiler/java/java_map_field.h

@@ -68,9 +68,6 @@ class ImmutableMapFieldGenerator : public ImmutableFieldGenerator {
  private:
   const FieldDescriptor* descriptor_;
   map<string, string> variables_;
-  const int messageBitIndex_;
-  const int builderBitIndex_;
-  Context* context_;
   ClassNameResolver* name_resolver_;
 };
 

+ 1 - 3
src/google/protobuf/compiler/java/java_map_field_lite.cc

@@ -139,9 +139,7 @@ ImmutableMapFieldLiteGenerator(const FieldDescriptor* descriptor,
                                        int messageBitIndex,
                                        int builderBitIndex,
                                        Context* context)
-  : descriptor_(descriptor), messageBitIndex_(messageBitIndex),
-    builderBitIndex_(builderBitIndex), context_(context),
-    name_resolver_(context->GetNameResolver())  {
+  : descriptor_(descriptor), name_resolver_(context->GetNameResolver())  {
   SetMessageVariables(descriptor, messageBitIndex, builderBitIndex,
                       context->GetFieldGeneratorInfo(descriptor),
                       name_resolver_, &variables_);

+ 0 - 3
src/google/protobuf/compiler/java/java_map_field_lite.h

@@ -67,9 +67,6 @@ class ImmutableMapFieldLiteGenerator : public ImmutableFieldLiteGenerator {
  private:
   const FieldDescriptor* descriptor_;
   map<string, string> variables_;
-  const int messageBitIndex_;
-  const int builderBitIndex_;
-  Context* context_;
   ClassNameResolver* name_resolver_;
 };
 

+ 1 - 1
src/google/protobuf/map.h

@@ -172,7 +172,7 @@ class Map {
     !defined(GOOGLE_PROTOBUF_OS_NACL) && !defined(GOOGLE_PROTOBUF_OS_ANDROID)
     template<class NodeType, class... Args>
     void construct(NodeType* p, Args&&... args) {
-      new (p) NodeType(std::forward<Args>(args)...);
+      new ((void*)p) NodeType(std::forward<Args>(args)...);
     }
 
     template<class NodeType>

+ 4 - 0
src/google/protobuf/stubs/mutex.h

@@ -30,6 +30,10 @@
 #ifndef GOOGLE_PROTOBUF_STUBS_MUTEX_H_
 #define GOOGLE_PROTOBUF_STUBS_MUTEX_H_
 
+#ifdef GOOGLE_PROTOBUF_NO_THREADLOCAL
+#include <pthread.h>
+#endif
+
 #include <google/protobuf/stubs/macros.h>
 
 // ===================================================================