diff options
author | brian-peloton <brian@peloton-tech.com> | 2017-05-23 16:22:57 -0700 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2017-05-23 16:22:57 -0700 |
commit | 40da1ed572d60e9c7cc2fe1ca4175e30682f5a9d (patch) | |
tree | 78c05eefc2a870be1ed053fe77d7f349f4cf1413 /src/google/protobuf/arena.h | |
parent | ba987a7e2d039107d304aa945fee662399461d58 (diff) |
Removing undefined behavior and compiler warnings (#1315)
* Comment out unused arguments.
These last few are all that's needed to compile with -Wunused-arguments.
* Fix missing struct field initializer.
With this fix, everything compiles with -Wmissing-field-initializers.
* Add support for disabling unaligned memory accesses on x86 too.
ubsan doesn't like these because they are technically undefined
behavior, so -DGOOGLE_PROTOBUF_DONT_USE_UNALIGNED will disable them easily.
* Avoid undefined integer overflow.
ubsan catches all of these.
Diffstat (limited to 'src/google/protobuf/arena.h')
-rw-r--r-- | src/google/protobuf/arena.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index b6a375ac..0ffc6004 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -829,13 +829,13 @@ class LIBPROTOBUF_EXPORT Arena { } template <typename T> static void CreateInArenaStorageInternal( - T* ptr, Arena* arena, google::protobuf::internal::false_type) { + T* ptr, Arena* /* arena */, google::protobuf::internal::false_type) { new (ptr) T(); } template <typename T> static void RegisterDestructorInternal( - T* ptr, Arena* arena, google::protobuf::internal::true_type) {} + T* /* ptr */, Arena* /* arena */, google::protobuf::internal::true_type) {} template <typename T> static void RegisterDestructorInternal( T* ptr, Arena* arena, google::protobuf::internal::false_type) { @@ -870,7 +870,7 @@ class LIBPROTOBUF_EXPORT Arena { } template<typename T> GOOGLE_ATTRIBUTE_ALWAYS_INLINE - static ::google::protobuf::Arena* GetArenaInternal(const T* value, ...) { + static ::google::protobuf::Arena* GetArenaInternal(const T* /* value */, ...) { return NULL; } |