Use __unused rather than rolling our own.

This commit is contained in:
nicm 2015-11-18 14:27:44 +00:00
parent 5a5b950e8b
commit 577c0e3e5a
30 changed files with 68 additions and 69 deletions

View File

@ -35,7 +35,7 @@ int alerts_check_silence(struct session *, struct winlink *);
void alerts_ring_bell(struct session *);
void
alerts_timer(unused int fd, unused short events, void *arg)
alerts_timer(__unused int fd, __unused short events, void *arg)
{
struct window *w = arg;
@ -45,7 +45,7 @@ alerts_timer(unused int fd, unused short events, void *arg)
}
void
alerts_callback(unused int fd, unused short events, unused void *arg)
alerts_callback(__unused int fd, __unused short events, __unused void *arg)
{
struct window *w;
struct session *s;

2
cfg.c
View File

@ -133,7 +133,7 @@ load_cfg(const char *path, struct cmd_q *cmdq, char **cause)
}
void
cfg_default_done(unused struct cmd_q *cmdq)
cfg_default_done(__unused struct cmd_q *cmdq)
{
if (--cfg_references != 0)
return;

View File

@ -410,7 +410,8 @@ client_send_identify(const char *ttynam, const char *cwd)
/* Callback for client stdin read events. */
void
client_stdin_callback(unused int fd, unused short events, unused void *arg)
client_stdin_callback(__unused int fd, __unused short events,
__unused void *arg)
{
struct msg_stdin_data data;
@ -512,7 +513,7 @@ client_signal(int sig)
/* Callback for client read events. */
void
client_dispatch(struct imsg *imsg, unused void *arg)
client_dispatch(struct imsg *imsg, __unused void *arg)
{
if (imsg == NULL) {
client_exitreason = CLIENT_EXIT_LOST_SERVER;

View File

@ -46,7 +46,7 @@ const struct cmd_entry cmd_start_server_entry = {
};
enum cmd_retval
cmd_kill_server_exec(struct cmd *self, unused struct cmd_q *cmdq)
cmd_kill_server_exec(struct cmd *self, __unused struct cmd_q *cmdq)
{
if (self->entry == &cmd_kill_server_entry)
kill(getpid(), SIGTERM);

View File

@ -41,7 +41,7 @@ const struct cmd_entry cmd_list_buffers_entry = {
};
enum cmd_retval
cmd_list_buffers_exec(unused struct cmd *self, struct cmd_q *cmdq)
cmd_list_buffers_exec(struct cmd *self, struct cmd_q *cmdq)
{
struct args *args = self->args;
struct paste_buffer *pb;

View File

@ -30,7 +30,7 @@
enum cmd_retval cmd_list_keys_exec(struct cmd *, struct cmd_q *);
enum cmd_retval cmd_list_keys_table(struct cmd *, struct cmd_q *);
enum cmd_retval cmd_list_keys_commands(struct cmd *, struct cmd_q *);
enum cmd_retval cmd_list_keys_commands(struct cmd_q *);
const struct cmd_entry cmd_list_keys_entry = {
"list-keys", "lsk",
@ -60,7 +60,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
int repeat, width, tablewidth, keywidth;
if (self->entry == &cmd_list_commands_entry)
return (cmd_list_keys_commands(self, cmdq));
return (cmd_list_keys_commands(cmdq));
if (args_has(args, 't'))
return (cmd_list_keys_table(self, cmdq));
@ -178,7 +178,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
}
enum cmd_retval
cmd_list_keys_commands(unused struct cmd *self, struct cmd_q *cmdq)
cmd_list_keys_commands(struct cmd_q *cmdq)
{
const struct cmd_entry **entryp;
const struct cmd_entry *entry;

View File

@ -51,7 +51,7 @@ const struct cmd_entry cmd_lock_client_entry = {
};
enum cmd_retval
cmd_lock_server_exec(struct cmd *self, unused struct cmd_q *cmdq)
cmd_lock_server_exec(struct cmd *self, __unused struct cmd_q *cmdq)
{
struct args *args = self->args;
struct client *c;

View File

@ -142,8 +142,8 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq)
}
void
cmd_pipe_pane_error_callback(
unused struct bufferevent *bufev, unused short what, void *data)
cmd_pipe_pane_error_callback(__unused struct bufferevent *bufev,
__unused short what, void *data)
{
struct window_pane *wp = data;

View File

@ -350,7 +350,7 @@ cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq,
/* Set a string option. */
struct options_entry *
cmd_set_option_string(struct cmd *self, unused struct cmd_q *cmdq,
cmd_set_option_string(struct cmd *self, __unused struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@ -372,7 +372,7 @@ cmd_set_option_string(struct cmd *self, unused struct cmd_q *cmdq,
/* Set a number option. */
struct options_entry *
cmd_set_option_number(unused struct cmd *self, struct cmd_q *cmdq,
cmd_set_option_number(__unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@ -390,7 +390,7 @@ cmd_set_option_number(unused struct cmd *self, struct cmd_q *cmdq,
/* Set a key option. */
struct options_entry *
cmd_set_option_key(unused struct cmd *self, struct cmd_q *cmdq,
cmd_set_option_key(__unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@ -406,7 +406,7 @@ cmd_set_option_key(unused struct cmd *self, struct cmd_q *cmdq,
/* Set a colour option. */
struct options_entry *
cmd_set_option_colour(unused struct cmd *self, struct cmd_q *cmdq,
cmd_set_option_colour(__unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@ -422,7 +422,7 @@ cmd_set_option_colour(unused struct cmd *self, struct cmd_q *cmdq,
/* Set an attributes option. */
struct options_entry *
cmd_set_option_attributes(unused struct cmd *self, struct cmd_q *cmdq,
cmd_set_option_attributes(__unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@ -438,7 +438,7 @@ cmd_set_option_attributes(unused struct cmd *self, struct cmd_q *cmdq,
/* Set a flag option. */
struct options_entry *
cmd_set_option_flag(unused struct cmd *self, struct cmd_q *cmdq,
cmd_set_option_flag(__unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{
@ -466,7 +466,7 @@ cmd_set_option_flag(unused struct cmd *self, struct cmd_q *cmdq,
/* Set a choice option. */
struct options_entry *
cmd_set_option_choice(unused struct cmd *self, struct cmd_q *cmdq,
cmd_set_option_choice(__unused struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo,
const char *value)
{

View File

@ -111,7 +111,7 @@ cmd_wait_for_remove(struct wait_channel *wc)
}
enum cmd_retval
cmd_wait_for_exec(struct cmd *self, unused struct cmd_q *cmdq)
cmd_wait_for_exec(struct cmd *self, struct cmd_q *cmdq)
{
struct args *args = self->args;
const char *name = args->argv[0];
@ -130,7 +130,7 @@ cmd_wait_for_exec(struct cmd *self, unused struct cmd_q *cmdq)
}
enum cmd_retval
cmd_wait_for_signal(unused struct cmd_q *cmdq, const char *name,
cmd_wait_for_signal(__unused struct cmd_q *cmdq, const char *name,
struct wait_channel *wc)
{
struct cmd_q *wq, *wq1;

View File

@ -101,7 +101,7 @@ control_notify_window_layout_changed(struct window *w)
}
void
control_notify_window_unlinked(unused struct session *s, struct window *w)
control_notify_window_unlinked(__unused struct session *s, struct window *w)
{
struct client *c;
struct session *cs;
@ -119,7 +119,7 @@ control_notify_window_unlinked(unused struct session *s, struct window *w)
}
void
control_notify_window_linked(unused struct session *s, struct window *w)
control_notify_window_linked(__unused struct session *s, struct window *w)
{
struct client *c;
struct session *cs;
@ -183,7 +183,7 @@ control_notify_session_renamed(struct session *s)
}
void
control_notify_session_created(unused struct session *s)
control_notify_session_created(__unused struct session *s)
{
struct client *c;
@ -196,7 +196,7 @@ control_notify_session_created(unused struct session *s)
}
void
control_notify_session_close(unused struct session *s)
control_notify_session_close(__unused struct session *s)
{
struct client *c;

View File

@ -51,7 +51,7 @@ control_write_buffer(struct client *c, struct evbuffer *buffer)
/* Control input callback. Read lines and fire commands. */
void
control_callback(struct client *c, int closed, unused void *data)
control_callback(struct client *c, int closed, __unused void *data)
{
char *line, *cause;
struct cmd_list *cmdlist;

View File

@ -259,7 +259,7 @@ format_job_get(struct format_tree *ft, const char *cmd)
/* Remove old jobs. */
void
format_job_timer(unused int fd, unused short events, unused void *arg)
format_job_timer(__unused int fd, __unused short events, __unused void *arg)
{
struct format_job *fj, *fj1;
time_t now;
@ -288,7 +288,7 @@ format_job_timer(unused int fd, unused short events, unused void *arg)
/* Callback for host. */
void
format_cb_host(unused struct format_tree *ft, struct format_entry *fe)
format_cb_host(__unused struct format_tree *ft, struct format_entry *fe)
{
char host[HOST_NAME_MAX + 1];
@ -300,7 +300,7 @@ format_cb_host(unused struct format_tree *ft, struct format_entry *fe)
/* Callback for host_short. */
void
format_cb_host_short(unused struct format_tree *ft, struct format_entry *fe)
format_cb_host_short(__unused struct format_tree *ft, struct format_entry *fe)
{
char host[HOST_NAME_MAX + 1], *cp;
@ -315,7 +315,7 @@ format_cb_host_short(unused struct format_tree *ft, struct format_entry *fe)
/* Callback for pid. */
void
format_cb_pid(unused struct format_tree *ft, struct format_entry *fe)
format_cb_pid(__unused struct format_tree *ft, struct format_entry *fe)
{
xasprintf(&fe->value, "%ld", (long)getpid());
}

5
job.c
View File

@ -150,7 +150,7 @@ job_free(struct job *job)
/* Called when output buffer falls below low watermark (default is 0). */
void
job_write_callback(unused struct bufferevent *bufev, void *data)
job_write_callback(__unused struct bufferevent *bufev, void *data)
{
struct job *job = data;
size_t len = EVBUFFER_LENGTH(EVBUFFER_OUTPUT(job->event));
@ -166,7 +166,8 @@ job_write_callback(unused struct bufferevent *bufev, void *data)
/* Job buffer error callback. */
void
job_callback(unused struct bufferevent *bufev, unused short events, void *data)
job_callback(__unused struct bufferevent *bufev, __unused short events,
void *data)
{
struct job *job = data;

2
log.c
View File

@ -33,7 +33,7 @@ void log_vwrite(const char *, va_list);
/* Log callback for libevent. */
void
log_event_cb(unused int severity, const char *msg)
log_event_cb(__unused int severity, const char *msg)
{
log_debug("%s", msg);
}

View File

@ -29,7 +29,7 @@ void name_time_callback(int, short, void *);
int name_time_expired(struct window *, struct timeval *);
void
name_time_callback(unused int fd, unused short events, void *arg)
name_time_callback(__unused int fd, __unused short events, void *arg)
{
struct window *w = arg;

4
proc.c
View File

@ -53,7 +53,7 @@ static int peer_check_version(struct tmuxpeer *, struct imsg *);
static void proc_update_event(struct tmuxpeer *);
static void
proc_event_cb(unused int fd, short events, void *arg)
proc_event_cb(__unused int fd, short events, void *arg)
{
struct tmuxpeer *peer = arg;
ssize_t n;
@ -101,7 +101,7 @@ proc_event_cb(unused int fd, short events, void *arg)
}
static void
proc_signal_cb(int signo, unused short events, void *arg)
proc_signal_cb(int signo, __unused short events, void *arg)
{
struct tmuxproc *tp = arg;

View File

@ -42,7 +42,7 @@ screen_write_start(struct screen_write_ctx *ctx, struct window_pane *wp,
/* Finish writing. */
void
screen_write_stop(unused struct screen_write_ctx *ctx)
screen_write_stop(__unused struct screen_write_ctx *ctx)
{
}

View File

@ -246,7 +246,7 @@ server_client_unref(struct client *c)
/* Free dead client. */
void
server_client_free(unused int fd, unused short events, void *arg)
server_client_free(__unused int fd, __unused short events, void *arg)
{
struct client *c = arg;
@ -818,7 +818,7 @@ server_client_reset_state(struct client *c)
/* Repeat time callback. */
void
server_client_repeat_timer(unused int fd, unused short events, void *data)
server_client_repeat_timer(__unused int fd, __unused short events, void *data)
{
struct client *c = data;
@ -1214,7 +1214,7 @@ server_client_dispatch_shell(struct client *c)
/* Event callback to push more stdout data if any left. */
static void
server_client_stdout_cb(unused int fd, unused short events, void *arg)
server_client_stdout_cb(__unused int fd, __unused short events, void *arg)
{
struct client *c = arg;
@ -1255,7 +1255,7 @@ server_client_push_stdout(struct client *c)
/* Event callback to push more stderr data if any left. */
static void
server_client_stderr_cb(unused int fd, unused short events, void *arg)
server_client_stderr_cb(__unused int fd, __unused short events, void *arg)
{
struct client *c = arg;

View File

@ -443,7 +443,7 @@ server_clear_identify(struct client *c)
}
void
server_callback_identify(unused int fd, unused short events, void *data)
server_callback_identify(__unused int fd, __unused short events, void *data)
{
struct client *c = data;

View File

@ -298,7 +298,7 @@ server_update_socket(void)
/* Callback for server socket. */
void
server_accept(int fd, short events, unused void *data)
server_accept(int fd, short events, __unused void *data)
{
struct sockaddr_storage sa;
socklen_t slen = sizeof sa;

View File

@ -181,7 +181,7 @@ session_unref(struct session *s)
/* Free session. */
void
session_free(unused int fd, unused short events, void *arg)
session_free(__unused int fd, __unused short events, void *arg)
{
struct session *s = arg;
@ -236,7 +236,7 @@ session_check_name(const char *name)
/* Lock session if it has timed out. */
void
session_lock_timer(unused int fd, unused short events, void *arg)
session_lock_timer(__unused int fd, __unused short events, void *arg)
{
struct session *s = arg;

View File

@ -145,7 +145,7 @@ status_prompt_save_history(void)
/* Status timer callback. */
void
status_timer_callback(unused int fd, unused short events, void *arg)
status_timer_callback(__unused int fd, __unused short events, void *arg)
{
struct client *c = arg;
struct session *s = c->session;
@ -604,7 +604,7 @@ status_message_clear(struct client *c)
/* Clear status line message after timer expires. */
void
status_message_callback(unused int fd, unused short event, void *data)
status_message_callback(__unused int fd, __unused short event, void *data)
{
struct client *c = data;

3
tmux.h
View File

@ -69,9 +69,6 @@ struct tmuxproc;
#define READ_BACKOFF 512
#define READ_TIME 100
/* Definition to shut gcc up about unused arguments. */
#define unused __attribute__ ((unused))
/* Attribute to make gcc check printf-like arguments. */
#define printflike(a, b) __attribute__ ((format (printf, a, b)))

View File

@ -635,7 +635,7 @@ discard_key:
/* Key timer callback. */
void
tty_keys_callback(unused int fd, unused short events, void *data)
tty_keys_callback(__unused int fd, __unused short events, void *data)
{
struct tty *tty = data;

8
tty.c
View File

@ -172,7 +172,7 @@ tty_open(struct tty *tty, char **cause)
}
void
tty_read_callback(unused struct bufferevent *bufev, void *data)
tty_read_callback(__unused struct bufferevent *bufev, void *data)
{
struct tty *tty = data;
@ -181,8 +181,8 @@ tty_read_callback(unused struct bufferevent *bufev, void *data)
}
void
tty_error_callback(
unused struct bufferevent *bufev, unused short what, unused void *data)
tty_error_callback(__unused struct bufferevent *bufev, __unused short what,
__unused void *data)
{
}
@ -591,7 +591,7 @@ tty_repeat_space(struct tty *tty, u_int n)
* pane.
*/
int
tty_large_region(unused struct tty *tty, const struct tty_ctx *ctx)
tty_large_region(__unused struct tty *tty, const struct tty_ctx *ctx)
{
struct window_pane *wp = ctx->wp;

View File

@ -509,8 +509,8 @@ window_choose_get_item(struct window_pane *wp, key_code key,
}
void
window_choose_key(struct window_pane *wp, unused struct client *c,
unused struct session *sess, key_code key, struct mouse_event *m)
window_choose_key(struct window_pane *wp, __unused struct client *c,
__unused struct session *sess, key_code key, struct mouse_event *m)
{
struct window_choose_mode_data *data = wp->modedata;
struct screen *s = &data->screen;

View File

@ -120,7 +120,7 @@ const char window_clock_table[14][5][5] = {
};
void
window_clock_timer_callback(unused int fd, unused short events, void *arg)
window_clock_timer_callback(__unused int fd, __unused short events, void *arg)
{
struct window_pane *wp = arg;
struct window_clock_mode_data *data = wp->modedata;
@ -185,9 +185,9 @@ window_clock_resize(struct window_pane *wp, u_int sx, u_int sy)
}
void
window_clock_key(struct window_pane *wp, unused struct client *c,
unused struct session *sess, unused key_code key,
unused struct mouse_event *m)
window_clock_key(struct window_pane *wp, __unused struct client *c,
__unused struct session *sess, __unused key_code key,
__unused struct mouse_event *m)
{
window_pane_reset_mode(wp);
}

View File

@ -2232,7 +2232,7 @@ window_copy_rectangle_toggle(struct window_pane *wp)
}
void
window_copy_start_drag(struct client *c, unused struct mouse_event *m)
window_copy_start_drag(struct client *c, struct mouse_event *m)
{
struct window_pane *wp;
u_int x, y;
@ -2253,7 +2253,7 @@ window_copy_start_drag(struct client *c, unused struct mouse_event *m)
}
void
window_copy_drag_update(unused struct client *c, struct mouse_event *m)
window_copy_drag_update(__unused struct client *c, struct mouse_event *m)
{
struct window_pane *wp;
struct window_copy_mode_data *data;
@ -2274,7 +2274,7 @@ window_copy_drag_update(unused struct client *c, struct mouse_event *m)
}
void
window_copy_drag_release(unused struct client *c, struct mouse_event *m)
window_copy_drag_release(__unused struct client *c, struct mouse_event *m)
{
struct window_pane *wp;

View File

@ -916,13 +916,13 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv,
}
void
window_pane_timer_callback(unused int fd, unused short events, void *data)
window_pane_timer_callback(__unused int fd, __unused short events, void *data)
{
window_pane_read_callback(NULL, data);
}
void
window_pane_read_callback(unused struct bufferevent *bufev, void *data)
window_pane_read_callback(__unused struct bufferevent *bufev, void *data)
{
struct window_pane *wp = data;
struct evbuffer *evb = wp->event->input;
@ -968,8 +968,8 @@ start_timer:
}
void
window_pane_error_callback(unused struct bufferevent *bufev, unused short what,
void *data)
window_pane_error_callback(__unused struct bufferevent *bufev,
__unused short what, void *data)
{
struct window_pane *wp = data;