From 5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Thu, 17 Nov 2016 16:48:38 -0800 Subject: Integrated internal changes from Google --- src/google/protobuf/generated_message_util.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/google/protobuf/generated_message_util.h') diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h index 8dc64c49..b1c49e37 100644 --- a/src/google/protobuf/generated_message_util.h +++ b/src/google/protobuf/generated_message_util.h @@ -45,6 +45,14 @@ #include #include +#ifndef PROTOBUF_FINAL +#if __cplusplus >= 201103L +#define PROTOBUF_FINAL final +#else +#define PROTOBUF_FINAL +#endif +#endif // !PROTOBUF_FINAL + namespace google { namespace protobuf { @@ -91,7 +99,13 @@ class ExplicitlyConstructed { } } - const T& get() const { return reinterpret_cast(union_); } +#if __cplusplus >= 201103L + constexpr +#endif + const T& + get() const { + return reinterpret_cast(union_); + } T* get_mutable() { return reinterpret_cast(&union_); } private: @@ -140,9 +154,7 @@ template bool AllAreInitialized(const Type& t) { return true; } -// Helper function to crash on merge failure. -// Moved out of generated code to reduce binary size. -LIBPROTOBUF_EXPORT void MergeFromFail(const char* file, int line) GOOGLE_ATTRIBUTE_NORETURN; +LIBPROTOBUF_EXPORT void InitProtobufDefaults(); // We compute sizes as size_t but cache them as int. This function converts a // computed size to a cached size. Since we don't proceed with serialization if -- cgit v1.2.3