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
endif
CFLAGS +=-Wall -std=c99
CFLAGS +=-Wall -Wextra -std=c99
ifeq ($(DEBUG),1)
CFLAGS +=-ggdb -DDEBUG

View File

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

View File

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

View File

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