From 544612afc94895b70510964f6c9510219e29d583 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Tue, 1 Mar 2016 15:40:17 +0000 Subject: [PATCH] Shush "unused parameter" warnings in hprof-conv. Change-Id: I6bc13ac430609db5c7463180c63fd7e58de3983d --- tools/hprof-conv/HprofConv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/hprof-conv/HprofConv.c b/tools/hprof-conv/HprofConv.c index d37c12cb4b..a69440c601 100644 --- a/tools/hprof-conv/HprofConv.c +++ b/tools/hprof-conv/HprofConv.c @@ -39,6 +39,11 @@ # define TRUE (!FALSE) #endif +// An attribute to place on a parameter to a function, for example: +// int foo(int x ATTRIBUTE_UNUSED) { return 10; } +// to avoid compiler warnings. +#define ATTRIBUTE_UNUSED __attribute__((__unused__)) + typedef enum HprofBasicType { HPROF_BASIC_OBJECT = 2, HPROF_BASIC_BOOLEAN = 4, @@ -401,7 +406,7 @@ static int computeClassDumpLen(const unsigned char* origBuf, int len) /* * Compute the length of a HPROF_INSTANCE_DUMP block. */ -static int computeInstanceDumpLen(const unsigned char* origBuf, int len) +static int computeInstanceDumpLen(const unsigned char* origBuf, int len ATTRIBUTE_UNUSED) { int extraCount = get4BE(origBuf + kIdentSize * 2 + 4); return kIdentSize * 2 + 8 + extraCount; @@ -410,7 +415,7 @@ static int computeInstanceDumpLen(const unsigned char* origBuf, int len) /* * Compute the length of a HPROF_OBJECT_ARRAY_DUMP block. */ -static int computeObjectArrayDumpLen(const unsigned char* origBuf, int len) +static int computeObjectArrayDumpLen(const unsigned char* origBuf, int len ATTRIBUTE_UNUSED) { int arrayCount = get4BE(origBuf + kIdentSize + 4); return kIdentSize * 2 + 8 + arrayCount * kIdentSize; @@ -419,7 +424,7 @@ static int computeObjectArrayDumpLen(const unsigned char* origBuf, int len) /* * Compute the length of a HPROF_PRIMITIVE_ARRAY_DUMP block. */ -static int computePrimitiveArrayDumpLen(const unsigned char* origBuf, int len) +static int computePrimitiveArrayDumpLen(const unsigned char* origBuf, int len ATTRIBUTE_UNUSED) { int arrayCount = get4BE(origBuf + kIdentSize + 4); HprofBasicType basicType = origBuf[kIdentSize + 8];