Skip to content

Commit

Permalink
lib: posix: tag the fallthrough case as __fallthrough
Browse files Browse the repository at this point in the history
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 <fabiobaltieri@google.com>
  • Loading branch information
fabiobaltieri authored and cfriedt committed Dec 30, 2023
1 parent aa44166 commit e67b12e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/posix/fnmatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <string.h>

#include <zephyr/posix/fnmatch.h>
#include <zephyr/toolchain.h>

#define EOS '\0'

Expand Down Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit e67b12e

Please sign in to comment.