On Thu, May 15, 2025 at 06:05:01PM +0200, Stefano Brivio wrote: > 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 Hm. Alternatively you could change this to call abort_with_msg() directly. That's marked as ((noreturn)) so with any luck cppcheck will then be able to figure out what's going on. Although, I'm slightly surprised it can't do so already: I thought I put the ((noreturn)) in there to avoid warnings exactly like this. > --- > 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 */ > } > > /** -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson