aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/generated_message_util.h
diff options
context:
space:
mode:
authorGravatar Adam Cozzette <acozzette@gmail.com>2018-07-09 09:35:48 -0700
committerGravatar GitHub <noreply@github.com>2018-07-09 09:35:48 -0700
commite1845779ed1115dd61eb2a3b8f0a78c252ca5b2b (patch)
treefdb892e4e34269f6b3bbb6f629a912d4c63c2d70 /src/google/protobuf/generated_message_util.h
parentf7ada1280fac4af717d478e6a9765d3f02b418b3 (diff)
parenta9abc7831e45257d334cfa682746b6cadf9e95d9 (diff)
Merge pull request #4878 from acozzette/fix-msvc-initialization
Fix initialization with Visual Studio
Diffstat (limited to 'src/google/protobuf/generated_message_util.h')
-rw-r--r--src/google/protobuf/generated_message_util.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h
index 706df383..04f68a6e 100644
--- a/src/google/protobuf/generated_message_util.h
+++ b/src/google/protobuf/generated_message_util.h
@@ -109,6 +109,13 @@ namespace internal {
LIBPROTOBUF_EXPORT double Infinity();
LIBPROTOBUF_EXPORT double NaN();
+LIBPROTOBUF_EXPORT void InitProtobufDefaults();
+
+// This used by proto1
+inline const std::string& GetEmptyString() {
+ InitProtobufDefaults();
+ return GetEmptyStringAlreadyInited();
+}
// True if IsInitialized() is true for all elements of t. Type is expected
// to be a RepeatedPtrField<some message type>. It's useful to have this
@@ -137,8 +144,6 @@ bool AllAreInitializedWeak(const ::google::protobuf::RepeatedPtrField<T>& t) {
return true;
}
-LIBPROTOBUF_EXPORT void InitProtobufDefaults();
-
struct LIBPROTOBUF_EXPORT FieldMetadata {
uint32 offset; // offset of this field in the struct
uint32 tag; // field * 8 + wire_type
@@ -368,6 +373,17 @@ inline void InitSCC(SCCInfoBase* scc) {
if (GOOGLE_PREDICT_FALSE(status != SCCInfoBase::kInitialized)) InitSCCImpl(scc);
}
+LIBPROTOBUF_EXPORT void DestroyMessage(const void* message);
+LIBPROTOBUF_EXPORT void DestroyString(const void* s);
+// Destroy (not delete) the message
+inline void OnShutdownDestroyMessage(const void* ptr) {
+ OnShutdownRun(DestroyMessage, ptr);
+}
+// Destroy the string (call string destructor)
+inline void OnShutdownDestroyString(const std::string* ptr) {
+ OnShutdownRun(DestroyString, ptr);
+}
+
} // namespace internal
} // namespace protobuf