diff options
author | Adam Cozzette <acozzette@google.com> | 2016-11-17 16:48:38 -0800 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2016-11-17 16:59:59 -0800 |
commit | 5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74 (patch) | |
tree | 0276f81f8848a05d84cd7e287b43d665e30f04e3 /src/google/protobuf/generated_message_util.h | |
parent | e28286fa05d8327fd6c5aa70cfb3be558f0932b8 (diff) |
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/generated_message_util.h')
-rw-r--r-- | src/google/protobuf/generated_message_util.h | 20 |
1 files changed, 16 insertions, 4 deletions
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 <google/protobuf/stubs/once.h> #include <google/protobuf/has_bits.h> +#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<const T&>(union_); } +#if __cplusplus >= 201103L + constexpr +#endif + const T& + get() const { + return reinterpret_cast<const T&>(union_); + } T* get_mutable() { return reinterpret_cast<T*>(&union_); } private: @@ -140,9 +154,7 @@ template <class Type> 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 |