diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2014-03-10 16:33:22 +0900 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2014-03-10 16:40:30 +0900 |
commit | 56ec161d47856212008f47676577882f30853312 (patch) | |
tree | a0d067456309956aa7bdfb4a66dd0e36ae7e55de | |
parent | d6c9bc21e673110aec61157419964b2e57c16078 (diff) | |
download | android_external_android-clat-56ec161d47856212008f47676577882f30853312.tar.gz android_external_android-clat-56ec161d47856212008f47676577882f30853312.tar.bz2 android_external_android-clat-56ec161d47856212008f47676577882f30853312.zip |
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
-rw-r--r-- | Android.mk | 4 | ||||
-rw-r--r-- | getaddr.c | 4 | ||||
-rw-r--r-- | getroute.c | 3 | ||||
-rw-r--r-- | logging.c | 6 | ||||
-rw-r--r-- | netlink_callbacks.c | 5 |
5 files changed, 14 insertions, 8 deletions
@@ -3,7 +3,7 @@ include $(CLEAR_VARS) 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 $(BUILD_PREBUILT) 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 @@ -85,7 +85,9 @@ static int getaddr_cb(struct nl_msg *msg, void *data) { * 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; } @@ -90,7 +90,8 @@ static int get_default_route_cb(struct nl_msg *msg, void *data) { * 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; @@ -42,12 +42,14 @@ void logmsg(int prio, const char *fmt, ...) { * 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 @@ static int ack_handler(struct nl_msg *msg, void *data) { * 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; |