Mark unused parameters and set -Wunused-parameter

This allows us to compile with -Wall -Werror in build
environments where -Wall also warns about unused parameters.
Also explicitly set -Wunused-parameter so unused parameters will
cause the build to fail in environments where -Wall does not warn
about them.

Change-Id: Icccf2121d2a9df77b1c224c4976cb9aec56496b3
diff --git a/Android.mk b/Android.mk
index a83cb5e..35bc498 100644
--- a/Android.mk
+++ b/Android.mk
@@ -3,7 +3,7 @@
 
 LOCAL_SRC_FILES:=clatd.c dump.c checksum.c translate.c icmp.c ipv4.c ipv6.c config.c dns64.c logging.c getaddr.c getroute.c netlink_callbacks.c netlink_msg.c setif.c setroute.c mtu.c
 
-LOCAL_CFLAGS := -Wall -Werror
+LOCAL_CFLAGS := -Wall -Werror -Wunused-parameter
 LOCAL_C_INCLUDES := external/libnl/include
 LOCAL_STATIC_LIBRARIES := libnl
 LOCAL_SHARED_LIBRARIES := libcutils liblog
@@ -29,7 +29,7 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := clatd_test
-LOCAL_CFLAGS := -Wall -Werror
+LOCAL_CFLAGS := -Wall -Werror -Wunused-parameter
 LOCAL_SRC_FILES := clatd_test.cpp dump.c checksum.c translate.c icmp.c ipv4.c ipv6.c logging.c
 LOCAL_MODULE_TAGS := eng tests
 LOCAL_SHARED_LIBRARIES := liblog
diff --git a/getaddr.c b/getaddr.c
index fb761f0..5cae78b 100644
--- a/getaddr.c
+++ b/getaddr.c
@@ -85,7 +85,9 @@
  * err  - netlink message
  * arg  - (struct target) info for which address we're looking for
  */
-static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err, void *arg) {
+static int error_handler(__attribute__((unused)) struct sockaddr_nl *nla,
+                         __attribute__((unused)) struct nlmsgerr *err,
+                         __attribute__((unused)) void *arg) {
   return NL_OK;
 }
 
diff --git a/getroute.c b/getroute.c
index 5f9475e..a615a4f 100644
--- a/getroute.c
+++ b/getroute.c
@@ -90,7 +90,8 @@
  * err  - netlink message
  * arg  - (int *) storage for the error number
  */
-static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err, void *arg) {
+static int error_handler(__attribute__((unused)) struct sockaddr_nl *nla,
+                         struct nlmsgerr *err, void *arg) {
   int *retval = arg;
   if(err->error < 0) { // error_handler called even on no error (NLMSG_ERROR reply type used)
     *retval = err->error;
diff --git a/logging.c b/logging.c
index f2f3d50..c90b1cf 100644
--- a/logging.c
+++ b/logging.c
@@ -42,12 +42,14 @@
  * fmt  - printf format specifier
  * ...  - printf format arguments
  */
-void logmsg_dbg(int prio, const char *fmt, ...) {
 #if CLAT_DEBUG
+void logmsg_dbg(int prio, const char *fmt, ...) {
   va_list ap;
 
   va_start(ap, fmt);
   __android_log_vprint(prio, "clatd", fmt, ap);
   va_end(ap);
-#endif
 }
+#else
+void logmsg_dbg(__attribute__((unused)) int prio, __attribute__((unused)) const char *fmt, ...) {}
+#endif
diff --git a/netlink_callbacks.c b/netlink_callbacks.c
index 5e0f34e..a79aa76 100644
--- a/netlink_callbacks.c
+++ b/netlink_callbacks.c
@@ -27,7 +27,7 @@
  * msg  - netlink message
  * data - pointer to an int, stores the success code
  */
-static int ack_handler(struct nl_msg *msg, void *data) {
+static int ack_handler(__attribute__((unused)) struct nl_msg *msg, void *data) {
   int *retval = data;
   *retval = 0;
   return NL_OK;
@@ -39,7 +39,8 @@
  * err  - netlink error message
  * arg  - pointer to an int, stores the error code
  */
-static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err, void *arg) {
+static int error_handler(__attribute__((unused)) struct sockaddr_nl *nla,
+                         struct nlmsgerr *err, void *arg) {
   int *retval = arg;
   if(err->error < 0) {
     *retval = err->error;