diff --git a/mongoose.c b/mongoose.c
index a92ee7b7ba7379a26f62757dd0a3fb26a4ace09b..ddbed16bb906ad387ae42f624244ae18c6377253 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -549,6 +549,8 @@ void cs_log_set_file(FILE *file);
  */
 void cs_log_printf(const char *fmt, ...) PRINTF_LIKE(1, 2);
 
+#if CS_ENABLE_STDIO
+
 /*
  * Format and print message `x` with the given level `l`. Example:
  *
@@ -562,6 +564,12 @@ void cs_log_printf(const char *fmt, ...) PRINTF_LIKE(1, 2);
     if (cs_log_print_prefix(l, __func__, __FILE__)) cs_log_printf x; \
   } while (0)
 
+#else
+
+#define LOG(l, x) ((void) l)
+
+#endif
+
 #ifndef CS_NDEBUG
 
 /*
@@ -623,13 +631,12 @@ enum cs_log_level cs_log_threshold WEAK =
     LL_ERROR;
 #endif
 
+#if CS_ENABLE_STDIO
 static char *s_filter_pattern = NULL;
 static size_t s_filter_pattern_len;
 
 void cs_log_set_filter(const char *pattern) WEAK;
 
-#if CS_ENABLE_STDIO
-
 FILE *cs_log_file WEAK = NULL;
 
 #if CS_LOG_ENABLE_TS_DIFF
@@ -3729,7 +3736,9 @@ static int mg_accept_conn(struct mg_connection *lc) {
   /* NOTE(lsm): on Windows, sock is always > FD_SETSIZE */
   sock_t sock = accept(lc->sock, &sa.sa, &sa_len);
   if (sock == INVALID_SOCKET) {
-    if (mg_is_error()) DBG(("%p: failed to accept: %d", lc, mg_get_errno()));
+    if (mg_is_error()) {
+      DBG(("%p: failed to accept: %d", lc, mg_get_errno()));
+    }
     return 0;
   }
   nc = mg_if_accept_new_conn(lc);
@@ -4837,6 +4846,7 @@ static void mg_ssl_mbed_log(void *ctx, int level, const char *file, int line,
   LOG(cs_level, ("%p %.*s", ctx, (int) (strlen(str) - 1), str));
   (void) file;
   (void) line;
+  (void) cs_level;
 }
 
 struct mg_ssl_if_ctx {
@@ -15299,6 +15309,8 @@ static void mg_lwip_tcp_write_tcpip(void *arg) {
     return;
   }
   ctx->ret = len;
+  (void) unsent;
+  (void) unacked;
 }
 
 int mg_lwip_if_tcp_send(struct mg_connection *nc, const void *buf, size_t len) {
diff --git a/src/common/cs_dbg.c b/src/common/cs_dbg.c
index 62a5816db5d576455a2f4c6624310dbc86d22d9a..594aa153ccf02053e5be68ace98ff648338cc8ae 100644
--- a/src/common/cs_dbg.c
+++ b/src/common/cs_dbg.c
@@ -31,13 +31,12 @@ enum cs_log_level cs_log_threshold WEAK =
     LL_ERROR;
 #endif
 
+#if CS_ENABLE_STDIO
 static char *s_filter_pattern = NULL;
 static size_t s_filter_pattern_len;
 
 void cs_log_set_filter(const char *pattern) WEAK;
 
-#if CS_ENABLE_STDIO
-
 FILE *cs_log_file WEAK = NULL;
 
 #if CS_LOG_ENABLE_TS_DIFF
diff --git a/src/common/cs_dbg.h b/src/common/cs_dbg.h
index 9e0608ef3e32b30d43ed98e5df69e488cfaa9759..5b9777c103a89adeeaa14c0c194ea49d433cbeca 100644
--- a/src/common/cs_dbg.h
+++ b/src/common/cs_dbg.h
@@ -117,6 +117,8 @@ void cs_log_set_file(FILE *file);
  */
 void cs_log_printf(const char *fmt, ...) PRINTF_LIKE(1, 2);
 
+#if CS_ENABLE_STDIO
+
 /*
  * Format and print message `x` with the given level `l`. Example:
  *
@@ -130,6 +132,12 @@ void cs_log_printf(const char *fmt, ...) PRINTF_LIKE(1, 2);
     if (cs_log_print_prefix(l, __func__, __FILE__)) cs_log_printf x; \
   } while (0)
 
+#else
+
+#define LOG(l, x) ((void) l)
+
+#endif
+
 #ifndef CS_NDEBUG
 
 /*
diff --git a/src/common/platforms/lwip/mg_lwip_net_if.c b/src/common/platforms/lwip/mg_lwip_net_if.c
index 2090fca35576a74bf5d0e511c7e342e02d8dd85e..c6cbf492b3f39387672e686a03c836e19a319262 100644
--- a/src/common/platforms/lwip/mg_lwip_net_if.c
+++ b/src/common/platforms/lwip/mg_lwip_net_if.c
@@ -501,6 +501,8 @@ static void mg_lwip_tcp_write_tcpip(void *arg) {
     return;
   }
   ctx->ret = len;
+  (void) unsent;
+  (void) unacked;
 }
 
 int mg_lwip_if_tcp_send(struct mg_connection *nc, const void *buf, size_t len) {
diff --git a/src/mg_net_if_socket.c b/src/mg_net_if_socket.c
index c713e8458063e2c96af85a643549f030b978da3b..607e2b53977ded3cc0717ec101aa00dfe01e1b97 100644
--- a/src/mg_net_if_socket.c
+++ b/src/mg_net_if_socket.c
@@ -146,7 +146,9 @@ static int mg_accept_conn(struct mg_connection *lc) {
   /* NOTE(lsm): on Windows, sock is always > FD_SETSIZE */
   sock_t sock = accept(lc->sock, &sa.sa, &sa_len);
   if (sock == INVALID_SOCKET) {
-    if (mg_is_error()) DBG(("%p: failed to accept: %d", lc, mg_get_errno()));
+    if (mg_is_error()) {
+      DBG(("%p: failed to accept: %d", lc, mg_get_errno()));
+    }
     return 0;
   }
   nc = mg_if_accept_new_conn(lc);
diff --git a/src/mg_ssl_if_mbedtls.c b/src/mg_ssl_if_mbedtls.c
index 38ba1869ba95837de9c326ddfd7ff1e9a9bb899e..021addcf48068ce731e118371497176423ee4e13 100644
--- a/src/mg_ssl_if_mbedtls.c
+++ b/src/mg_ssl_if_mbedtls.c
@@ -34,6 +34,7 @@ static void mg_ssl_mbed_log(void *ctx, int level, const char *file, int line,
   LOG(cs_level, ("%p %.*s", ctx, (int) (strlen(str) - 1), str));
   (void) file;
   (void) line;
+  (void) cs_level;
 }
 
 struct mg_ssl_if_ctx {