Эх сурвалжийг харах

Merge pull request #734 from TeBoring/beta-1

Fix bugs on windows
Feng Xiao 10 жил өмнө
parent
commit
5da0b46811

+ 32 - 27
Makefile.am

@@ -594,33 +594,38 @@ ruby_EXTRA_DIST=                                                             \
 
 all_EXTRA_DIST=$(csharp_EXTRA_DIST) $(java_EXTRA_DIST) $(javanano_EXTRA_DIST) $(objectivec_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST)
 
-EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
-  autogen.sh                           \
-  generate_descriptor_proto.sh         \
-  README.md                            \
-  INSTALL.txt                          \
-  LICENSE                              \
-  CONTRIBUTORS.txt                     \
-  CHANGES.txt                          \
-  update_file_lists.sh                 \
-  cmake/CMakeLists.txt                 \
-  cmake/libprotobuf.cmake              \
-  cmake/libprotobuf-lite.cmake         \
-  cmake/libprotoc.cmake                \
-  cmake/protoc.cmake                   \
-  cmake/README.md                      \
-  cmake/tests.cmake                    \
-  editors/README.txt                   \
-  editors/proto.vim                    \
-  editors/protobuf-mode.el             \
-  examples/README.txt                  \
-  examples/Makefile                    \
-  examples/addressbook.proto           \
-  examples/add_person.cc               \
-  examples/list_people.cc              \
-  examples/AddPerson.java              \
-  examples/ListPeople.java             \
-  examples/add_person.py               \
+EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST)   \
+  autogen.sh                             \
+  generate_descriptor_proto.sh           \
+  README.md                              \
+  INSTALL.txt                            \
+  LICENSE                                \
+  CONTRIBUTORS.txt                       \
+  CHANGES.txt                            \
+  update_file_lists.sh                   \
+  cmake/CMakeLists.txt                   \
+  cmake/README.md                        \
+  cmake/extract_includes.bat.in          \
+  cmake/install.cmake                    \
+  cmake/libprotobuf.cmake                \
+  cmake/libprotobuf-lite.cmake           \
+  cmake/libprotoc.cmake                  \
+  cmake/protobuf-config-version.cmake.in \
+  cmake/protobuf-config.cmake.in         \
+  cmake/protobuf-module.cmake.in         \
+  cmake/protoc.cmake                     \
+  cmake/tests.cmake                      \
+  editors/README.txt                     \
+  editors/proto.vim                      \
+  editors/protobuf-mode.el               \
+  examples/README.txt                    \
+  examples/Makefile                      \
+  examples/addressbook.proto             \
+  examples/add_person.cc                 \
+  examples/list_people.cc                \
+  examples/AddPerson.java                \
+  examples/ListPeople.java               \
+  examples/add_person.py                 \
   examples/list_people.py
 
 # Deletes all the files generated by autogen.sh.

+ 0 - 1
cmake/tests.cmake

@@ -36,7 +36,6 @@ set(tests_protos
   google/protobuf/unittest_drop_unknown_fields.proto
   google/protobuf/unittest_embed_optimize_for.proto
   google/protobuf/unittest_empty.proto
-  google/protobuf/unittest_enormous_descriptor.proto
   google/protobuf/unittest_import.proto
   google/protobuf/unittest_import_public.proto
   google/protobuf/unittest_lite_imports_nonlite.proto

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

@@ -32,6 +32,9 @@
 #define GOOGLE_PROTOBUF_ARENA_H__
 
 #include <limits>
+#ifdef max
+#undef max  // Visual Studio defines this macro
+#endif
 #if __cplusplus >= 201103L
 #include <google/protobuf/stubs/type_traits.h>
 #endif

+ 4 - 0
src/google/protobuf/compiler/cpp/cpp_unittest.cc

@@ -55,7 +55,9 @@
 #include <google/protobuf/unittest.pb.h>
 #include <google/protobuf/unittest_optimize_for.pb.h>
 #include <google/protobuf/unittest_embed_optimize_for.pb.h>
+#if !defined(_MSC_VER)  // Too large for visual studio to compile
 #include <google/protobuf/unittest_enormous_descriptor.pb.h>
+#endif
 #include <google/protobuf/unittest_no_generic_services.pb.h>
 #include <google/protobuf/test_util.h>
 #include <google/protobuf/compiler/cpp/cpp_helpers.h>
@@ -133,6 +135,7 @@ TEST(GeneratedDescriptorTest, IdenticalDescriptors) {
             generated_decsriptor_proto.DebugString());
 }
 
