From 40da1ed572d60e9c7cc2fe1ca4175e30682f5a9d Mon Sep 17 00:00:00 2001 From: brian-peloton Date: Tue, 23 May 2017 16:22:57 -0700 Subject: 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. --- src/google/protobuf/message.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/google/protobuf/message.h') diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index 68acb5b1..c155cbd6 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -753,7 +753,7 @@ class LIBPROTOBUF_EXPORT Reflection { // TODO(tmarek): Make virtual after all subclasses have been // updated. virtual void AddAllocatedMessage(Message* /* message */, - const FieldDescriptor* /*field */, + const FieldDescriptor* /* field */, Message* /* new_entry */) const {} @@ -961,7 +961,7 @@ class LIBPROTOBUF_EXPORT Reflection { // TODO(jieluo) - make the map APIs pure virtual after updating // all the subclasses. // Returns true if key is in map. Returns false if key is not in map field. - virtual bool ContainsMapKey(const Message& /* message*/, + virtual bool ContainsMapKey(const Message& /* message */, const FieldDescriptor* /* field */, const MapKey& /* key */) const { return false; @@ -979,7 +979,7 @@ class LIBPROTOBUF_EXPORT Reflection { // Delete and returns true if key is in the map field. Returns false // otherwise. - virtual bool DeleteMapValue(Message* /* mesage */, + virtual bool DeleteMapValue(Message* /* message */, const FieldDescriptor* /* field */, const MapKey& /* key */) const { return false; -- cgit v1.2.3