diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 6514a0cc6d..883556a74b 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -181,7 +181,7 @@ class Map { MapAllocator(const MapAllocator& allocator) : arena_(allocator.arena()) {} - pointer allocate(size_type n, const void* hint = 0) { + pointer allocate(size_type n, const void* /* hint */ = 0) { // If arena is not given, malloc needs to be called which doesn't // construct element object. if (arena_ == NULL) { @@ -197,6 +197,7 @@ class Map { #if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation) ::operator delete(p, n * sizeof(value_type)); #else + (void)n; ::operator delete(p); #endif } diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h index 423c98f127..7f7b1e0e1d 100644 --- a/src/google/protobuf/map_type_handler.h +++ b/src/google/protobuf/map_type_handler.h @@ -72,7 +72,7 @@ class MapValueInitializer { template class MapValueInitializer { public: - static inline void Initialize(Type& value, int default_enum_value) {} + static inline void Initialize(Type& /* value */, int /* default_enum_value */) {} }; template @@ -301,7 +301,7 @@ GOOGLE_PROTOBUF_BYTE_SIZE(ENUM , Enum) #define FIXED_BYTE_SIZE(FieldType, DeclaredType) \ template \ inline int MapTypeHandler::ByteSize( \ - const MapEntryAccessorType& value) { \ + const MapEntryAccessorType& /* value */) { \ return WireFormatLite::k##DeclaredType##Size; \ } @@ -348,7 +348,7 @@ GET_CACHED_SIZE(ENUM , Enum) template \ inline int \ MapTypeHandler::GetCachedSize( \ - const MapEntryAccessorType& value) { \ + const MapEntryAccessorType& /* value */) { \ return WireFormatLite::k##DeclaredType##Size; \ } @@ -479,20 +479,20 @@ size_t MapTypeHandler::SpaceUsedInMapLong( template inline void MapTypeHandler::Clear( - Type** value, Arena* arena) { + Type** value, Arena* /* arena */) { if (*value != NULL) (*value)->Clear(); } template inline void MapTypeHandler::ClearMaybeByDefaultEnum(Type** value, - Arena* arena, - int default_enum_value) { + Arena* /* arena */, + int /* default_enum_value */) { if (*value != NULL) (*value)->Clear(); } template inline void MapTypeHandler::Merge( - const Type& from, Type** to, Arena* arena) { + const Type& from, Type** to, Arena* /* arena */) { (*to)->MergeFrom(from); } @@ -511,14 +511,14 @@ inline void MapTypeHandler inline void MapTypeHandler::Initialize(Type** x, - Arena* arena) { + Arena* /* arena */) { *x = NULL; } template inline void MapTypeHandler:: - InitializeMaybeByDefaultEnum(Type** x, int default_enum_value, - Arena* arena) { + InitializeMaybeByDefaultEnum(Type** x, int /* default_enum_value */, + Arena* /* arena */) { *x = NULL; } @@ -583,7 +583,7 @@ inline bool MapTypeHandler \ inline void MapTypeHandler:: \ ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena* arena, \ - int default_enum) { \ + int /* default_enum */) { \ Clear(value, arena); \ } \ template \ @@ -598,18 +598,19 @@ inline bool MapTypeHandler \ inline void MapTypeHandler::AssignDefaultValue(TypeOnMemory* value) {} \ + Type>::AssignDefaultValue(TypeOnMemory* /* value */) {} \ template \ inline void \ MapTypeHandler::Initialize( \ - TypeOnMemory* value, Arena* arena) { \ + TypeOnMemory* value, Arena* /* arena */) { \ value->UnsafeSetDefault( \ &::google::protobuf::internal::GetEmptyStringAlreadyInited()); \ } \ template \ inline void MapTypeHandler:: \ InitializeMaybeByDefaultEnum(TypeOnMemory* value, \ - int default_enum_value, Arena* arena) { \ + int /* default_enum_value */, \ + Arena* arena) { \ Initialize(value, arena); \ } \ template \ @@ -626,12 +627,12 @@ inline bool MapTypeHandler::DefaultIfNotInitialized(const TypeOnMemory& value, \ const TypeOnMemory& \ - default_value) { \ + /* default_value */) { \ return value.Get(); \ } \ template \ inline bool MapTypeHandler::IsInitialized(const TypeOnMemory& value) { \ + Type>::IsInitialized(const TypeOnMemory& /* value */) { \ return true; \ } STRING_OR_BYTES_HANDLER_FUNCTIONS(STRING) @@ -649,54 +650,56 @@ STRING_OR_BYTES_HANDLER_FUNCTIONS(BYTES) template \ inline size_t \ MapTypeHandler::SpaceUsedInMapEntryLong(const TypeOnMemory& value) { \ + Type>::SpaceUsedInMapEntryLong(const TypeOnMemory& /* value */) { \ return 0; \ } \ template \ inline size_t \ MapTypeHandler::SpaceUsedInMapLong( \ - const TypeOnMemory& value) { \ + const TypeOnMemory& /* value */) { \ return sizeof(Type); \ } \ template \ inline void MapTypeHandler::Clear( \ - TypeOnMemory* value, Arena* arena) { \ + TypeOnMemory* value, Arena* /* arena */) { \ *value = 0; \ } \ template \ inline void MapTypeHandler:: \ - ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena* arena, \ + ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena* /* arena */, \ int default_enum_value) { \ *value = static_cast(default_enum_value); \ } \ template \ inline void MapTypeHandler::Merge( \ - const MapEntryAccessorType& from, TypeOnMemory* to, Arena* arena) { \ + const MapEntryAccessorType& from, TypeOnMemory* to, \ + Arena* /* arena */) { \ *to = from; \ } \ template \ inline void MapTypeHandler::DeleteNoArena(TypeOnMemory& x) {} \ + Type>::DeleteNoArena(TypeOnMemory& /* x */) {} \ template \ inline void MapTypeHandler::AssignDefaultValue(TypeOnMemory* value) {} \ + Type>::AssignDefaultValue(TypeOnMemory* /* value */) {} \ template \ inline void \ MapTypeHandler::Initialize( \ - TypeOnMemory* value, Arena* arena) { \ + TypeOnMemory* value, Arena* /* arena */) { \ *value = 0; \ } \ template \ inline void MapTypeHandler:: \ InitializeMaybeByDefaultEnum(TypeOnMemory* value, \ - int default_enum_value, Arena* arena) { \ + int default_enum_value, \ + Arena* /* arena */) { \ *value = static_cast(default_enum_value); \ } \ template \ inline typename MapTypeHandler::MapEntryAccessorType* \ MapTypeHandler::EnsureMutable( \ - TypeOnMemory* value, Arena* arena) { \ + TypeOnMemory* value, Arena* /* arena */) { \ return value; \ } \ template \ @@ -705,12 +708,12 @@ STRING_OR_BYTES_HANDLER_FUNCTIONS(BYTES) MapTypeHandler::DefaultIfNotInitialized(const TypeOnMemory& value, \ const TypeOnMemory& \ - default_value) { \ + /* default_value */) { \ return value; \ } \ template \ inline bool MapTypeHandler::IsInitialized(const TypeOnMemory& value) { \ + Type>::IsInitialized(const TypeOnMemory& /* value */) { \ return true; \ } PRIMITIVE_HANDLER_FUNCTIONS(INT64)