瀏覽代碼

Integrate changes from Google open-source branch.

Josh Haberman 10 年之前
父節點
當前提交
cb3caf1e61

+ 6 - 4
autogen.sh

@@ -15,6 +15,12 @@ __EOF__
   exit 1
 fi
 
+if test -e .git; then
+  # pull down git submodules.
+  git submodule init
+  git submodule update
+fi
+
 # Check that gtest is present.  Usually it is already there since the
 # directory is set up as an SVN external.
 if test ! -e gtest; then
@@ -39,9 +45,5 @@ sed -i -e 's/RuntimeLibrary="5"/RuntimeLibrary="3"/g;
 # TODO(kenton):  Remove the ",no-obsolete" part and fix the resulting warnings.
 autoreconf -f -i -Wall,no-obsolete
 
-# pull down git submodules.
-git submodule init
-git submodule update
-
 rm -rf autom4te.cache config.h.in~
 exit 0

+ 1 - 1
configure.ac

@@ -54,7 +54,7 @@ AC_PROG_CC
 AC_PROG_CXX
 AC_LANG([C++])
 ACX_USE_SYSTEM_EXTENSIONS
-AM_PROG_AR
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 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.

+ 1 - 0
src/Makefile.am

@@ -106,6 +106,7 @@ nobase_include_HEADERS =                                        \
   google/protobuf/compiler/plugin.pb.h                          \
   google/protobuf/compiler/cpp/cpp_generator.h                  \
   google/protobuf/compiler/java/java_generator.h                \
+  google/protobuf/compiler/java/java_names.h                    \
   google/protobuf/compiler/python/python_generator.h
 
 lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la libprotoc.la

+ 2 - 0
src/google/protobuf/arena.h

@@ -313,6 +313,8 @@ class LIBPROTOBUF_EXPORT Arena {
   static const size_t kHeaderSize = sizeof(Block);
   static google::protobuf::internal::SequenceNumber lifecycle_id_generator_;
 #ifdef PROTOBUF_USE_DLLS
+  // Thread local variables cannot be exposed through DLL interface but we can
+  // wrap them in static functions.
   static ThreadCache& thread_cache();
 #else
   static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_;

+ 21 - 7
src/google/protobuf/compiler/parser_unittest.cc

@@ -401,13 +401,27 @@ TEST_F(ParseMessageTest, FieldDefaults) {
     "  field { type:TYPE_BOOL    default_value:\"true\"      " ETC " }"
     "  field { type_name:\"Foo\" default_value:\"FOO\"       " ETC " }"
 
-    "  field { type:TYPE_INT32   default_value:\"2147483647\"           " ETC " }"
-    "  field { type:TYPE_INT32   default_value:\"-2147483648\"          " ETC " }"
-    "  field { type:TYPE_UINT32  default_value:\"4294967295\"           " ETC " }"
-    "  field { type:TYPE_INT64   default_value:\"9223372036854775807\"  " ETC " }"
-    "  field { type:TYPE_INT64   default_value:\"-9223372036854775808\" " ETC " }"
-    "  field { type:TYPE_UINT64  default_value:\"18446744073709551615\" " ETC " }"
-    "  field { type:TYPE_DOUBLE  default_value:\"43981\"                " ETC " }"
+    "  field {"
+    "    type:TYPE_INT32   default_value:\"2147483647\"           " ETC
+    "  }"
+    "  field {"
+    "    type:TYPE_INT32   default_value:\"-2147483648\"          " ETC
+    "  }"
+    "  field {"
+    "    type:TYPE_UINT32  default_value:\"4294967295\"           " ETC
+    "  }"
+    "  field {"
+    "    type:TYPE_INT64   default_value:\"9223372036854775807\"  " ETC
+    "  }"
+    "  field {"
+    "    type:TYPE_INT64   default_value:\"-9223372036854775808\" " ETC
+    "  }"
+    "  field {"
+    "    type:TYPE_UINT64  default_value:\"18446744073709551615\" " ETC
+    "  }"
+    "  field {"
+    "    type:TYPE_DOUBLE  default_value:\"43981\"                " ETC
+    "  }"
     "}");
 #undef ETC
 }

+ 3 - 2
src/google/protobuf/compiler/python/python_generator.cc

@@ -581,14 +581,15 @@ void Generator::PrintServiceDescriptor(
 }
 
 
-void Generator::PrintDescriptorKeyAndModuleName(const ServiceDescriptor& descriptor) const {	  
+void Generator::PrintDescriptorKeyAndModuleName(
+    const ServiceDescriptor& descriptor) const {
   printer_->Print(
       "$descriptor_key$ = $descriptor_name$,\n",
       "descriptor_key", kDescriptorKey,
       "descriptor_name", ModuleLevelServiceDescriptorName(descriptor));
   printer_->Print(
       "__module__ = '$module_name$'\n",
-      "module_name", ModuleName(file_->name())); 
+      "module_name", ModuleName(file_->name()));
 }
 
 void Generator::PrintServiceClass(const ServiceDescriptor& descriptor) const {

+ 2 - 1
src/google/protobuf/compiler/python/python_generator.h

@@ -127,7 +127,8 @@ class LIBPROTOC_EXPORT Generator : public CodeGenerator {
   void PrintServiceDescriptor(const ServiceDescriptor& descriptor) const;
   void PrintServiceClass(const ServiceDescriptor& descriptor) const;
   void PrintServiceStub(const ServiceDescriptor& descriptor) const;
-  void PrintDescriptorKeyAndModuleName(const ServiceDescriptor& descriptor) const ;
+  void PrintDescriptorKeyAndModuleName(
+      const ServiceDescriptor& descriptor) const ;
 
   void PrintEnumValueDescriptor(const EnumValueDescriptor& descriptor) const;
   string OptionsValue(const string& class_name,

+ 4 - 3
src/google/protobuf/compiler/ruby/ruby_generator.cc

@@ -47,7 +47,7 @@ namespace compiler {
 namespace ruby {
 
 // Forward decls.
-std::string IntToString(uint32_t value);
+std::string IntToString(uint32 value);
 std::string StripDotProto(const std::string& proto_file);
 std::string LabelForField(google::protobuf::FieldDescriptor* field);
 std::string TypeName(google::protobuf::FieldDescriptor* field);
@@ -64,7 +64,7 @@ void GenerateEnumAssignment(
     const google::protobuf::EnumDescriptor* en,
     google::protobuf::io::Printer* printer);
 
-std::string IntToString(uint32_t value) {
+std::string IntToString(uint32 value) {
   std::ostringstream os;
   os << value;
   return os.str();
@@ -299,7 +299,8 @@ bool Generator::Generate(
     string* error) const {
   std::string filename =
       StripDotProto(file->name()) + ".rb";
-  scoped_ptr<io::ZeroCopyOutputStream> output(generator_context->Open(filename));
+  scoped_ptr<io::ZeroCopyOutputStream> output(
+      generator_context->Open(filename));
   io::Printer printer(output.get(), '$');
 
   GenerateFile(file, &printer);

+ 2 - 1
src/google/protobuf/map_entry.h

@@ -45,7 +45,8 @@ namespace internal {
 
 // Register all MapEntry default instances so we can delete them in
 // ShutdownProtobufLibrary().
-void LIBPROTOBUF_EXPORT RegisterMapEntryDefaultInstance(MessageLite* default_instance);
+void LIBPROTOBUF_EXPORT RegisterMapEntryDefaultInstance(
+    MessageLite* default_instance);
 
 // This is the common base class for MapEntry. It is used by MapFieldBase in
 // reflection api, in which the static type of key and value is unknown.