From 73b29119f4eef465681476396ab99f06c5d9cb7b Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Thu, 28 Dec 2023 21:51:30 +0000 Subject: [PATCH] lib: posix: tag the fallthrough case as __fallthrough Use the __fallthrough directive on the switch fallthrough case and drop the comment instead. This informs the compiler that the fallthrough is intentional and silence any possible warning about it. Drop the not reached case as I think that that part can actually be reached since there are breaks in some of the cases. Signed-off-by: Fabio Baltieri --- lib/posix/fnmatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/posix/fnmatch.c b/lib/posix/fnmatch.c index 338891fd9b37..b52858513598 100644 --- a/lib/posix/fnmatch.c +++ b/lib/posix/fnmatch.c @@ -44,6 +44,7 @@ #include #include +#include #define EOS '\0' @@ -243,7 +244,7 @@ static int fnmatchx(const char *pattern, const char *string, int flags, size_t r --pattern; } } - /* FALLTHROUGH */ + __fallthrough; default: if (c != FOLDCASE(*string++, flags)) { return FNM_NOMATCH; @@ -252,7 +253,6 @@ static int fnmatchx(const char *pattern, const char *string, int flags, size_t r break; } } - /* NOTREACHED */ } int fnmatch(const char *pattern, const char *string, int flags)