mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 13:13:06 +00:00
Add -Wimplicit-fallthrough checks if supported
Clang since r369414 (clang-10) can now check -Wimplicit-fallthrough for C code, and use the GNU C style attribute to denote fallthrough. Move the test from header only to autoconf. The previous test used brittle version detection which did not work for newer clang that supported this feature. The attribute has to be its own statement, hence the added `;`. It also can only precede case statements, so the final cases should be explicitly terminated with break statements. Fixes commit3d29d11ac2("Clean compilation -Wextra") Link:1e0affb6e5Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
This commit is contained in:
committed by
Qi Wang
parent
a8b578d538
commit
d01b425e5d
@@ -135,10 +135,10 @@ malloc_strtoumax(const char *restrict nptr, char **restrict endptr, int base) {
|
||||
break;
|
||||
case '-':
|
||||
neg = true;
|
||||
/* Fall through. */
|
||||
JEMALLOC_FALLTHROUGH;
|
||||
case '+':
|
||||
p++;
|
||||
/* Fall through. */
|
||||
JEMALLOC_FALLTHROUGH;
|
||||
default:
|
||||
goto label_prefix;
|
||||
}
|
||||
@@ -289,7 +289,7 @@ d2s(intmax_t x, char sign, char *s, size_t *slen_p) {
|
||||
if (!neg) {
|
||||
break;
|
||||
}
|
||||
/* Fall through. */
|
||||
JEMALLOC_FALLTHROUGH;
|
||||
case ' ':
|
||||
case '+':
|
||||
s--;
|
||||
|
||||
Reference in New Issue
Block a user