Remove UNUSED() macro and disable the compiler warning instead

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-07-02 21:59:23 +02:00
1 parent e46e3cdcb6
commit 30822f0d68
27 files changed
+51 -52

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
AM_LDFLAGS = -module -avoid-version -shared 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 = -I$(top_srcdir)/src -U_FORTIFY_SOURCE
AM_CPPFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE AM_CPPFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_GNU_SOURCE -D_DEFAULT_SOURCE
AM_CPPFLAGS += $(lite_CFLAGS) AM_CPPFLAGS += $(lite_CFLAGS)
+2 -2
View File
@@ -28,7 +28,7 @@
#define ALSACTL "/usr/sbin/alsactl" #define ALSACTL "/usr/sbin/alsactl"
static void save(void *UNUSED(arg)) static void save(void *arg)
{ {
if (fexist(ALSACTL)) { if (fexist(ALSACTL)) {
_d("Saving sound settings ..."); _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)) { if (fexist(ALSACTL)) {
_d("Restoring sound settings ..."); _d("Restoring sound settings ...");
+2 -2
View File
@@ -64,7 +64,7 @@ static int is_tmpfs(char *path)
return tmpfs; 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) if (ftw->level == 0)
return 1; return 1;
@@ -96,7 +96,7 @@ static void bootclean(void)
/* /*
* Setup standard FHS 2.3 structure in /var, and write runlevel to UTMP * 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; int gid;
+1 -1
View File
@@ -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); 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; int sd = STDIN_FILENO;
char buf[BUFSIZ]; char buf[BUFSIZ];
+1 -1
View File
@@ -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); 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; int sd = STDIN_FILENO;
char buf[BUFSIZ]; char buf[BUFSIZ];
+1 -1
View File
@@ -29,7 +29,7 @@
#include "helpers.h" #include "helpers.h"
#include "plugin.h" #include "plugin.h"
static void setup(void *UNUSED(arg)) static void setup(void *arg)
{ {
umask(0); umask(0);
+1 -1
View File
@@ -27,7 +27,7 @@
#include "plugin.h" #include "plugin.h"
static int cb(int UNUSED(type)) static int cb(int type)
{ {
int sd = STDIN_FILENO; int sd = STDIN_FILENO;
char buf[BUFSIZ]; char buf[BUFSIZ];
+1 -1
View File
@@ -41,7 +41,7 @@ static int recv_peer(int sd, char *buf, ssize_t len, struct sockaddr *sa, sockle
return len; return len;
} }
static int cb(int UNUSED(type)) static int cb(int type)
{ {
int sd = STDIN_FILENO; int sd = STDIN_FILENO;
char buf[BUFSIZ]; char buf[BUFSIZ];
+2 -2
View File
@@ -27,14 +27,14 @@
#include "helpers.h" #include "helpers.h"
#include "plugin.h" #include "plugin.h"
static void save(void *UNUSED(arg)) static void save(void *arg)
{ {
_d("Saving system clock to RTC ..."); _d("Saving system clock to RTC ...");
/* -w,--systohc, -u,--utc */ /* -w,--systohc, -u,--utc */
run_interactive("/sbin/hwclock -w -u", "Saving system time (UTC) to RTC"); 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 ..."); _d("Restoring system clock from RTC ...");
/* -s,--hctosys, -u,--utc */ /* -s,--hctosys, -u,--utc */
+2 -2
View File
@@ -98,7 +98,7 @@ static void set_env(char *data)
* For SysV compatibility the default is to halt the system when issuing * For SysV compatibility the default is to halt the system when issuing
* `init 0`, unless INIT_HALT=POWERDOWN, as performed by the SysV utils. * `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; int lvl;
struct init_request rq; 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 */ /* 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); _d("Setting up %s", FINIT_FIFO);
makefifo(FINIT_FIFO, 0600); makefifo(FINIT_FIFO, 0600);
+1 -1
View File
@@ -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; ssize_t len;
static char buf[4096]; static char buf[4096];
+1 -1
View File
@@ -43,7 +43,7 @@ static char *mkcond(char *buf, size_t len, char *nm)
return buf; 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 ev_buf[8 *(sizeof(struct inotify_event) + NAME_MAX + 1) + 1];
static char cond[MAX_ARG_LEN]; static char cond[MAX_ARG_LEN];
+1 -1
View File
@@ -25,7 +25,7 @@
#include <lite/lite.h> #include <lite/lite.h>
#include "plugin.h" #include "plugin.h"
static void setup(void *UNUSED(arg)) static void setup(void *arg)
{ {
size_t i; size_t i;
glob_t gl; glob_t gl;
+1 -1
View File
@@ -31,7 +31,7 @@
* No need to clean up files in /etc/resolvconf/run/interface/ * No need to clean up files in /etc/resolvconf/run/interface/
* this is already taken care of by bootclean * this is already taken care of by bootclean
*/ */
static void setup(void *UNUSED(arg)) static void setup(void *arg)
{ {
_d("Setting up the resolver ..."); _d("Setting up the resolver ...");
mkpath("/etc/resolvconf", 0755); mkpath("/etc/resolvconf", 0755);
+1 -1
View File
@@ -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); 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; int sd = STDIN_FILENO;
char buf[BUFSIZ]; char buf[BUFSIZ];
+1 -1
View File
@@ -53,7 +53,7 @@ static void setup(void)
_pe("Failed starting TTY watcher"); _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; int len = 0;
char buf[EVENT_SIZE], name[42]; char buf[EVENT_SIZE], name[42];
+2 -2
View File
@@ -32,7 +32,7 @@
#include "helpers.h" #include "helpers.h"
#include "plugin.h" #include "plugin.h"
static void setup(void *UNUSED(arg)) static void setup(void *arg)
{ {
#ifdef RANDOMSEED #ifdef RANDOMSEED
if (!fexist(RANDOMSEED)) { if (!fexist(RANDOMSEED)) {
@@ -65,7 +65,7 @@ static void setup(void *UNUSED(arg))
#endif #endif
} }
static void save(void *UNUSED(arg)) static void save(void *arg)
{ {
#ifdef RANDOMSEED #ifdef RANDOMSEED
umask(077); umask(077);
+1 -1
View File
@@ -30,7 +30,7 @@
#include "helpers.h" #include "helpers.h"
#include "plugin.h" #include "plugin.h"
static void setup(void *UNUSED(arg)) static void setup(void *arg)
{ {
#ifdef PAM_CONSOLE #ifdef PAM_CONSOLE
int fd; int fd;
+4 -2
View File
@@ -34,7 +34,8 @@ if WATCHDOGD
finit_SOURCES += watchdog.c watchdog.h finit_SOURCES += watchdog.c watchdog.h
endif 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) finit_LDADD = $(lite_LIBS) $(uev_LIBS)
if STATIC if STATIC
finit_LDADD += plugins/libplug.la finit_LDADD += plugins/libplug.la
@@ -44,7 +45,8 @@ endif
initctl_SOURCES = initctl.c serv.c serv.h svc.c svc.h \ initctl_SOURCES = initctl.c serv.c serv.h svc.c svc.h \
cond.c cond.h util.c util.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) initctl_LDADD = $(lite_LIBS)
reboot_SOURCES = reboot.c util.c util.h reboot_SOURCES = reboot.c util.c util.h
+1 -1
View File
@@ -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 * `initctl runlevel 0` is issued we default to POWERDOWN the system
* instead of just halting. * 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; int sd, lvl;
struct init_request rq; struct init_request rq;
+1 -1
View File
@@ -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; char *nm;
+1 -1
View File
@@ -290,7 +290,7 @@ static speed_t do_parse_speed(char *baud)
return B0; 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; int fd;
char name[30]; char name[30];
+1 -1
View File
@@ -137,7 +137,7 @@ static int get_stdin(svc_t *svc)
} }
/* Socket callback, looks up correct svc and starts it as an inetd service */ /* 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; svc_t *svc = (svc_t *)arg, *task;
int stdin; int stdin;
+8 -11
View File
@@ -121,7 +121,7 @@ exit:
return result; return result;
} }
static int toggle_debug(char *UNUSED(arg)) static int toggle_debug(char *arg)
{ {
struct init_request rq = { struct init_request rq = {
.magic = INIT_MAGIC, .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_set (char *cond) { return do_cond_magic('+', cond); }
static int do_cond_clear(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 *sb, int tflag, struct FTW *ftwbuf)
static int
dump_one_cond(const char *fpath, const struct stat *UNUSED(sb),
int tflag, struct FTW *UNUSED(ftwbuf))
{ {
int len; int len;
@@ -290,7 +287,7 @@ dump_one_cond(const char *fpath, const struct stat *UNUSED(sb),
return 0; return 0;
} }
static int do_cond_dump(char *UNUSED(arg)) static int do_cond_dump(char *arg)
{ {
printf("Condition Status)\n"); printf("Condition Status)\n");
printf("===============================================================================\n"); printf("===============================================================================\n");
@@ -303,7 +300,7 @@ static int do_cond_dump(char *UNUSED(arg))
return 0; return 0;
} }
static int do_cond_show(char *UNUSED(arg)) static int do_cond_show(char *arg)
{ {
svc_t *svc; svc_t *svc;
enum cond_state cond; enum cond_state cond;
@@ -364,9 +361,9 @@ static int do_signal(int signo, const char *msg)
return 0; return 0;
} }
static int do_halt (char *UNUSED(arg)) { return do_signal(SIGUSR1, "halt"); } static int do_halt (char *arg) { return do_signal(SIGUSR1, "halt"); }
static int do_poweroff(char *UNUSED(arg)) { return do_signal(SIGUSR2, "power off"); } static int do_poweroff(char *arg) { return do_signal(SIGUSR2, "power off"); }
static int do_reboot (char *UNUSED(arg)) { return do_signal(SIGTERM, "reboot"); } static int do_reboot (char *arg) { return do_signal(SIGTERM, "reboot"); }
int utmp_show(char *file) int utmp_show(char *file)
{ {
@@ -417,7 +414,7 @@ static int do_utmp(char *file)
utmp_show(_PATH_UTMP); utmp_show(_PATH_UTMP);
} }
static int show_version(char *UNUSED(arg)) static int show_version(char *arg)
{ {
puts("v" PACKAGE_VERSION); puts("v" PACKAGE_VERSION);
return 0; return 0;
+2 -2
View File
@@ -215,7 +215,7 @@ int plugin_io_init(plugin_t *p)
} }
/* Setup any I/O callbacks for plugins that use them */ /* 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; int fail = 0;
plugin_t *p, *tmp; plugin_t *p, *tmp;
@@ -333,7 +333,7 @@ static int load_plugins(char *path)
return fail; return fail;
} }
#else #else
static int load_plugins(char *UNUSED(path)) static int load_plugins(char *path)
{ {
print_desc("Initializing plugins", NULL); print_desc("Initializing plugins", NULL);
return 0; return 0;
+1 -1
View File
@@ -77,7 +77,7 @@ int service_enabled(svc_t *svc)
* Calls the callback registered with the call to * Calls the callback registered with the call to
* service_timeout_after(). * 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; svc_t *svc = arg;
+9 -9
View File
@@ -221,7 +221,7 @@ void do_shutdown(shutop_t op)
/* /*
* Reload .conf files in /etc/finit.d/ * 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("..."); _d("...");
/* INIT_CMD_RELOAD: 'init q', 'initctl reload', and SIGHUP */ /* 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 <sys/key/ctrlaltdel> condition, for now reboot * SIGINT: Should generate <sys/key/ctrlaltdel> 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("..."); _d("...");
halt = SHUT_REBOOT; 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 * 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("..."); _d("...");
halt = SHUT_HALT; 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 * 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("..."); _d("...");
halt = SHUT_OFF; 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 * 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("..."); _d("...");
halt = SHUT_REBOOT; 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 * 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; 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 * 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); touch(SYNC_STOPPED);
stopped++; stopped++;
@@ -297,7 +297,7 @@ static void sigstop_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events))
/* /*
* SIGCONT: Restart service monitor * 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; stopped = 0;
erase(SYNC_STOPPED); erase(SYNC_STOPPED);
@@ -314,7 +314,7 @@ int sig_stopped(void)
/* /*
* Inital signal setup - ignore everything but SIGCHLD until we're capable of responding * 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 */ /* NOP */
} }