mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 09:37:22 +03: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:
parent
a8b578d538
commit
d01b425e5d
8 changed files with 68 additions and 44 deletions
|
|
@ -874,7 +874,7 @@ arena_decay_stashed(tsdn_t *tsdn, arena_t *arena,
|
|||
arena, is_background_thread);
|
||||
break;
|
||||
}
|
||||
/* Fall through. */
|
||||
JEMALLOC_FALLTHROUGH;
|
||||
case extent_state_muzzy:
|
||||
extent_dalloc_wrapper(tsdn, arena, r_extent_hooks,
|
||||
extent);
|
||||
|
|
|
|||
|
|
@ -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--;
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ tsd_cleanup(void *arg) {
|
|||
* is still called for testing and completeness.
|
||||
*/
|
||||
assert_tsd_data_cleanup_done(tsd);
|
||||
/* Fall through. */
|
||||
JEMALLOC_FALLTHROUGH;
|
||||
case tsd_state_nominal:
|
||||
case tsd_state_nominal_slow:
|
||||
tsd_do_data_cleanup(tsd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue