From 30822f0d68cbba7a234e0ae8f7345f2af2d4cbb4 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sun, 2 Jul 2017 21:59:23 +0200 Subject: [PATCH] Remove UNUSED() macro and disable the compiler warning instead Signed-off-by: Joachim Nilsson --- plugins/Makefile.am | 2 +- plugins/alsa-utils.c | 4 ++-- plugins/bootmisc.c | 4 ++-- plugins/chargen.c | 2 +- plugins/daytime.c | 2 +- plugins/dbus.c | 2 +- plugins/discard.c | 2 +- plugins/echo.c | 2 +- plugins/hwclock.c | 4 ++-- plugins/initctl.c | 4 ++-- plugins/netlink.c | 2 +- plugins/pidfile.c | 2 +- plugins/procps.c | 2 +- plugins/resolvconf.c | 2 +- plugins/time.c | 2 +- plugins/tty.c | 2 +- plugins/urandom.c | 4 ++-- plugins/x11-common.c | 2 +- src/Makefile.am | 6 ++++-- src/api.c | 2 +- src/cond-w.c | 2 +- src/getty.c | 2 +- src/inetd.c | 2 +- src/initctl.c | 19 ++++++++----------- src/plugin.c | 4 ++-- src/service.c | 2 +- src/sig.c | 18 +++++++++--------- 27 files changed, 51 insertions(+), 52 deletions(-) diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 93db7ea4..6e1a0911 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -1,5 +1,5 @@ AM_LDFLAGS = -module -avoid-version -shared -AM_CFLAGS = -W -Wall -Wextra -std=gnu99 +AM_CFLAGS = -W -Wall -Wextra -Wno-unused-parameter -std=gnu99 AM_CPPFLAGS = -I$(top_srcdir)/src -U_FORTIFY_SOURCE AM_CPPFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE AM_CPPFLAGS += $(lite_CFLAGS) diff --git a/plugins/alsa-utils.c b/plugins/alsa-utils.c index 2f1d4c0e..52593aa8 100644 --- a/plugins/alsa-utils.c +++ b/plugins/alsa-utils.c @@ -28,7 +28,7 @@ #define ALSACTL "/usr/sbin/alsactl" -static void save(void *UNUSED(arg)) +static void save(void *arg) { if (fexist(ALSACTL)) { _d("Saving sound settings ..."); @@ -36,7 +36,7 @@ static void save(void *UNUSED(arg)) } } -static void restore(void *UNUSED(arg)) +static void restore(void *arg) { if (fexist(ALSACTL)) { _d("Restoring sound settings ..."); diff --git a/plugins/bootmisc.c b/plugins/bootmisc.c index c8d29ea2..e863f19f 100644 --- a/plugins/bootmisc.c +++ b/plugins/bootmisc.c @@ -64,7 +64,7 @@ static int is_tmpfs(char *path) return tmpfs; } -static int do_clean(const char *fpath, const struct stat *UNUSED(sb), int UNUSED(tflag), struct FTW *ftw) +static int do_clean(const char *fpath, const struct stat *sb, int tflag, struct FTW *ftw) { if (ftw->level == 0) return 1; @@ -96,7 +96,7 @@ static void bootclean(void) /* * Setup standard FHS 2.3 structure in /var, and write runlevel to UTMP */ -static void setup(void *UNUSED(arg)) +static void setup(void *arg) { int gid; diff --git a/plugins/chargen.c b/plugins/chargen.c index f99594bb..11b15205 100644 --- a/plugins/chargen.c +++ b/plugins/chargen.c @@ -82,7 +82,7 @@ static int send_peer(int sd, char *buf, ssize_t len, struct sockaddr *sa, sockle return sendto(sd, pattern, strlen(pattern), MSG_DONTWAIT, sa, sa_len); } -static int cb(int UNUSED(type)) +static int cb(int type) { int sd = STDIN_FILENO; char buf[BUFSIZ]; diff --git a/plugins/daytime.c b/plugins/daytime.c index b0a3a1de..a0217d56 100644 --- a/plugins/daytime.c +++ b/plugins/daytime.c @@ -64,7 +64,7 @@ static int send_peer(int sd, char *buf, ssize_t len, struct sockaddr *sa, sockle return sendto(sd, now, strlen(now), MSG_DONTWAIT, sa, sa_len); } -static int cb(int UNUSED(type)) +static int cb(int type) { int sd = STDIN_FILENO; char buf[BUFSIZ]; diff --git a/plugins/dbus.c b/plugins/dbus.c index 2bf6b320..efaae48e 100644 --- a/plugins/dbus.c +++ b/plugins/dbus.c @@ -29,7 +29,7 @@ #include "helpers.h" #include "plugin.h" -static void setup(void *UNUSED(arg)) +static void setup(void *arg) { umask(0); diff --git a/plugins/discard.c b/plugins/discard.c index 04b8f9d1..94d43167 100644 --- a/plugins/discard.c +++ b/plugins/discard.c @@ -27,7 +27,7 @@ #include "plugin.h" -static int cb(int UNUSED(type)) +static int cb(int type) { int sd = STDIN_FILENO; char buf[BUFSIZ]; diff --git a/plugins/echo.c b/plugins/echo.c index 5019a0ad..e4cade56 100644 --- a/plugins/echo.c +++ b/plugins/echo.c @@ -41,7 +41,7 @@ static int recv_peer(int sd, char *buf, ssize_t len, struct sockaddr *sa, sockle return len; } -static int cb(int UNUSED(type)) +static int cb(int type) { int sd = STDIN_FILENO; char buf[BUFSIZ]; diff --git a/plugins/hwclock.c b/plugins/hwclock.c index 6cda556f..c9ea1452 100644 --- a/plugins/hwclock.c +++ b/plugins/hwclock.c @@ -27,14 +27,14 @@ #include "helpers.h" #include "plugin.h" -static void save(void *UNUSED(arg)) +static void save(void *arg) { _d("Saving system clock to RTC ..."); /* -w,--systohc, -u,--utc */ run_interactive("/sbin/hwclock -w -u", "Saving system time (UTC) to RTC"); } -static void restore(void *UNUSED(arg)) +static void restore(void *arg) { _d("Restoring system clock from RTC ..."); /* -s,--hctosys, -u,--utc */ diff --git a/plugins/initctl.c b/plugins/initctl.c index a25fc159..7d5893fa 100644 --- a/plugins/initctl.c +++ b/plugins/initctl.c @@ -98,7 +98,7 @@ static void set_env(char *data) * For SysV compatibility the default is to halt the system when issuing * `init 0`, unless INIT_HALT=POWERDOWN, as performed by the SysV utils. */ -static void parse(void *UNUSED(arg), int fd, int UNUSED(events)) +static void parse(void *arg, int fd, int events) { int lvl; struct init_request rq; @@ -167,7 +167,7 @@ static void parse(void *UNUSED(arg), int fd, int UNUSED(events)) } /* Must run after the base FS is up, needs /run, or /var/run */ -static void setup(void *UNUSED(arg)) +static void setup(void *arg) { _d("Setting up %s", FINIT_FIFO); makefifo(FINIT_FIFO, 0600); diff --git a/plugins/netlink.c b/plugins/netlink.c index 18466335..7315f8cf 100644 --- a/plugins/netlink.c +++ b/plugins/netlink.c @@ -163,7 +163,7 @@ static void nl_link(struct nlmsghdr *nlmsg) } } -static void nl_callback(void *UNUSED(arg), int sd, int UNUSED(events)) +static void nl_callback(void *arg, int sd, int events) { ssize_t len; static char buf[4096]; diff --git a/plugins/pidfile.c b/plugins/pidfile.c index 2c880ba1..073f47c5 100644 --- a/plugins/pidfile.c +++ b/plugins/pidfile.c @@ -43,7 +43,7 @@ static char *mkcond(char *buf, size_t len, char *nm) return buf; } -static void pidfile_callback(void *UNUSED(arg), int fd, int UNUSED(events)) +static void pidfile_callback(void *arg, int fd, int events) { static char ev_buf[8 *(sizeof(struct inotify_event) + NAME_MAX + 1) + 1]; static char cond[MAX_ARG_LEN]; diff --git a/plugins/procps.c b/plugins/procps.c index 1cb5fe4e..a0b7d875 100644 --- a/plugins/procps.c +++ b/plugins/procps.c @@ -25,7 +25,7 @@ #include #include "plugin.h" -static void setup(void *UNUSED(arg)) +static void setup(void *arg) { size_t i; glob_t gl; diff --git a/plugins/resolvconf.c b/plugins/resolvconf.c index 86cd263d..c1826d46 100644 --- a/plugins/resolvconf.c +++ b/plugins/resolvconf.c @@ -31,7 +31,7 @@ * No need to clean up files in /etc/resolvconf/run/interface/ * this is already taken care of by bootclean */ -static void setup(void *UNUSED(arg)) +static void setup(void *arg) { _d("Setting up the resolver ..."); mkpath("/etc/resolvconf", 0755); diff --git a/plugins/time.c b/plugins/time.c index 6c088bee..41b6e33e 100644 --- a/plugins/time.c +++ b/plugins/time.c @@ -78,7 +78,7 @@ static int send_peer(int sd, char *buf, ssize_t len, struct sockaddr *sa, sockle return sendto(sd, now, len, MSG_DONTWAIT, sa, sa_len); } -static int cb(int UNUSED(type)) +static int cb(int type) { int sd = STDIN_FILENO; char buf[BUFSIZ]; diff --git a/plugins/tty.c b/plugins/tty.c index 18c61c65..3a21ed26 100644 --- a/plugins/tty.c +++ b/plugins/tty.c @@ -53,7 +53,7 @@ static void setup(void) _pe("Failed starting TTY watcher"); } -static void watcher(void *UNUSED(arg), int fd, int UNUSED(events)) +static void watcher(void *arg, int fd, int events) { int len = 0; char buf[EVENT_SIZE], name[42]; diff --git a/plugins/urandom.c b/plugins/urandom.c index bd54f9a0..be360ae2 100644 --- a/plugins/urandom.c +++ b/plugins/urandom.c @@ -32,7 +32,7 @@ #include "helpers.h" #include "plugin.h" -static void setup(void *UNUSED(arg)) +static void setup(void *arg) { #ifdef RANDOMSEED if (!fexist(RANDOMSEED)) { @@ -65,7 +65,7 @@ static void setup(void *UNUSED(arg)) #endif } -static void save(void *UNUSED(arg)) +static void save(void *arg) { #ifdef RANDOMSEED umask(077); diff --git a/plugins/x11-common.c b/plugins/x11-common.c index def411ce..63d1a78e 100644 --- a/plugins/x11-common.c +++ b/plugins/x11-common.c @@ -30,7 +30,7 @@ #include "helpers.h" #include "plugin.h" -static void setup(void *UNUSED(arg)) +static void setup(void *arg) { #ifdef PAM_CONSOLE int fd; diff --git a/src/Makefile.am b/src/Makefile.am index fcf7e376..1874ed06 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,7 +34,8 @@ if WATCHDOGD finit_SOURCES += watchdog.c watchdog.h endif -finit_CFLAGS = -W -Wall -Wextra -std=gnu99 $(lite_CFLAGS) $(uev_CFLAGS) +finit_CFLAGS = -W -Wall -Wextra -Wno-unused-parameter -std=gnu99 +finit_CFLAGS += $(lite_CFLAGS) $(uev_CFLAGS) finit_LDADD = $(lite_LIBS) $(uev_LIBS) if STATIC finit_LDADD += plugins/libplug.la @@ -44,7 +45,8 @@ endif initctl_SOURCES = initctl.c serv.c serv.h svc.c svc.h \ cond.c cond.h util.c util.h -initctl_CFLAGS = -W -Wall -Wextra -Wno-unused-parameter $(lite_CFLAGS) +initctl_CFLAGS = -W -Wall -Wextra -Wno-unused-parameter +initctl_CFLAGS += $(lite_CFLAGS) initctl_LDADD = $(lite_LIBS) reboot_SOURCES = reboot.c util.c util.h diff --git a/src/api.c b/src/api.c index e7858563..2dda5b2f 100644 --- a/src/api.c +++ b/src/api.c @@ -168,7 +168,7 @@ static int do_handle_emit(char *buf, size_t len) * `initctl runlevel 0` is issued we default to POWERDOWN the system * instead of just halting. */ -static void cb(uev_t *w, void *UNUSED(arg), int UNUSED(events)) +static void cb(uev_t *w, void *arg, int events) { int sd, lvl; struct init_request rq; diff --git a/src/cond-w.c b/src/cond-w.c index cb5db443..c6199061 100644 --- a/src/cond-w.c +++ b/src/cond-w.c @@ -126,7 +126,7 @@ void cond_reload(void) } -static int reassert(const char *fpath, const struct stat *UNUSED(sb), int tflg, struct FTW *ftw) +static int reassert(const char *fpath, const struct stat *sb, int tflg, struct FTW *ftw) { char *nm; diff --git a/src/getty.c b/src/getty.c index 67c3c228..6cf9c8d4 100644 --- a/src/getty.c +++ b/src/getty.c @@ -290,7 +290,7 @@ static speed_t do_parse_speed(char *baud) return B0; } -int getty(char *tty, char *baud, char *UNUSED(term), char *user) +int getty(char *tty, char *baud, char *term, char *user) { int fd; char name[30]; diff --git a/src/inetd.c b/src/inetd.c index b47f3b73..e1dc1b53 100644 --- a/src/inetd.c +++ b/src/inetd.c @@ -137,7 +137,7 @@ static int get_stdin(svc_t *svc) } /* Socket callback, looks up correct svc and starts it as an inetd service */ -static void socket_cb(uev_t *UNUSED(w), void *arg, int UNUSED(events)) +static void socket_cb(uev_t *w, void *arg, int events) { svc_t *svc = (svc_t *)arg, *task; int stdin; diff --git a/src/initctl.c b/src/initctl.c index fe8abb7a..fa607f44 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -121,7 +121,7 @@ exit: return result; } -static int toggle_debug(char *UNUSED(arg)) +static int toggle_debug(char *arg) { struct init_request rq = { .magic = INIT_MAGIC, @@ -271,10 +271,7 @@ static int do_cond_magic(char op, char *cond) static int do_cond_set (char *cond) { return do_cond_magic('+', cond); } static int do_cond_clear(char *cond) { return do_cond_magic('-', cond); } - -static int -dump_one_cond(const char *fpath, const struct stat *UNUSED(sb), - int tflag, struct FTW *UNUSED(ftwbuf)) +static int dump_one_cond(const char *fpath, const struct stat *sb, int tflag, struct FTW *ftwbuf) { int len; @@ -290,7 +287,7 @@ dump_one_cond(const char *fpath, const struct stat *UNUSED(sb), return 0; } -static int do_cond_dump(char *UNUSED(arg)) +static int do_cond_dump(char *arg) { printf("Condition Status)\n"); printf("===============================================================================\n"); @@ -303,7 +300,7 @@ static int do_cond_dump(char *UNUSED(arg)) return 0; } -static int do_cond_show(char *UNUSED(arg)) +static int do_cond_show(char *arg) { svc_t *svc; enum cond_state cond; @@ -364,9 +361,9 @@ static int do_signal(int signo, const char *msg) return 0; } -static int do_halt (char *UNUSED(arg)) { return do_signal(SIGUSR1, "halt"); } -static int do_poweroff(char *UNUSED(arg)) { return do_signal(SIGUSR2, "power off"); } -static int do_reboot (char *UNUSED(arg)) { return do_signal(SIGTERM, "reboot"); } +static int do_halt (char *arg) { return do_signal(SIGUSR1, "halt"); } +static int do_poweroff(char *arg) { return do_signal(SIGUSR2, "power off"); } +static int do_reboot (char *arg) { return do_signal(SIGTERM, "reboot"); } int utmp_show(char *file) { @@ -417,7 +414,7 @@ static int do_utmp(char *file) utmp_show(_PATH_UTMP); } -static int show_version(char *UNUSED(arg)) +static int show_version(char *arg) { puts("v" PACKAGE_VERSION); return 0; diff --git a/src/plugin.c b/src/plugin.c index 79e3cb84..6280c565 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -215,7 +215,7 @@ int plugin_io_init(plugin_t *p) } /* Setup any I/O callbacks for plugins that use them */ -static int init_plugins(uev_ctx_t *UNUSED(ctx)) +static int init_plugins(uev_ctx_t *ctx) { int fail = 0; plugin_t *p, *tmp; @@ -333,7 +333,7 @@ static int load_plugins(char *path) return fail; } #else -static int load_plugins(char *UNUSED(path)) +static int load_plugins(char *path) { print_desc("Initializing plugins", NULL); return 0; diff --git a/src/service.c b/src/service.c index 333af972..d3d73e40 100644 --- a/src/service.c +++ b/src/service.c @@ -77,7 +77,7 @@ int service_enabled(svc_t *svc) * Calls the callback registered with the call to * service_timeout_after(). */ -static void service_timeout_cb(uev_t *UNUSED(w), void *arg, int UNUSED(events)) +static void service_timeout_cb(uev_t *w, void *arg, int events) { svc_t *svc = arg; diff --git a/src/sig.c b/src/sig.c index 00cef81f..65581cfa 100644 --- a/src/sig.c +++ b/src/sig.c @@ -221,7 +221,7 @@ void do_shutdown(shutop_t op) /* * Reload .conf files in /etc/finit.d/ */ -static void sighup_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) +static void sighup_cb(uev_t *w, void *arg, int events) { _d("..."); /* INIT_CMD_RELOAD: 'init q', 'initctl reload', and SIGHUP */ @@ -231,7 +231,7 @@ static void sighup_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) /* * SIGINT: Should generate condition, for now reboot */ -static void sigint_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) +static void sigint_cb(uev_t *w, void *arg, int events) { _d("..."); halt = SHUT_REBOOT; @@ -241,7 +241,7 @@ static void sigint_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) /* * SIGUSR1: BusyBox style halt */ -static void sigusr1_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) +static void sigusr1_cb(uev_t *w, void *arg, int events) { _d("..."); halt = SHUT_HALT; @@ -251,7 +251,7 @@ static void sigusr1_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) /* * SIGUSR2: BusyBox style poweroff */ -static void sigusr2_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) +static void sigusr2_cb(uev_t *w, void *arg, int events) { _d("..."); halt = SHUT_OFF; @@ -261,7 +261,7 @@ static void sigusr2_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) /* * SIGTERM: BusyBox style reboot */ -static void sigterm_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) +static void sigterm_cb(uev_t *w, void *arg, int events) { _d("..."); halt = SHUT_REBOOT; @@ -271,7 +271,7 @@ static void sigterm_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) /* * SIGCHLD: one of our children has died */ -static void sigchld_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) +static void sigchld_cb(uev_t *w, void *arg, int events) { pid_t pid; @@ -288,7 +288,7 @@ static void sigchld_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) /* * SIGSTOP/SIGTSTP: Paused by user or netflash */ -static void sigstop_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) +static void sigstop_cb(uev_t *w, void *arg, int events) { touch(SYNC_STOPPED); stopped++; @@ -297,7 +297,7 @@ static void sigstop_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) /* * SIGCONT: Restart service monitor */ -static void sigcont_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events)) +static void sigcont_cb(uev_t *w, void *arg, int events) { stopped = 0; erase(SYNC_STOPPED); @@ -314,7 +314,7 @@ int sig_stopped(void) /* * Inital signal setup - ignore everything but SIGCHLD until we're capable of responding */ -static void chld_handler(int UNUSED(sig), siginfo_t *UNUSED(info), void *UNUSED(ctx)) +static void chld_handler(int sig, siginfo_t *info, void *ctx) { /* NOP */ }