Skip to content

Commit e67b12e

Browse files
fabiobaltiericfriedt
authored andcommitted
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 <[email protected]>
1 parent aa44166 commit e67b12e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/posix/fnmatch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include <string.h>
4545

4646
#include <zephyr/posix/fnmatch.h>
47+
#include <zephyr/toolchain.h>
4748

4849
#define EOS '\0'
4950

@@ -243,7 +244,7 @@ static int fnmatchx(const char *pattern, const char *string, int flags, size_t r
243244
--pattern;
244245
}
245246
}
246-
/* FALLTHROUGH */
247+
__fallthrough;
247248
default:
248249
if (c != FOLDCASE(*string++, flags)) {
249250
return FNM_NOMATCH;
@@ -252,7 +253,6 @@ static int fnmatchx(const char *pattern, const char *string, int flags, size_t r
252253
break;
253254
}
254255
}
255-
/* NOTREACHED */
256256
}
257257

258258
int fnmatch(const char *pattern, const char *string, int flags)

0 commit comments

Comments
 (0)