From 32db86d558193ad4ad5a00926ce3c350c89eb8df Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 12 Feb 2019 10:30:34 +0000 Subject: Add fall-through comments. This patch adds fall-through comments in some cases where -Wextra produces implicit-fallthrough warnings. The patch is non-exhaustive. Apart from architecture-specific code for non-x86_64 architectures, it does not change sunrpc/xdr.c (legacy code, probably should have such changes, but left to be dealt with separately), or places that already had comments about the fall-through but not matching the form expected by -Wimplicit-fallthrough=3 (the default level with -Wextra; my inclination is to adjust those comments to match rather than downgrading to -Wimplicit-fallthrough=1 to allow any comment), or one place where I thought the implicit fallthrough was not correct and so should be handled separately as a bug fix. I think the key thing to consider in review of this patch is whether the fall-through is indeed intended and correct in each place where such a comment is added. Tested for x86_64. * elf/dl-exception.c (_dl_exception_create_format): Add fall-through comments. * elf/ldconfig.c (parse_conf_include): Likewise. * elf/rtld.c (print_statistics): Likewise. * locale/programs/charmap.c (parse_charmap): Likewise. * misc/mntent_r.c (__getmntent_r): Likewise. * posix/wordexp.c (parse_arith): Likewise. (parse_backtick): Likewise. * resolv/ns_ttl.c (ns_parse_ttl): Likewise. * sysdeps/x86/cpu-features.c (init_cpu_features): Likewise. * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise. --- posix/wordexp.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'posix') diff --git a/posix/wordexp.c b/posix/wordexp.c index 825ad97fbf..248de77fba 100644 --- a/posix/wordexp.c +++ b/posix/wordexp.c @@ -799,6 +799,7 @@ parse_arith (char **word, size_t *word_length, size_t *max_length, case '(': ++paren_depth; + /* Fall through. */ default: expr = w_addchar (expr, &expr_length, &expr_maxlen, words[*offset]); if (expr == NULL) @@ -2127,6 +2128,7 @@ parse_backtick (char **word, size_t *word_length, size_t *max_length, case '\'': squoting = 1 - squoting; + /* Fall through. */ default: comm = w_addchar (comm, &comm_length, &comm_maxlen, words[*offset]); if (comm == NULL) -- cgit v1.2.3