Explicitly mark unused parameters to resolve warnings
Reduce log spam during build.
Change-Id: Id0734c3a5bc08f728ca868a5a18375d8fc16bae6
diff --git a/Android.mk b/Android.mk
index b36cd35..9cd7ca9 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,7 +1,7 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libjson
-LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter
+LOCAL_CFLAGS := -Werror
LOCAL_HEADER_LIBRARIES += qti_kernel_headers
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
LOCAL_SRC_FILES := arraylist.c \
diff --git a/Makefile.am.inc b/Makefile.am.inc
index fec591b..dec1255 100644
--- a/Makefile.am.inc
+++ b/Makefile.am.inc
@@ -1,2 +1,2 @@
-AM_CFLAGS = -Wall -Werror -Wno-error=deprecated-declarations -Wextra -Wwrite-strings -Wno-unused-parameter -std=gnu99 -D_GNU_SOURCE -D_REENTRANT
+AM_CFLAGS = -Wall -Werror -Wno-error=deprecated-declarations -Wextra -Wwrite-strings -std=gnu99 -D_GNU_SOURCE -D_REENTRANT
diff --git a/json_object.c b/json_object.c
index 8ed0239..08af06f 100644
--- a/json_object.c
+++ b/json_object.c
@@ -456,8 +456,8 @@
static int json_object_boolean_to_json_string(struct json_object* jso,
struct printbuf *pb,
- int level,
- int flags)
+ int UNUSED(level),
+ int UNUSED(flags))
{
if (jso->o.c_boolean)
return sprintbuf(pb, "true");
@@ -499,8 +499,8 @@
static int json_object_int_to_json_string(struct json_object* jso,
struct printbuf *pb,
- int level,
- int flags)
+ int UNUSED(level),
+ int UNUSED(flags))
{
return sprintbuf(pb, "%"PRId64, jso->o.c_int64);
}
@@ -591,7 +591,7 @@
static int json_object_double_to_json_string(struct json_object* jso,
struct printbuf *pb,
- int level,
+ int UNUSED(level),
int flags)
{
char buf[128], *p, *q;
@@ -659,14 +659,14 @@
}
int json_object_userdata_to_json_string(struct json_object *jso,
- struct printbuf *pb, int level, int flags)
+ struct printbuf *pb, int UNUSED(level), int UNUSED(flags))
{
int userdata_len = strlen(jso->_userdata);
printbuf_memappend(pb, jso->_userdata, userdata_len);
return userdata_len;
}
-void json_object_free_userdata(struct json_object *jso, void *userdata)
+void json_object_free_userdata(struct json_object *UNUSED(jso), void *userdata)
{
free(userdata);
}
@@ -725,8 +725,8 @@
static int json_object_string_to_json_string(struct json_object* jso,
struct printbuf *pb,
- int level,
- int flags)
+ int UNUSED(level),
+ int UNUSED(flags))
{
sprintbuf(pb, "\"");
json_escape_str(pb, jso->o.c_string.str, jso->o.c_string.len);
diff --git a/json_object.h b/json_object.h
index 0dca0b1..a94e15a 100644
--- a/json_object.h
+++ b/json_object.h
@@ -21,6 +21,12 @@
#define THIS_FUNCTION_IS_DEPRECATED(func) func
#endif
+#ifdef __GNUC__
+# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
+#else
+# define UNUSED(x) UNUSED_ ## x
+#endif
+
#include "json_inttypes.h"
#ifdef __cplusplus
diff --git a/json_object_iterator.c b/json_object_iterator.c
index 7066649..b107683 100644
--- a/json_object_iterator.c
+++ b/json_object_iterator.c
@@ -84,7 +84,7 @@
* ****************************************************************************
*/
struct json_object_iterator
-json_object_iter_end(const struct json_object* obj)
+json_object_iter_end(const struct json_object* UNUSED(obj))
{
struct json_object_iterator iter;