From d160a78eccb582338ba47fc36e4d7ed11c9ddec0 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 6 Dec 2023 13:48:27 +0100 Subject: [PATCH] sys/net/gnrc_sock: assume timeout is feasible When not implementing the timeout feature, add an `assume()` that there is no timeout. Otherwise things break at runtime and are hard to debug. --- sys/net/gnrc/sock/gnrc_sock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/net/gnrc/sock/gnrc_sock.c b/sys/net/gnrc/sock/gnrc_sock.c index 3fb8a8dab2a8..28d579fa95c9 100644 --- a/sys/net/gnrc/sock/gnrc_sock.c +++ b/sys/net/gnrc/sock/gnrc_sock.c @@ -17,13 +17,14 @@ #include #include +#include "compiler_hints.h" #include "log.h" #include "net/af.h" -#include "net/ipv6/hdr.h" #include "net/gnrc/ipv6.h" #include "net/gnrc/ipv6/hdr.h" #include "net/gnrc/netreg.h" #include "net/gnrc/tx_sync.h" +#include "net/ipv6/hdr.h" #include "net/udp.h" #include "utlist.h" #if IS_USED(MODULE_ZTIMER_USEC) @@ -140,6 +141,8 @@ ssize_t gnrc_sock_recv(gnrc_sock_reg_t *reg, gnrc_pktsnip_t **pkt_out, timeout_timer.arg = reg; xtimer_set(&timeout_timer, timeout); } +#else + assume((timeout == SOCK_NO_TIMEOUT) || (timeout == 0)); #endif if (timeout != 0) { #if defined(DEVELHELP) && IS_ACTIVE(SOCK_HAS_ASYNC)