+#if !defined(_MSC_VER)
 // Test that generated code has proper descriptors:
 // Touch a descriptor generated from an enormous message to validate special
 // handling for descriptors exceeding the C++ standard's recommended minimum
@@ -143,6 +146,7 @@ TEST(GeneratedDescriptorTest, EnormousDescriptor) {
 
   EXPECT_TRUE(generated_descriptor != NULL);
 }
+#endif
 
 #endif  // !PROTOBUF_TEST_NO_DESCRIPTORS
 

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

@@ -417,12 +417,12 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection : public Reflection {
  protected:
   void* MutableRawRepeatedField(
       Message* message, const FieldDescriptor* field, FieldDescriptor::CppType,
-      int ctype, const Descriptor* desc) const override;
+      int ctype, const Descriptor* desc) const;
 
   const void* GetRawRepeatedField(
       const Message& message, const FieldDescriptor* field,
       FieldDescriptor::CppType, int ctype,
-      const Descriptor* desc) const override;
+      const Descriptor* desc) const;
 
   virtual MessageFactory* GetMessageFactory() const;
 

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

@@ -592,7 +592,7 @@ class Map {
   typedef MapAllocator<std::pair<const Key, MapPair<Key, T>*> > Allocator;
 
   // Iterators
-  class LIBPROTOBUF_EXPORT const_iterator
+  class const_iterator
       : public std::iterator<std::forward_iterator_tag, value_type, ptrdiff_t,
                              const value_type*, const value_type&> {
     typedef typename hash_map<Key, value_type*, hash<Key>, equal_to<Key>,
@@ -853,6 +853,29 @@ struct hash<google::protobuf::MapKey> {
         return 0;
     }
   }
+  bool
+  operator()(const google::protobuf::MapKey& map_key1,
+             const google::protobuf::MapKey& map_key2) const {
+    switch (map_key1.type()) {
+#define COMPARE_CPPTYPE(CPPTYPE, CPPTYPE_METHOD)             \
+      case google::protobuf::FieldDescriptor::CPPTYPE_##CPPTYPE: \
+        return map_key1.Get##CPPTYPE_METHOD##Value() <           \
+               map_key2.Get##CPPTYPE_METHOD##Value();
+      COMPARE_CPPTYPE(STRING, String)
+      COMPARE_CPPTYPE(INT64,  Int64)
+      COMPARE_CPPTYPE(INT32,  Int32)
+      COMPARE_CPPTYPE(UINT64, UInt64)
+      COMPARE_CPPTYPE(UINT32, UInt32)
+      COMPARE_CPPTYPE(BOOL,   Bool)
+#undef COMPARE_CPPTYPE
+      case google::protobuf::FieldDescriptor::CPPTYPE_DOUBLE:
+      case google::protobuf::FieldDescriptor::CPPTYPE_FLOAT:
+      case google::protobuf::FieldDescriptor::CPPTYPE_ENUM:
+      case google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE:
+        GOOGLE_LOG(FATAL) << "Can't get here.";
+        return true;
+    }
+  }
 };
 GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END
 

+ 2 - 2
src/google/protobuf/map_entry_lite.h

