From 515b5ee53aac7b04254b5072ab624def58dac0d8 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 15 May 2025 18:05:01 +0200 Subject: tap: Avoid bogus missingReturn cppcheck warning in tap_l2_max_len() Cppcheck 2.14.2 on Alpine Linux (musl) says that: tap.c:111:19: error: Found an exit path from function with non-void return type that has missing return statement [missingReturn] switch (c->mode) { ^ This exit path is not reachable because we ASSERT(0) after the switch, but for some reason cppcheck doesn't see this with musl headers. Hide the warning with a redundant return statement. Signed-off-by: Stefano Brivio --- tap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tap.c b/tap.c index d630f6d..6db5d88 100644 --- a/tap.c +++ b/tap.c @@ -118,6 +118,8 @@ unsigned long tap_l2_max_len(const struct ctx *c) } /* NOLINTEND(bugprone-branch-clone) */ ASSERT(0); + + return 0; /* Unreachable, for cppcheck's sake */ } /** -- cgit v1.2.3