diff --git a/Makefile.am b/Makefile.am index 2c91d7cb..5fa37703 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,3 +20,4 @@ i3blocks_SOURCES = \ sys.c \ sys.h \ term.h +i3blocks_CFLAGS = -Wall -Wextra -Werror $(AM_CFLAGS) diff --git a/block.c b/block.c index af71b244..a7e999d9 100644 --- a/block.c +++ b/block.c @@ -60,6 +60,8 @@ static int block_setenv(const char *name, const char *value, void *data) { int err; + (void)data; + if (!value) value = ""; @@ -182,7 +184,6 @@ static int block_send_json(struct block *block) static int block_send(struct block *block) { const char *button = block_get(block, "button"); - int err; if (!button) { block_error(block, "no click data to send"); @@ -217,6 +218,8 @@ void block_touch(struct block *block) unsigned long now; int err; + (void)block; + err = sys_gettime(&now); if (err) { block_error(block, "failed to touch block"); @@ -236,6 +239,8 @@ static int block_child_sig(struct block *block) sigset_t set; int err; + (void)block; + /* It'd be safe to assume that all signals are unblocked by default */ err = sys_sigfillset(&set); if (err) @@ -482,7 +487,6 @@ int block_reap(struct block *block) static int i3blocks_setup(struct block *block) { const char *value; - int err; value = map_get(block->config, "command"); if (value && *value != '\0') @@ -584,7 +588,7 @@ void block_printf(struct block *block, int lvl, const char *fmt, ...) va_list ap; int err; - if (lvl > log_level) + if (lvl > (int)log_level) return; va_start(ap, fmt); diff --git a/block.h b/block.h index a43816cc..abed98d4 100644 --- a/block.h +++ b/block.h @@ -50,7 +50,7 @@ struct block { /* Shortcuts */ const char *command; int interval; - unsigned signal; + int signal; unsigned format; /* Runtime info */ diff --git a/configure.ac b/configure.ac index 1856185d..c3cc6218 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_INIT([i3blocks], 1.4) AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE(foreign) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_PROG_CC AC_CONFIG_HEADERS([i3blocks-config.h]) AC_CONFIG_FILES([ diff --git a/ini.c b/ini.c index 4a494ff4..7e984541 100644 --- a/ini.c +++ b/ini.c @@ -47,6 +47,8 @@ static int ini_property(struct ini *ini, char *key, char *value) static int ini_parse_line(char *line, size_t num, void *data) { + (void)num; + /* comment or empty line? */ if (*line == '\0' || *line == '#') return 0; diff --git a/json.c b/json.c index 8f84130d..65b4ca88 100644 --- a/json.c +++ b/json.c @@ -347,6 +347,8 @@ static int json_line_cb(char *line, size_t num, void *data) size_t len; int err; + (void)num; + for (;;) { /* Only support inline flattened structures at the moment */ while (*line == '[' || *line == ']' || *line == ',' || @@ -452,7 +454,7 @@ int json_escape(const char *str, char *buf, size_t size) } /* Ensure the result was not truncated */ - if (len < 0 || len >= size) + if (len < 0 || (size_t)len >= size) return -ENOSPC; size -= len; diff --git a/log.h b/log.h index a1ef2858..42ce7221 100644 --- a/log.h +++ b/log.h @@ -40,7 +40,7 @@ static inline void log_printf(int lvl, const char *fmt, ...) { va_list ap; - if (lvl <= LOG_ERROR || lvl <= log_level) { + if (lvl <= LOG_ERROR || lvl <= (int)log_level) { va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap);