aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2025-05-15 18:05:01 +0200
committerStefano Brivio <sbrivio@redhat.com>2025-06-04 12:32:04 +0200
commit515b5ee53aac7b04254b5072ab624def58dac0d8 (patch)
treeb97e05578adf52d7a2fb76d1b979711fa6867087
parente019323538699967c155c29411545223dadfc0f5 (diff)
downloadpasst-515b5ee53aac7b04254b5072ab624def58dac0d8.tar
passt-515b5ee53aac7b04254b5072ab624def58dac0d8.tar.gz
passt-515b5ee53aac7b04254b5072ab624def58dac0d8.tar.bz2
passt-515b5ee53aac7b04254b5072ab624def58dac0d8.tar.lz
passt-515b5ee53aac7b04254b5072ab624def58dac0d8.tar.xz
passt-515b5ee53aac7b04254b5072ab624def58dac0d8.tar.zst
passt-515b5ee53aac7b04254b5072ab624def58dac0d8.zip
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 <sbrivio@redhat.com>
-rw-r--r--tap.c2
1 files changed, 2 insertions, 0 deletions
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 */
}
/**