From 921fdd097537937016aee7e92979acb322d3b06e Mon Sep 17 00:00:00 2001 From: Vitor Batista Date: Wed, 8 Dec 2021 17:09:17 +0100 Subject: [PATCH 1/9] core/include/debug.h: minor debug fix --- core/include/debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/include/debug.h b/core/include/debug.h index 9a718ef8db..4d93e3eee6 100644 --- a/core/include/debug.h +++ b/core/include/debug.h @@ -94,7 +94,7 @@ extern "C" { * * @note Another name for ::DEBUG_PRINT */ -#define DEBUG(...) if (ENABLE_DEBUG) { DEBUG_PRINT(__VA_ARGS__); } +#define DEBUG(...) do { if (ENABLE_DEBUG) { DEBUG_PRINT(__VA_ARGS__); } } while (0) /** * @def DEBUG_PUTS @@ -102,7 +102,7 @@ extern "C" { * @brief Print debug information to stdout using puts(), so no stack size * restrictions do apply. */ -#define DEBUG_PUTS(str) if (ENABLE_DEBUG) { puts(str); } +#define DEBUG_PUTS(str) do { if (ENABLE_DEBUG) { puts(str); } } while (0) /** @} */ /** From 39e6e19c9c8fe5dd266aeb586b4f449da8d25e33 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 8 Dec 2021 18:28:49 +0100 Subject: [PATCH 2/9] drivers/nrf802154: add ; after DEBUG() --- cpu/nrf52/radio/nrf802154/nrf802154_radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/nrf52/radio/nrf802154/nrf802154_radio.c b/cpu/nrf52/radio/nrf802154/nrf802154_radio.c index d957da3e4e..559c4079ba 100644 --- a/cpu/nrf52/radio/nrf802154/nrf802154_radio.c +++ b/cpu/nrf52/radio/nrf802154/nrf802154_radio.c @@ -573,7 +573,7 @@ void isr_radio(void) * ID 204, "Switching between TX and RX causes unwanted emissions") */ _disable(); - DEBUG("[nrf52840] TX ACK done.") + DEBUG("[nrf52840] TX ACK done."); _set_ifs_timer(false); break; default: From 55454e93015c962779fffd771fef9feae2147acf Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 8 Dec 2021 18:30:24 +0100 Subject: [PATCH 3/9] cpu/gd32v: timer: add ; after DEBUG() --- cpu/gd32v/periph/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/gd32v/periph/timer.c b/cpu/gd32v/periph/timer.c index 21efb89d8c..3a60082291 100644 --- a/cpu/gd32v/periph/timer.c +++ b/cpu/gd32v/periph/timer.c @@ -119,7 +119,7 @@ int timer_init(tim_t tim, unsigned long freq, timer_cb_t cb, void *arg) /* set prescaler */ dev(tim)->PSC = (((periph_apb_clk(timer_config[tim].bus) * 2) / freq) - 1); DEBUG("[timer]: %" PRIu32 "/%lu = %" PRIu16 "\n", - periph_apb_clk(timer_config[tim].bus), freq, dev(tim)->PSC) + periph_apb_clk(timer_config[tim].bus), freq, dev(tim)->PSC); /* generate an update event to apply our configuration */ dev(tim)->SWEVG = TIMER0_SWEVG_UPG_Msk; From 8c5b898ed487a19a31f94097d8f27baecaa712a4 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 8 Dec 2021 18:30:43 +0100 Subject: [PATCH 4/9] drivers/mtd_spi_nor: add ; after DEBUG() --- drivers/mtd_spi_nor/mtd_spi_nor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd_spi_nor/mtd_spi_nor.c b/drivers/mtd_spi_nor/mtd_spi_nor.c index 5266a63487..a444275bc6 100644 --- a/drivers/mtd_spi_nor/mtd_spi_nor.c +++ b/drivers/mtd_spi_nor/mtd_spi_nor.c @@ -257,7 +257,7 @@ static int mtd_spi_read_jedec_id(const mtd_spi_nor_t *dev, mtd_jedec_id_t *out) uint8_t bank = 0; while (buffer[bank] == JEDEC_NEXT_BANK) { if (++bank == JEDEC_BANK_MAX) { - DEBUG_PUTS("mtd_spi_read_jedec_id: bank out of bounds\n") + DEBUG_PUTS("mtd_spi_read_jedec_id: bank out of bounds\n"); return -1; } } From 1db8ab4f72e40775926bf41820b425117f1261fa Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 8 Dec 2021 20:41:21 +0100 Subject: [PATCH 5/9] sys/net/gcoap: add ; after DEBUG() --- sys/net/application_layer/gcoap/gcoap.c | 4 ++-- sys/net/dsm/dsm.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/net/application_layer/gcoap/gcoap.c b/sys/net/application_layer/gcoap/gcoap.c index 445415bf4d..54252b6614 100644 --- a/sys/net/application_layer/gcoap/gcoap.c +++ b/sys/net/application_layer/gcoap/gcoap.c @@ -206,7 +206,7 @@ static void _on_sock_dtls_evt(sock_dtls_t *sock, sock_async_flags_t type, void * } else if (prev_state == NO_SPACE) { /* No space in session management. Should not happen. If it occurs, we lost track of sessions */ - DEBUG("gcoap: no space in session management. We lost track of sessions!") + DEBUG("gcoap: no space in session management. We lost track of sessions!"); sock_dtls_session_destroy(sock, &socket.ctx_dtls_session); } @@ -993,7 +993,7 @@ static ssize_t _tl_authenticate(gcoap_socket_t *sock, const sock_udp_ep_t *remot return 0; } if (session_state == NO_SPACE) { - DEBUG("gcoap: no space in dsm\n") + DEBUG("gcoap: no space in dsm\n"); return -ENOTCONN; } diff --git a/sys/net/dsm/dsm.c b/sys/net/dsm/dsm.c index 62f6ed1d24..832011d4e6 100644 --- a/sys/net/dsm/dsm.c +++ b/sys/net/dsm/dsm.c @@ -67,7 +67,7 @@ dsm_state_t dsm_store(sock_dtls_t *sock, sock_dtls_session_t *session, /* no existing session found */ if (res == 0) { - DEBUG("dsm: no existing session found, storing as new session\n") + DEBUG("dsm: no existing session found, storing as new session\n"); sock_dtls_session_get_udp_ep(session, &ep); sock_dtls_session_set_udp_ep(&session_slot->session, &ep); session_slot->sock = sock; @@ -76,7 +76,7 @@ dsm_state_t dsm_store(sock_dtls_t *sock, sock_dtls_session_t *session, /* existing session found and session should be restored */ if (res == 1 && restore) { - DEBUG("dsm: existing session found, restoring\n") + DEBUG("dsm: existing session found, restoring\n"); memcpy(session, &session_slot->session, sizeof(sock_dtls_session_t)); } session_slot->last_used_sec = (uint32_t)(xtimer_now_usec64() / US_PER_SEC); From cbc8251874d0763794424e20ee7cade0b92911bf Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 8 Dec 2021 21:09:31 +0100 Subject: [PATCH 6/9] gnrc_tcp: add ; after DEBUG() --- sys/net/gnrc/transport_layer/tcp/gnrc_tcp.c | 6 +++--- sys/net/gnrc/transport_layer/tcp/gnrc_tcp_fsm.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/net/gnrc/transport_layer/tcp/gnrc_tcp.c b/sys/net/gnrc/transport_layer/tcp/gnrc_tcp.c index 3f354bbdf6..10ca274cc7 100644 --- a/sys/net/gnrc/transport_layer/tcp/gnrc_tcp.c +++ b/sys/net/gnrc/transport_layer/tcp/gnrc_tcp.c @@ -141,7 +141,7 @@ int gnrc_tcp_ep_init(gnrc_tcp_ep_t *ep, int family, const uint8_t *addr, size_t TCP_DEBUG_ENTER; #ifdef MODULE_GNRC_IPV6 if (family != AF_INET6) { - TCP_DEBUG_ERROR("-EAFNOSUPPORT: Parameter family is not AF_INET6.") + TCP_DEBUG_ERROR("-EAFNOSUPPORT: Parameter family is not AF_INET6."); TCP_DEBUG_LEAVE; return -EAFNOSUPPORT; } @@ -153,7 +153,7 @@ int gnrc_tcp_ep_init(gnrc_tcp_ep_t *ep, int family, const uint8_t *addr, size_t memcpy(ep->addr.ipv6, addr, sizeof(ipv6_addr_t)); } else { - TCP_DEBUG_ERROR("-EINVAL: Parameter addr is invalid.") + TCP_DEBUG_ERROR("-EINVAL: Parameter addr is invalid."); TCP_DEBUG_LEAVE; return -EINVAL; } @@ -161,7 +161,7 @@ int gnrc_tcp_ep_init(gnrc_tcp_ep_t *ep, int family, const uint8_t *addr, size_t /* Suppress Compiler Warnings */ (void) addr; (void) addr_size; - TCP_DEBUG_ERROR("-EAFNOSUPPORT: No network layer configured.") + TCP_DEBUG_ERROR("-EAFNOSUPPORT: No network layer configured."); TCP_DEBUG_LEAVE; return -EAFNOSUPPORT; #endif diff --git a/sys/net/gnrc/transport_layer/tcp/gnrc_tcp_fsm.c b/sys/net/gnrc/transport_layer/tcp/gnrc_tcp_fsm.c index 6e9994e8fc..ee1f3c04a1 100644 --- a/sys/net/gnrc/transport_layer/tcp/gnrc_tcp_fsm.c +++ b/sys/net/gnrc/transport_layer/tcp/gnrc_tcp_fsm.c @@ -208,7 +208,7 @@ static int _transition_to(gnrc_tcp_tcb_t *tcb, _gnrc_tcp_fsm_state_t state) /* Check if given port number is in use: return error */ if (_is_local_port_in_use(tcb->local_port)) { mutex_unlock(&list->lock); - TCP_DEBUG_ERROR("-EADDRINUSE: Port already used.") + TCP_DEBUG_ERROR("-EADDRINUSE: Port already used."); TCP_DEBUG_LEAVE; return -EADDRINUSE; } From 75a689248023ecf7fc5197c09b4d4c2b9b11cb7e Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 8 Dec 2021 21:47:29 +0100 Subject: [PATCH 7/9] drivers/stmpe811: add ; after DEBUG() --- drivers/stmpe811/stmpe811_touch_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/stmpe811/stmpe811_touch_dev.c b/drivers/stmpe811/stmpe811_touch_dev.c index 1e4ee268f9..e25bb93ca5 100644 --- a/drivers/stmpe811/stmpe811_touch_dev.c +++ b/drivers/stmpe811/stmpe811_touch_dev.c @@ -66,7 +66,7 @@ uint8_t _stmpe811_touches(const touch_dev_t *touch_dev, touch_t *touches, size_t touches[0].x = pos.y; touches[0].y = dev->params.xmax - pos.x; - DEBUG("X: %i, Y: %i\n", touches[0].x, touches[0].y) + DEBUG("X: %i, Y: %i\n", touches[0].x, touches[0].y); } return ret; From 4b9bdc61b27b0e7b80bff7cd920e42fe9537c595 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 9 Dec 2021 10:14:07 +0100 Subject: [PATCH 8/9] gnrc_netif/lorawan: add ; after DEBUG() --- sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c b/sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c index ae3d3445a5..17cca566a7 100644 --- a/sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c +++ b/sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c @@ -141,7 +141,7 @@ void gnrc_lorawan_mcps_indication(gnrc_lorawan_t *mac, mcps_indication_t *ind) } if (!gnrc_netapi_dispatch_receive(nettype, demux, pkt)) { - DEBUG("gnrc_lorawan_netif: unable to forward packet\n") + DEBUG("gnrc_lorawan_netif: unable to forward packet\n"); goto release; } From 624fd7672fd60fae2bc87fc576c6d4aea6853815 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 9 Dec 2021 11:20:44 +0100 Subject: [PATCH 9/9] ut_process: add ; after DEBUG() --- sys/ut_process/ut_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/ut_process/ut_process.c b/sys/ut_process/ut_process.c index 6f0542e28c..ad44598df9 100644 --- a/sys/ut_process/ut_process.c +++ b/sys/ut_process/ut_process.c @@ -306,7 +306,7 @@ static int _set_var(const char *var, size_t var_len, char prefix = '\0', sep = '\0'; if ((var == NULL) || (var_len == 0)) { - DEBUG("ut_process: zero-length variable found\n") + DEBUG("ut_process: zero-length variable found\n"); return -EINVAL; } value = _find_var(var, var_len, vars, vars_len);