Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
36ac06fd
Commit
36ac06fd
authored
Aug 21, 2017
by
Jisi Liu
Committed by
drivehappy
Aug 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge pull request #3535 from drivehappy/clang_warn_cleanup
Fixing unused parameter warnings under Clang.
parent
92d768c1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
29 deletions
+33
-29
map.h
src/google/protobuf/map.h
+2
-1
map_type_handler.h
src/google/protobuf/map_type_handler.h
+31
-28
No files found.
src/google/protobuf/map.h
View file @
36ac06fd
...
@@ -181,7 +181,7 @@ class Map {
...
@@ -181,7 +181,7 @@ class Map {
MapAllocator
(
const
MapAllocator
<
X
>&
allocator
)
MapAllocator
(
const
MapAllocator
<
X
>&
allocator
)
:
arena_
(
allocator
.
arena
())
{}
:
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
// If arena is not given, malloc needs to be called which doesn't
// construct element object.
// construct element object.
if
(
arena_
==
NULL
)
{
if
(
arena_
==
NULL
)
{
...
@@ -197,6 +197,7 @@ class Map {
...
@@ -197,6 +197,7 @@ class Map {
#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
::
operator
delete
(
p
,
n
*
sizeof
(
value_type
));
::
operator
delete
(
p
,
n
*
sizeof
(
value_type
));
#else
#else
(
void
)
n
;
::
operator
delete
(
p
);
::
operator
delete
(
p
);
#endif
#endif
}
}
...
...
src/google/protobuf/map_type_handler.h
View file @
36ac06fd
...
@@ -72,7 +72,7 @@ class MapValueInitializer<true, Type> {
...
@@ -72,7 +72,7 @@ class MapValueInitializer<true, Type> {
template
<
typename
Type
>
template
<
typename
Type
>
class
MapValueInitializer
<
false
,
Type
>
{
class
MapValueInitializer
<
false
,
Type
>
{
public
:
public
:
static
inline
void
Initialize
(
Type
&
value
,
int
default_enum_value
)
{}
static
inline
void
Initialize
(
Type
&
/* value */
,
int
/* default_enum_value */
)
{}
};
};
template
<
typename
Type
,
bool
is_arena_constructable
>
template
<
typename
Type
,
bool
is_arena_constructable
>
...
@@ -301,7 +301,7 @@ GOOGLE_PROTOBUF_BYTE_SIZE(ENUM , Enum)
...
@@ -301,7 +301,7 @@ GOOGLE_PROTOBUF_BYTE_SIZE(ENUM , Enum)
#define FIXED_BYTE_SIZE(FieldType, DeclaredType) \
#define FIXED_BYTE_SIZE(FieldType, DeclaredType) \
template <typename Type> \
template <typename Type> \
inline int MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::ByteSize( \
inline int MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::ByteSize( \
const MapEntryAccessorType&
value) {
\
const MapEntryAccessorType&
/* value */
) {
\
return WireFormatLite::k##DeclaredType##Size; \
return WireFormatLite::k##DeclaredType##Size; \
}
}
...
@@ -348,7 +348,7 @@ GET_CACHED_SIZE(ENUM , Enum)
...
@@ -348,7 +348,7 @@ GET_CACHED_SIZE(ENUM , Enum)
template <typename Type> \
template <typename Type> \
inline int \
inline int \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::GetCachedSize( \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::GetCachedSize( \
const MapEntryAccessorType&
value) {
\
const MapEntryAccessorType&
/* value */
) {
\
return WireFormatLite::k##DeclaredType##Size; \
return WireFormatLite::k##DeclaredType##Size; \
}
}
...
@@ -479,20 +479,20 @@ size_t MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::SpaceUsedInMapLong(
...
@@ -479,20 +479,20 @@ size_t MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::SpaceUsedInMapLong(
template
<
typename
Type
>
template
<
typename
Type
>
inline
void
MapTypeHandler
<
WireFormatLite
::
TYPE_MESSAGE
,
Type
>::
Clear
(
inline
void
MapTypeHandler
<
WireFormatLite
::
TYPE_MESSAGE
,
Type
>::
Clear
(
Type
**
value
,
Arena
*
arena
)
{
Type
**
value
,
Arena
*
/* arena */
)
{
if
(
*
value
!=
NULL
)
(
*
value
)
->
Clear
();
if
(
*
value
!=
NULL
)
(
*
value
)
->
Clear
();
}
}
template
<
typename
Type
>
template
<
typename
Type
>
inline
void
inline
void
MapTypeHandler
<
WireFormatLite
::
TYPE_MESSAGE
,
MapTypeHandler
<
WireFormatLite
::
TYPE_MESSAGE
,
Type
>::
ClearMaybeByDefaultEnum
(
Type
**
value
,
Type
>::
ClearMaybeByDefaultEnum
(
Type
**
value
,
Arena
*
arena
,
Arena
*
/* arena */
,
int
default_enum_value
)
{
int
/* default_enum_value */
)
{
if
(
*
value
!=
NULL
)
(
*
value
)
->
Clear
();
if
(
*
value
!=
NULL
)
(
*
value
)
->
Clear
();
}
}
template
<
typename
Type
>
template
<
typename
Type
>
inline
void
MapTypeHandler
<
WireFormatLite
::
TYPE_MESSAGE
,
Type
>::
Merge
(
inline
void
MapTypeHandler
<
WireFormatLite
::
TYPE_MESSAGE
,
Type
>::
Merge
(
const
Type
&
from
,
Type
**
to
,
Arena
*
arena
)
{
const
Type
&
from
,
Type
**
to
,
Arena
*
/* arena */
)
{
(
*
to
)
->
MergeFrom
(
from
);
(
*
to
)
->
MergeFrom
(
from
);
}
}
...
@@ -511,14 +511,14 @@ inline void MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
...
@@ -511,14 +511,14 @@ inline void MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
template
<
typename
Type
>
template
<
typename
Type
>
inline
void
MapTypeHandler
<
WireFormatLite
::
TYPE_MESSAGE
,
inline
void
MapTypeHandler
<
WireFormatLite
::
TYPE_MESSAGE
,
Type
>::
Initialize
(
Type
**
x
,
Type
>::
Initialize
(
Type
**
x
,
Arena
*
arena
)
{
Arena
*
/* arena */
)
{
*
x
=
NULL
;
*
x
=
NULL
;
}
}
template
<
typename
Type
>
template
<
typename
Type
>
inline
void
MapTypeHandler
<
WireFormatLite
::
TYPE_MESSAGE
,
Type
>::
inline
void
MapTypeHandler
<
WireFormatLite
::
TYPE_MESSAGE
,
Type
>::
InitializeMaybeByDefaultEnum
(
Type
**
x
,
int
default_enum_value
,
InitializeMaybeByDefaultEnum
(
Type
**
x
,
int
/* default_enum_value */
,
Arena
*
arena
)
{
Arena
*
/* arena */
)
{
*
x
=
NULL
;
*
x
=
NULL
;
}
}
...
@@ -583,7 +583,7 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
...
@@ -583,7 +583,7 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
template <typename Type> \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \
ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena* arena, \
ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena* arena, \
int
default_enum) {
\
int
/* default_enum */
) {
\
Clear(value, arena); \
Clear(value, arena); \
} \
} \
template <typename Type> \
template <typename Type> \
...
@@ -598,18 +598,19 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
...
@@ -598,18 +598,19 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
} \
} \
template <typename Type> \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
Type>::AssignDefaultValue(TypeOnMemory*
value
) {} \
Type>::AssignDefaultValue(TypeOnMemory*
/* value */
) {} \
template <typename Type> \
template <typename Type> \
inline void \
inline void \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Initialize( \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Initialize( \
TypeOnMemory* value, Arena*
arena) {
\
TypeOnMemory* value, Arena*
/* arena */
) {
\
value->UnsafeSetDefault( \
value->UnsafeSetDefault( \
&::google::protobuf::internal::GetEmptyStringAlreadyInited()); \
&::google::protobuf::internal::GetEmptyStringAlreadyInited()); \
} \
} \
template <typename Type> \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \
InitializeMaybeByDefaultEnum(TypeOnMemory* value, \
InitializeMaybeByDefaultEnum(TypeOnMemory* value, \
int default_enum_value, Arena* arena) { \
int
/* default_enum_value */
, \
Arena* arena) { \
Initialize(value, arena); \
Initialize(value, arena); \
} \
} \
template <typename Type> \
template <typename Type> \
...
@@ -626,12 +627,12 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
...
@@ -626,12 +627,12 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE,
MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
Type>::DefaultIfNotInitialized(const TypeOnMemory& value, \
Type>::DefaultIfNotInitialized(const TypeOnMemory& value, \
const TypeOnMemory& \
const TypeOnMemory& \
default_value) {
\
/* default_value */
) {
\
return value.Get(); \
return value.Get(); \
} \
} \
template <typename Type> \
template <typename Type> \
inline bool MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
inline bool MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
Type>::IsInitialized(const TypeOnMemory&
value
) { \
Type>::IsInitialized(const TypeOnMemory&
/* value */
) { \
return true; \
return true; \
}
}
STRING_OR_BYTES_HANDLER_FUNCTIONS
(
STRING
)
STRING_OR_BYTES_HANDLER_FUNCTIONS
(
STRING
)
...
@@ -649,54 +650,56 @@ STRING_OR_BYTES_HANDLER_FUNCTIONS(BYTES)
...
@@ -649,54 +650,56 @@ STRING_OR_BYTES_HANDLER_FUNCTIONS(BYTES)
template <typename Type> \
template <typename Type> \
inline size_t \
inline size_t \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
Type>::SpaceUsedInMapEntryLong(const TypeOnMemory&
value
) { \
Type>::SpaceUsedInMapEntryLong(const TypeOnMemory&
/* value */
) { \
return 0; \
return 0; \
} \
} \
template <typename Type> \
template <typename Type> \
inline size_t \
inline size_t \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::SpaceUsedInMapLong( \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::SpaceUsedInMapLong( \
const TypeOnMemory&
value) {
\
const TypeOnMemory&
/* value */
) {
\
return sizeof(Type); \
return sizeof(Type); \
} \
} \
template <typename Type> \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Clear( \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Clear( \
TypeOnMemory* value, Arena*
arena) {
\
TypeOnMemory* value, Arena*
/* arena */
) {
\
*value = 0; \
*value = 0; \
} \
} \
template <typename Type> \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \
ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena*
arena,
\
ClearMaybeByDefaultEnum(TypeOnMemory* value, Arena*
/* arena */
,
\
int default_enum_value) { \
int default_enum_value) { \
*value = static_cast<TypeOnMemory>(default_enum_value); \
*value = static_cast<TypeOnMemory>(default_enum_value); \
} \
} \
template <typename Type> \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Merge( \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Merge( \
const MapEntryAccessorType& from, TypeOnMemory* to, Arena* arena) { \
const MapEntryAccessorType& from, TypeOnMemory* to, \
Arena*
/* arena */
) { \
*to = from; \
*to = from; \
} \
} \
template <typename Type> \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
Type>::DeleteNoArena(TypeOnMemory&
x) {}
\
Type>::DeleteNoArena(TypeOnMemory&
/* x */
) {}
\
template <typename Type> \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
Type>::AssignDefaultValue(TypeOnMemory*
value
) {} \
Type>::AssignDefaultValue(TypeOnMemory*
/* value */
) {} \
template <typename Type> \
template <typename Type> \
inline void \
inline void \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Initialize( \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Initialize( \
TypeOnMemory* value, Arena*
arena) {
\
TypeOnMemory* value, Arena*
/* arena */
) {
\
*value = 0; \
*value = 0; \
} \
} \
template <typename Type> \
template <typename Type> \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \
inline void MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>:: \
InitializeMaybeByDefaultEnum(TypeOnMemory* value, \
InitializeMaybeByDefaultEnum(TypeOnMemory* value, \
int default_enum_value, Arena* arena) { \
int default_enum_value, \
Arena*
/* arena */
) { \
*value = static_cast<TypeOnMemory>(default_enum_value); \
*value = static_cast<TypeOnMemory>(default_enum_value); \
} \
} \
template <typename Type> \
template <typename Type> \
inline typename MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
inline typename MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
Type>::MapEntryAccessorType* \
Type>::MapEntryAccessorType* \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::EnsureMutable( \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::EnsureMutable( \
TypeOnMemory* value, Arena*
arena) {
\
TypeOnMemory* value, Arena*
/* arena */
) {
\
return value; \
return value; \
} \
} \
template <typename Type> \
template <typename Type> \
...
@@ -705,12 +708,12 @@ STRING_OR_BYTES_HANDLER_FUNCTIONS(BYTES)
...
@@ -705,12 +708,12 @@ STRING_OR_BYTES_HANDLER_FUNCTIONS(BYTES)
MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
Type>::DefaultIfNotInitialized(const TypeOnMemory& value, \
Type>::DefaultIfNotInitialized(const TypeOnMemory& value, \
const TypeOnMemory& \
const TypeOnMemory& \
default_value) {
\
/* default_value */
) {
\
return value; \
return value; \
} \
} \
template <typename Type> \
template <typename Type> \
inline bool MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
inline bool MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
Type>::IsInitialized(const TypeOnMemory&
value
) { \
Type>::IsInitialized(const TypeOnMemory&
/* value */
) { \
return true; \
return true; \
}
}
PRIMITIVE_HANDLER_FUNCTIONS
(
INT64
)
PRIMITIVE_HANDLER_FUNCTIONS
(
INT64
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment