Index: third_party/protobuf/patches/0012-extract-globals.patch |
diff --git a/third_party/protobuf/patches/0012-extract-globals.patch b/third_party/protobuf/patches/0012-extract-globals.patch |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c7b9a8bcd8126d9d72ac788b4b0e55245a8b2dfd |
--- /dev/null |
+++ b/third_party/protobuf/patches/0012-extract-globals.patch |
@@ -0,0 +1,66 @@ |
+diff -ru --new-file protobuf/src/google/protobuf/generated_message_util.cc protobuf2/src/google/protobuf/generated_message_util.cc |
+--- protobuf/src/google/protobuf/generated_message_util.cc 2017-03-14 18:07:36.280818971 -0700 |
++++ protobuf2/src/google/protobuf/generated_message_util.cc 2017-03-14 18:07:25.596809777 -0700 |
+@@ -48,20 +48,18 @@ |
+ return std::numeric_limits<double>::quiet_NaN(); |
+ } |
+ |
+-const ::std::string* empty_string_; |
+-GOOGLE_PROTOBUF_DECLARE_ONCE(empty_string_once_init_); |
+- |
+ void DeleteEmptyString() { |
+- delete empty_string_; |
++ delete cr_empty_string_; |
+ } |
+ |
+ void InitEmptyString() { |
+- empty_string_ = new string; |
++ cr_empty_string_ = new string; |
+ OnShutdown(&DeleteEmptyString); |
+ } |
+ |
+ const ::std::string& GetEmptyString() { |
+- ::google::protobuf::GoogleOnceInit(&empty_string_once_init_, &InitEmptyString); |
++ ::google::protobuf::GoogleOnceInit(&cr_empty_string_once_init_, |
++ &InitEmptyString); |
+ return GetEmptyStringAlreadyInited(); |
+ } |
+ |
+diff -ru --new-file protobuf/src/google/protobuf/generated_message_util.h protobuf2/src/google/protobuf/generated_message_util.h |
+--- protobuf/src/google/protobuf/generated_message_util.h 2017-03-14 18:07:36.280818971 -0700 |
++++ protobuf2/src/google/protobuf/generated_message_util.h 2017-03-14 18:07:25.424809629 -0700 |
+@@ -77,14 +77,14 @@ |
+ |
+ // Default empty string object. Don't use the pointer directly. Instead, call |
+ // GetEmptyString() to get the reference. |
+-LIBPROTOBUF_EXPORT extern const ::std::string* empty_string_; |
+-LIBPROTOBUF_EXPORT extern ProtobufOnceType empty_string_once_init_; |
++LIBPROTOBUF_EXPORT extern const ::std::string* cr_empty_string_; |
++LIBPROTOBUF_EXPORT extern ProtobufOnceType cr_empty_string_once_init_; |
+ LIBPROTOBUF_EXPORT void InitEmptyString(); |
+ |
+ |
+ LIBPROTOBUF_EXPORT inline const ::std::string& GetEmptyStringAlreadyInited() { |
+- assert(empty_string_ != NULL); |
+- return *empty_string_; |
++ assert(cr_empty_string_ != NULL); |
++ return *cr_empty_string_; |
+ } |
+ |
+ LIBPROTOBUF_EXPORT const ::std::string& GetEmptyString(); |
+diff -ru --new-file protobuf/src/google/protobuf/globals.cc protobuf2/src/google/protobuf/globals.cc |
+--- protobuf/src/google/protobuf/globals.cc 1969-12-31 16:00:00.000000000 -0800 |
++++ protobuf2/src/google/protobuf/globals.cc 2017-03-14 18:07:25.412809619 -0700 |
+@@ -0,0 +1,12 @@ |
++#include <google/protobuf/generated_message_util.h> |
++ |
++namespace google { |
++namespace protobuf { |
++namespace internal { |
++ |
++const ::std::string* cr_empty_string_; |
++GOOGLE_PROTOBUF_DECLARE_ONCE(cr_empty_string_once_init_); |
++ |
++} // namespace internal |
++} // namespace protobuf |
++} // namespace google |