From 6cb2addb1e11c2059d61c0416392a22e25a8d478 Mon Sep 17 00:00:00 2001 From: Guancheng Wang <24189100307@stu.xidian.edu.cn> Date: Sat, 19 Sep 2026 05:10:54 +0800 Subject: [PATCH] block: compile full_match() only when client support is enabled With `-DENABLE_CLIENT_MODE=OFF` (i.e. `COAP_CLIENT_SUPPORT=0`), `full_match()` in `src/coap_block.c` is defined but its only caller is compiled out, producing `-Wunused-function` (fatal in -Werror builds): ``` src/coap_block.c:479:1: error: unused function 'full_match' [-Werror=-Wunused-function] ``` Wrap the static-inline definition in the same `#if COAP_CLIENT_SUPPORT` guard as its caller. Signed-off-by: warter666 <121139223+Warterkk@users.noreply.github.com> --- src/coap_block.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coap_block.c b/src/coap_block.c index edbea192..1f3ed9e1 100644 --- a/src/coap_block.c +++ b/src/coap_block.c @@ -475,11 +475,13 @@ coap_context_set_max_block_size_lkd(coap_context_t *context, size_t max_block_si return 1; } +#if COAP_CLIENT_SUPPORT COAP_STATIC_INLINE int full_match(const uint8_t *a, size_t alen, const uint8_t *b, size_t blen) { return alen == blen && (alen == 0 || memcmp(a, b, alen) == 0); } +#endif /* COAP_CLIENT_SUPPORT */ coap_lg_xmit_t * coap_find_lg_xmit(coap_session_t *session, coap_pdu_t *pdu) {