diff --git a/Makefile b/Makefile
index d37f242aee28a56672ea868cfac24f0806dbf505..1e1fe1c937ea718fc0a8083399e42bca943636fe 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-CFLAGS=-Wall -O3 -std=gnu99 -ggdb3
+CFLAGS=-Wall -Wextra -Wno-unused -O3 -std=gnu99 -ggdb3
 
 all: compctld compctl
 
diff --git a/compctl.c b/compctl.c
index fff81ab75c2ef4e36e9a466732768f39f9e95282..52b3bfa9a025aa5f58f32a9183d6fc6b5ece20bc 100644
--- a/compctl.c
+++ b/compctl.c
@@ -54,7 +54,7 @@ daemon_chat(char *cmd)
 		perror("sendmsg");
 		exit(EXIT_FAILURE);
 	}
-	if (sent < msg.msg_iov->iov_len) {
+	if ((size_t) sent < msg.msg_iov->iov_len) {
 		fprintf(stderr, "incomplete send %zd < %zu, FIXME\n", sent, msg.msg_iov->iov_len);
 		exit(EXIT_FAILURE);
 	}
diff --git a/compctld.c b/compctld.c
index 6ac733f66cf6c7571a2e0d63c18336c482847b42..582417244be56d2a1f6ffda66e65c20c2d4daac1 100644
--- a/compctld.c
+++ b/compctld.c
@@ -47,8 +47,8 @@ memory_limits(size_t *minuser, size_t *mincomp, size_t *maxcomp, size_t *total)
 		*minuser = static_maxfree;
 
 	*mincomp = static_minfree;
-	*maxcomp = *total - *minuser;
-	if (*maxcomp < 0) *maxcomp = 0;
+	ssize_t smaxcomp = *total - *minuser;
+	*maxcomp = smaxcomp > 0 ? smaxcomp : 0;
 	/* maxcomp < mincomp may happen; they are used in different
 	 * settings. */
 }
@@ -101,7 +101,7 @@ mprintf(int fd, char *fmt, ...)
 		logperror("sendmsg");
 		return;
 	}
-	if (sent < iov.iov_len) {
+	if ((size_t) sent < iov.iov_len) {
 		syslog(LOG_INFO, "incomplete send %zd < %zu, FIXME", sent, iov.iov_len);
 		return;
 	}