@@ -292,7 +292,7 @@ class MapEntryLite : public MessageLite {
   // only takes references of given key and value.
   template <typename K, typename V, WireFormatLite::FieldType k_wire_type,
             WireFormatLite::FieldType v_wire_type, int default_enum>
-  class LIBPROTOBUF_EXPORT MapEntryWrapper
+  class MapEntryWrapper
       : public MapEntryLite<K, V, k_wire_type, v_wire_type, default_enum> {
     typedef MapEntryLite<K, V, k_wire_type, v_wire_type, default_enum> Base;
     typedef typename Base::KeyMapEntryAccessorType KeyMapEntryAccessorType;
@@ -326,7 +326,7 @@ class MapEntryLite : public MessageLite {
   // the temporary.
   template <typename K, typename V, WireFormatLite::FieldType k_wire_type,
             WireFormatLite::FieldType v_wire_type, int default_enum>
-  class LIBPROTOBUF_EXPORT MapEnumEntryWrapper
+  class MapEnumEntryWrapper
       : public MapEntryLite<K, V, k_wire_type, v_wire_type, default_enum> {
     typedef MapEntryLite<K, V, k_wire_type, v_wire_type, default_enum> Base;
     typedef typename Base::KeyMapEntryAccessorType KeyMapEntryAccessorType;

+ 7 - 7
src/google/protobuf/map_field.cc

@@ -160,7 +160,7 @@ DynamicMapField::DynamicMapField(const Message* default_entry,
 DynamicMapField::~DynamicMapField() {
   // DynamicMapField owns map values. Need to delete them before clearing
   // the map.
-  for (typename Map<MapKey, MapValueRef>::iterator iter = map_.begin();
+  for (Map<MapKey, MapValueRef>::iterator iter = map_.begin();
        iter != map_.end(); ++iter) {
     iter->second.DeleteData();
   }
@@ -174,7 +174,7 @@ int DynamicMapField::size() const {
 bool DynamicMapField::ContainsMapKey(
     const MapKey& map_key) const {
   const Map<MapKey, MapValueRef>& map = GetMap();
-  typename Map<MapKey, MapValueRef>::const_iterator iter = map.find(map_key);
+  Map<MapKey, MapValueRef>::const_iterator iter = map.find(map_key);
   return iter != map.end();
 }
 
@@ -246,7 +246,7 @@ Map<MapKey, MapValueRef>* DynamicMapField::MutableMap() {
 }
 
 void DynamicMapField::SetMapIteratorValue(MapIterator* map_iter) const {
-  typename Map<MapKey, MapValueRef>::const_iterator iter =
+  Map<MapKey, MapValueRef>::const_iterator iter =
       TypeDefinedMapFieldBase<MapKey, MapValueRef>::InternalGetIterator(
           map_iter);
   if (iter == map_.end()) return;
@@ -272,7 +272,7 @@ void DynamicMapField::SyncRepeatedFieldWithMapNoLock() const {
 
   MapFieldBase::repeated_field_->Clear();
 
-  for (typename Map<MapKey, MapValueRef>::const_iterator it = map_.begin();
+  for (Map<MapKey, MapValueRef>::const_iterator it = map_.begin();
        it != map_.end(); ++it) {
     Message* new_entry = default_entry_->New();
     MapFieldBase::repeated_field_->AddAllocated(new_entry);
@@ -350,12 +350,12 @@ void DynamicMapField::SyncMapWithRepeatedFieldNoLock() const {
       default_entry_->GetDescriptor()->FindFieldByName("value");
   // DynamicMapField owns map values. Need to delete them before clearing
   // the map.
-  for (typename Map<MapKey, MapValueRef>::iterator iter = map->begin();
+  for (Map<MapKey, MapValueRef>::iterator iter = map->begin();
        iter != map->end(); ++iter) {
     iter->second.DeleteData();
   }
   map->clear();
-  for (typename RepeatedPtrField<Message>::iterator it =
+  for (RepeatedPtrField<Message>::iterator it =
            MapFieldBase::repeated_field_->begin();
        it != MapFieldBase::repeated_field_->end(); ++it) {
     MapKey map_key;
@@ -424,7 +424,7 @@ int DynamicMapField::SpaceUsedExcludingSelfNoLock() const {
   size += sizeof(map_);
   int map_size = map_.size();
   if (map_size) {
-    typename Map<MapKey, MapValueRef>::const_iterator it = map_.begin();
+    Map<MapKey, MapValueRef>::const_iterator it = map_.begin();
     size += sizeof(it->first) * map_size;
     size += sizeof(it->second) * map_size;
     // If key is string, add the allocated space.

+ 3 - 1
src/google/protobuf/map_field_inl.h

@@ -153,7 +153,9 @@ void TypeDefinedMapFieldBase<Key, T>::CopyIterator(
     const MapIterator& that_iter) const {
   InternalGetIterator(this_iter) = InternalGetIterator(&that_iter);
   this_iter->key_.SetType(that_iter.key_.type());
-  this_iter->value_.SetType(that_iter.value_.type());
+  // MapValueRef::type() fails when containing data is null. However, if
+  // this_iter points to MapEnd, data can be null.
+  this_iter->value_.SetType((FieldDescriptor::CppType)that_iter.value_.type_);
   SetMapIteratorValue(this_iter);
 }
 

+ 5 - 15
src/google/protobuf/stubs/hash.h

@@ -103,8 +103,8 @@
 #  define GOOGLE_PROTOBUF_HAS_CXX11_HASH
 #  define GOOGLE_PROTOBUF_HASH_COMPARE std::hash_compare
 # elif _MSC_VER >= 1500  // Since Visual Studio 2008
-#  define GOOGLE_PROTOBUF_HAS_TR1
-#  define GOOGLE_PROTOBUF_HASH_COMPARE stdext::hash_compare
+#  undef GOOGLE_PROTOBUF_HAVE_HASH_MAP
+#  undef GOOGLE_PROTOBUF_HAVE_HASH_SET
 # elif _MSC_VER >= 1310
 #  define GOOGLE_PROTOBUF_HASH_NAMESPACE stdext
 #  include <hash_map>
@@ -143,20 +143,10 @@
 # define GOOGLE_PROTOBUF_HASH_SET_CLASS unordered_set
 #endif
 
-#ifndef GOOGLE_PROTOBUF_HASH_NAMESPACE
-# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START
-# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END
-#elif !defined(GOOGLE_PROTOBUF_HAS_CXX11_HASH) &&       \
-  defined(GOOGLE_PROTOBUF_HAS_TR1)
-# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START       \
-  namespace std {                                               \
-  namespace tr1 {
+# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START \
+  namespace google {                                      \
+  namespace protobuf {
 # define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END }}
-#else
-# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_START       \
-  namespace GOOGLE_PROTOBUF_HASH_NAMESPACE {
-# define GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END }
-#endif
 
 #undef GOOGLE_PROTOBUF_HAS_CXX11_HASH
 #undef GOOGLE_PROTOBUF_HAS_TR1

+ 6 - 4
src/google/protobuf/stubs/int128.h

@@ -48,7 +48,7 @@ struct uint128_pod;
 #endif
 
 // An unsigned 128-bit integer type. Thread-compatible.
-class uint128 {
+class LIBPROTOBUF_EXPORT uint128 {
  public:
   UINT128_CONSTEXPR uint128();  // Sets to 0, but don't trust on this behavior.
   UINT128_CONSTEXPR uint128(uint64 top, uint64 bottom);
@@ -84,7 +84,8 @@ class uint128 {
   friend uint64 Uint128High64(const uint128& v);
 
   // We add "std::" to avoid including all of port.h.
-  friend std::ostream& operator<<(std::ostream& o, const uint128& b);
+  LIBPROTOBUF_EXPORT friend std::ostream& operator<<(std::ostream& o,
+                                                     const uint128& b);
 
  private:
   static void DivModImpl(uint128 dividend, uint128 divisor,
@@ -115,10 +116,11 @@ struct uint128_pod {
   uint64 lo;
 };
 
-extern const uint128_pod kuint128max;
+LIBPROTOBUF_EXPORT extern const uint128_pod kuint128max;
 
 // allow uint128 to be logged
-extern std::ostream& operator<<(std::ostream& o, const uint128& b);
+LIBPROTOBUF_EXPORT extern std::ostream& operator<<(std::ostream& o,
+                                                   const uint128& b);
 
 // Methods to access low and high pieces of 128-bit value.
 // Defined externally from uint128 to facilitate conversion

+ 14 - 2
src/google/protobuf/stubs/mathutil.h

@@ -45,9 +45,21 @@ bool IsNan(T value) {
   return false;
 }
 template<>
-inline bool IsNan(float value) { return isnan(value); }
+inline bool IsNan(float value) {
+#ifdef _MSC_VER
+  return _isnan(value);
+#else
+  return isnan(value);
+#endif
+}
 template<>
-inline bool IsNan(double value) { return isnan(value); }
+inline bool IsNan(double value) {
+#ifdef _MSC_VER
+  return _isnan(value);
+#else
+  return isnan(value);
+#endif
+}
 
 template<typename T>
 bool AlmostEquals(T a, T b) {

+ 0 - 1
src/google/protobuf/stubs/status.cc

@@ -30,7 +30,6 @@
 #include <google/protobuf/stubs/status.h>
 
 #include <ostream>
-#include <stdint.h>
 #include <stdio.h>
 #include <string>
 #include <utility>

+ 7 - 7
src/google/protobuf/util/internal/datapiece.h

@@ -193,13 +193,13 @@ class LIBPROTOBUF_EXPORT DataPiece {
 
   // Stored piece of data.
   union {
-    const int32 i32_;
-    const int64 i64_;
-    const uint32 u32_;
-    const uint64 u64_;
-    const double double_;
-    const float float_;
-    const bool bool_;
+    int32 i32_;
+    int64 i64_;
+    uint32 u32_;
+    uint64 u64_;
+    double double_;
+    float float_;
+    bool bool_;
     StringPiecePod str_;
   };
 };

+ 1 - 1
src/google/protobuf/util/internal/default_value_objectwriter.h

@@ -57,7 +57,7 @@ namespace converter {
 // ObjectWriter when EndObject() is called on the root object. It also writes
 // out all non-repeated primitive fields that haven't been explicitly rendered
 // with their default values (0 for numbers, "" for strings, etc).
-class DefaultValueObjectWriter : public ObjectWriter {
+class LIBPROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
  public:
   DefaultValueObjectWriter(TypeResolver* type_resolver,
                            const google::protobuf::Type& type,

+ 7 - 2
src/google/protobuf/util/internal/json_objectwriter.cc

@@ -37,6 +37,7 @@
 #include <google/protobuf/stubs/common.h>
 #include <google/protobuf/util/internal/utility.h>
 #include <google/protobuf/util/internal/json_escaping.h>
+#include <google/protobuf/stubs/mathlimits.h>
 #include <google/protobuf/stubs/strutil.h>
 
 namespace google {
@@ -115,7 +116,9 @@ JsonObjectWriter* JsonObjectWriter::RenderUint64(StringPiece name,
 
 JsonObjectWriter* JsonObjectWriter::RenderDouble(StringPiece name,
                                                  double value) {
-  if (isfinite(value)) return RenderSimple(name, SimpleDtoa(value));
+  if (google::protobuf::MathLimits<double>::IsFinite(value)) {
+    return RenderSimple(name, SimpleDtoa(value));
+  }
 
   // Render quoted with NaN/Infinity-aware DoubleAsString.
   return RenderString(name, DoubleAsString(value));
@@ -123,7 +126,9 @@ JsonObjectWriter* JsonObjectWriter::RenderDouble(StringPiece name,
 
 JsonObjectWriter* JsonObjectWriter::RenderFloat(StringPiece name,
                                                 float value) {
-  if (isfinite(value)) return RenderSimple(name, SimpleFtoa(value));
+  if (google::protobuf::MathLimits<float>::IsFinite(value)) {
+    return RenderSimple(name, SimpleFtoa(value));
+  }
 
   // Render quoted with NaN/Infinity-aware FloatAsString.
   return RenderString(name, FloatAsString(value));

+ 1 - 1
src/google/protobuf/util/internal/type_info.h

@@ -44,7 +44,7 @@ namespace util {
 namespace converter {
 // Internal helper class for type resolving. Note that this class is not
 // thread-safe and should only be accessed in one thread.
-class TypeInfo {
+class LIBPROTOBUF_EXPORT TypeInfo {
  public:
   TypeInfo() {}
   virtual ~TypeInfo() {}

+ 1 - 1
src/google/protobuf/util/internal/utility.cc

@@ -307,7 +307,7 @@ string DoubleAsString(double value) {
 }
 
 string FloatAsString(float value) {
-  if (isfinite(value)) return SimpleFtoa(value);
+  if (google::protobuf::MathLimits<float>::IsFinite(value)) return SimpleFtoa(value);
   return DoubleAsString(value);
 }
 

+ 2 - 2
src/google/protobuf/util/json_util.h

@@ -80,7 +80,7 @@ inline util::Status BinaryToJsonStream(
                             JsonOptions());
 }
 
-util::Status BinaryToJsonString(
+LIBPROTOBUF_EXPORT util::Status BinaryToJsonString(
     TypeResolver* resolver,
     const string& type_url,
     const string& binary_input,
@@ -107,7 +107,7 @@ util::Status JsonToBinaryStream(
     io::ZeroCopyInputStream* json_input,
     io::ZeroCopyOutputStream* binary_output);
 
-util::Status JsonToBinaryString(
+LIBPROTOBUF_EXPORT util::Status JsonToBinaryString(
     TypeResolver* resolver,
     const string& type_url,
     const string& json_input,

+ 20 - 11
src/google/protobuf/util/time_util.h

@@ -31,13 +31,17 @@
 #ifndef GOOGLE_PROTOBUF_UTIL_TIME_UTIL_H__
 #define GOOGLE_PROTOBUF_UTIL_TIME_UTIL_H__
 
-#include <sys/time.h>
-
 #include <ctime>
 #include <ostream>
 #include <string>
+#ifdef _MSC_VER
+#include <winsock2.h>
+#else
+#include <sys/time.h>
+#endif
 
 #include <google/protobuf/duration.pb.h>
+#include <google/protobuf/stubs/port.h>
 #include <google/protobuf/timestamp.pb.h>
 
 namespace google {
@@ -85,6 +89,9 @@ class LIBPROTOBUF_EXPORT TimeUtil {
   static string ToString(const Duration& duration);
   static bool FromString(const string& value, Duration* timestamp);
 
+#ifdef GetCurrentTime
+#undef GetCurrentTime  // Visual Studio has macro GetCurrentTime
+#endif
   // Gets the current UTC time.
   static Timestamp GetCurrentTime();
   // Returns the Time representing "1970-01-01 00:00:00".
@@ -153,12 +160,12 @@ namespace protobuf {
 // Overloaded operators for Duration.
 //
 // Assignment operators.
-Duration& operator+=(Duration& d1, const Duration& d2);  // NOLINT
-Duration& operator-=(Duration& d1, const Duration& d2);  // NOLINT
-Duration& operator*=(Duration& d, int64 r);  // NOLINT
-Duration& operator*=(Duration& d, double r);  // NOLINT
-Duration& operator/=(Duration& d, int64 r);  // NOLINT
-Duration& operator/=(Duration& d, double r);  // NOLINT
+LIBPROTOBUF_EXPORT Duration& operator+=(Duration& d1, const Duration& d2);  // NOLINT
+LIBPROTOBUF_EXPORT Duration& operator-=(Duration& d1, const Duration& d2);  // NOLINT
+LIBPROTOBUF_EXPORT Duration& operator*=(Duration& d, int64 r);  // NOLINT
+LIBPROTOBUF_EXPORT Duration& operator*=(Duration& d, double r);  // NOLINT
+LIBPROTOBUF_EXPORT Duration& operator/=(Duration& d, int64 r);  // NOLINT
+LIBPROTOBUF_EXPORT Duration& operator/=(Duration& d, double r);  // NOLINT
 // Overload for other integer types.
 template <typename T>
 Duration& operator*=(Duration& d, T r) {  // NOLINT
@@ -170,7 +177,7 @@ Duration& operator/=(Duration& d, T r) {  // NOLINT
   int64 x = r;
   return d /= x;
 }
-Duration& operator%=(Duration& d1, const Duration& d2);  // NOLINT
+LIBPROTOBUF_EXPORT Duration& operator%=(Duration& d1, const Duration& d2);  // NOLINT
 // Relational operators.
 inline bool operator<(const Duration& d1, const Duration& d2) {
   if (d1.seconds() == d2.seconds()) {
@@ -221,7 +228,7 @@ template<typename T>
 inline Duration operator/(Duration d, T r) {
   return d /= r;
 }
-int64 operator/(const Duration& d1, const Duration& d2);
+LIBPROTOBUF_EXPORT int64 operator/(const Duration& d1, const Duration& d2);
 
 inline Duration operator%(const Duration& d1, const Duration& d2) {
   Duration result = d1;
@@ -236,7 +243,9 @@ inline ostream& operator<<(ostream& out, const Duration& d) {
 // Overloaded operators for Timestamp
 //
 // Assignement operators.
+LIBPROTOBUF_EXPORT
 Timestamp& operator+=(Timestamp& t, const Duration& d);  // NOLINT
+LIBPROTOBUF_EXPORT
 Timestamp& operator-=(Timestamp& t, const Duration& d);  // NOLINT
 // Relational operators.
 inline bool operator<(const Timestamp& t1, const Timestamp& t2) {
@@ -273,7 +282,7 @@ inline Timestamp operator-(const Timestamp& t, const Duration& d) {
   Timestamp result = t;
   return result -= d;
 }
-Duration operator-(const Timestamp& t1, const Timestamp& t2);
+LIBPROTOBUF_EXPORT Duration operator-(const Timestamp& t1, const Timestamp& t2);
 
 inline ostream& operator<<(ostream& out, const Timestamp& t) {
   out << google::protobuf::util::TimeUtil::ToString(t);

+ 1 - 1
src/google/protobuf/util/type_resolver_util.h

@@ -42,7 +42,7 @@ class TypeResolver;
 
 // Creates a TypeResolver that serves type information in the given descriptor
 // pool. Caller takes ownership of the returned TypeResolver.
-TypeResolver* NewTypeResolverForDescriptorPool(
+LIBPROTOBUF_EXPORT TypeResolver* NewTypeResolverForDescriptorPool(
     const string& url_prefix, const DescriptorPool* pool);
 
 }  // namespace util

+ 6 - 1
update_file_lists.sh

@@ -27,6 +27,10 @@ get_source_files() {
   get_variable_value $@ | grep "cc$"
 }
 
+get_proto_files_blacklisted() {
+  get_proto_files $@ | sed '/^google\/protobuf\/unittest_enormous_descriptor.proto$/d'
+}
+
 get_proto_files() {
   get_variable_value $@ | grep "pb.cc$" | sed "s/pb.cc/proto/"
 }
@@ -53,6 +57,7 @@ LIBPROTOBUF_SOURCES=$(get_source_files $MAKEFILE libprotobuf_la_SOURCES)
 LIBPROTOC_SOURCES=$(get_source_files $MAKEFILE libprotoc_la_SOURCES)
 LITE_PROTOS=$(get_proto_files $MAKEFILE protoc_lite_outputs)
 PROTOS=$(get_proto_files $MAKEFILE protoc_outputs)
+PROTOS_BLACKLISTED=$(get_proto_files_blacklisted $MAKEFILE protoc_outputs)
 WKT_PROTOS=$(get_variable_value $MAKEFILE nobase_dist_proto_DATA)
 COMMON_TEST_SOURCES=$(get_source_files $MAKEFILE COMMON_TEST_SOURCES)
 COMMON_LITE_TEST_SOURCES=$(get_source_files $MAKEFILE COMMON_LITE_TEST_SOURCES)
@@ -112,7 +117,7 @@ set_cmake_value $CMAKE_DIR/libprotobuf-lite.cmake libprotobuf_lite_files $CMAKE_
 set_cmake_value $CMAKE_DIR/libprotobuf.cmake libprotobuf_files $CMAKE_PREFIX $LIBPROTOBUF_SOURCES
 set_cmake_value $CMAKE_DIR/libprotoc.cmake libprotoc_files $CMAKE_PREFIX $LIBPROTOC_SOURCES
 set_cmake_value $CMAKE_DIR/tests.cmake lite_test_protos "" $LITE_PROTOS
-set_cmake_value $CMAKE_DIR/tests.cmake tests_protos "" $PROTOS
+set_cmake_value $CMAKE_DIR/tests.cmake tests_protos "" $PROTOS_BLACKLISTED
 set_cmake_value $CMAKE_DIR/tests.cmake common_test_files $CMAKE_PREFIX $COMMON_TEST_SOURCES
 set_cmake_value $CMAKE_DIR/tests.cmake common_lite_test_files $CMAKE_PREFIX $COMMON_LITE_TEST_SOURCES
 set_cmake_value $CMAKE_DIR/tests.cmake tests_files $CMAKE_PREFIX $TEST_SOURCES