Add -Wextra

This commit is contained in:
Přemysl Eric Janouch 2014-09-23 02:33:06 +02:00
parent b630bf7a5f
commit 56f7847ce3
4 changed files with 27 additions and 4 deletions

View File

@ -8,7 +8,7 @@ ifneq ($(VERBOSE),1)
LIBTOOL +=--quiet LIBTOOL +=--quiet
endif endif
CFLAGS +=-Wall -std=c99 CFLAGS +=-Wall -Wextra -std=c99
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
CFLAGS +=-ggdb -DDEBUG CFLAGS +=-ggdb -DDEBUG

View File

@ -17,6 +17,9 @@ on_key (termkey_t *tk, termkey_key_t *key)
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
(void) argc;
(void) argv;
TERMKEY_CHECK_VERSION; TERMKEY_CHECK_VERSION;
termkey_t *tk = termkey_new (0, 0); termkey_t *tk = termkey_new (0, 0);

View File

@ -29,6 +29,8 @@ static termkey_result_t
handle_csi_ss3_full (termkey_t *tk, handle_csi_ss3_full (termkey_t *tk,
termkey_key_t *key, int cmd, long *arg, int args) termkey_key_t *key, int cmd, long *arg, int args)
{ {
(void) tk;
if (args > 1 && arg[1] != -1) if (args > 1 && arg[1] != -1)
key->modifiers = arg[1] - 1; key->modifiers = arg[1] - 1;
else else
@ -90,11 +92,13 @@ register_ss3kpalt (termkey_type_t type, termkey_sym_t sym,
/* This value must be increased if more CSI function keys are added */ /* This value must be increased if more CSI function keys are added */
static struct keyinfo csifuncs[35]; static struct keyinfo csifuncs[35];
#define NCSIFUNCS (sizeof csifuncs / sizeof csifuncs[0]) #define NCSIFUNCS ((long) (sizeof csifuncs / sizeof csifuncs[0]))
static termkey_result_t static termkey_result_t
handle_csifunc (termkey_t *tk, termkey_key_t *key, int cmd, long *arg, int args) handle_csifunc (termkey_t *tk, termkey_key_t *key, int cmd, long *arg, int args)
{ {
(void) cmd;
if (args > 1 && arg[1] != -1) if (args > 1 && arg[1] != -1)
key->modifiers = arg[1] - 1; key->modifiers = arg[1] - 1;
else else
@ -177,6 +181,8 @@ handle_csi_u (termkey_t *tk, termkey_key_t *key, int cmd, long *arg, int args)
static termkey_result_t static termkey_result_t
handle_csi_m (termkey_t *tk, termkey_key_t *key, int cmd, long *arg, int args) handle_csi_m (termkey_t *tk, termkey_key_t *key, int cmd, long *arg, int args)
{ {
(void) tk;
int initial = cmd >> 8; int initial = cmd >> 8;
cmd &= 0xff; cmd &= 0xff;
@ -224,6 +230,8 @@ termkey_result_t
termkey_interpret_mouse (termkey_t *tk, const termkey_key_t *key, termkey_interpret_mouse (termkey_t *tk, const termkey_key_t *key,
termkey_mouse_event_t *event, int *button, int *line, int *col) termkey_mouse_event_t *event, int *button, int *line, int *col)
{ {
(void) tk;
if (key->type != TERMKEY_TYPE_MOUSE) if (key->type != TERMKEY_TYPE_MOUSE)
return TERMKEY_RES_NONE; return TERMKEY_RES_NONE;
@ -298,6 +306,8 @@ termkey_result_t
termkey_interpret_position (termkey_t *tk, termkey_interpret_position (termkey_t *tk,
const termkey_key_t *key, int *line, int *col) const termkey_key_t *key, int *line, int *col)
{ {
(void) tk;
if (key->type != TERMKEY_TYPE_POSITION) if (key->type != TERMKEY_TYPE_POSITION)
return TERMKEY_RES_NONE; return TERMKEY_RES_NONE;
@ -312,6 +322,8 @@ termkey_interpret_position (termkey_t *tk,
static termkey_result_t static termkey_result_t
handle_csi_y (termkey_t *tk, termkey_key_t *key, int cmd, long *arg, int args) handle_csi_y (termkey_t *tk, termkey_key_t *key, int cmd, long *arg, int args)
{ {
(void) tk;
switch (cmd) switch (cmd)
{ {
case 'y' | '$' << 16: case 'y' | '$' << 16:
@ -335,6 +347,8 @@ termkey_result_t
termkey_interpret_modereport (termkey_t *tk, termkey_interpret_modereport (termkey_t *tk,
const termkey_key_t *key, int *initial, int *mode, int *value) const termkey_key_t *key, int *initial, int *mode, int *value)
{ {
(void) tk;
if (key->type != TERMKEY_TYPE_MODEREPORT) if (key->type != TERMKEY_TYPE_MODEREPORT)
return TERMKEY_RES_NONE; return TERMKEY_RES_NONE;
@ -524,6 +538,8 @@ register_keys (void)
static void * static void *
new_driver (termkey_t *tk, const char *term) new_driver (termkey_t *tk, const char *term)
{ {
(void) term;
if (!keyinfo_initialised && !register_keys ()) if (!keyinfo_initialised && !register_keys ())
return NULL; return NULL;
@ -546,6 +562,8 @@ static termkey_result_t
peekkey_csi (termkey_t *tk, termkey_csi_t *csi, peekkey_csi (termkey_t *tk, termkey_csi_t *csi,
size_t introlen, termkey_key_t *key, int force, size_t *nbytep) size_t introlen, termkey_key_t *key, int force, size_t *nbytep)
{ {
(void) csi;
size_t csi_len; size_t csi_len;
size_t args = 16; size_t args = 16;
long arg[16]; long arg[16];
@ -621,6 +639,8 @@ static termkey_result_t
peekkey_ss3 (termkey_t *tk, termkey_csi_t *csi, size_t introlen, peekkey_ss3 (termkey_t *tk, termkey_csi_t *csi, size_t introlen,
termkey_key_t *key, int force, size_t *nbytep) termkey_key_t *key, int force, size_t *nbytep)
{ {
(void) csi;
if (tk->buffcount < introlen + 1) if (tk->buffcount < introlen + 1)
{ {
if (!force) if (!force)

View File

@ -332,7 +332,7 @@ start_driver (termkey_t *tk, void *info)
len = strlen (start_string); len = strlen (start_string);
while (len) while (len)
{ {
size_t written = write (tk->fd, start_string, len); ssize_t written = write (tk->fd, start_string, len);
if (written == -1) if (written == -1)
return 0; return 0;
start_string += written; start_string += written;
@ -368,7 +368,7 @@ stop_driver (termkey_t *tk, void *info)
len = strlen (stop_string); len = strlen (stop_string);
while (len) while (len)
{ {
size_t written = write (tk->fd, stop_string, len); ssize_t written = write (tk->fd, stop_string, len);
if (written == -1) if (written == -1)
return 0; return 0;
stop_string += written; stop_string += written;