|
|
e354a5 |
commit 32db86d558193ad4ad5a00926ce3c350c89eb8df
|
|
|
e354a5 |
Author: Joseph Myers <joseph@codesourcery.com>
|
|
|
e354a5 |
Date: Tue Feb 12 10:30:34 2019 +0000
|
|
|
e354a5 |
|
|
|
e354a5 |
Add fall-through comments.
|
|
|
e354a5 |
|
|
|
e354a5 |
This patch adds fall-through comments in some cases where -Wextra
|
|
|
e354a5 |
produces implicit-fallthrough warnings.
|
|
|
e354a5 |
|
|
|
e354a5 |
The patch is non-exhaustive. Apart from architecture-specific code
|
|
|
e354a5 |
for non-x86_64 architectures, it does not change sunrpc/xdr.c (legacy
|
|
|
e354a5 |
code, probably should have such changes, but left to be dealt with
|
|
|
e354a5 |
separately), or places that already had comments about the
|
|
|
e354a5 |
fall-through but not matching the form expected by
|
|
|
e354a5 |
-Wimplicit-fallthrough=3 (the default level with -Wextra; my
|
|
|
e354a5 |
inclination is to adjust those comments to match rather than
|
|
|
e354a5 |
downgrading to -Wimplicit-fallthrough=1 to allow any comment), or one
|
|
|
e354a5 |
place where I thought the implicit fallthrough was not correct and so
|
|
|
e354a5 |
should be handled separately as a bug fix. I think the key thing to
|
|
|
e354a5 |
consider in review of this patch is whether the fall-through is indeed
|
|
|
e354a5 |
intended and correct in each place where such a comment is added.
|
|
|
e354a5 |
|
|
|
e354a5 |
Tested for x86_64.
|
|
|
e354a5 |
|
|
|
e354a5 |
* elf/dl-exception.c (_dl_exception_create_format): Add
|
|
|
e354a5 |
fall-through comments.
|
|
|
e354a5 |
* elf/ldconfig.c (parse_conf_include): Likewise.
|
|
|
e354a5 |
* elf/rtld.c (print_statistics): Likewise.
|
|
|
e354a5 |
* locale/programs/charmap.c (parse_charmap): Likewise.
|
|
|
e354a5 |
* misc/mntent_r.c (__getmntent_r): Likewise.
|
|
|
e354a5 |
* posix/wordexp.c (parse_arith): Likewise.
|
|
|
e354a5 |
(parse_backtick): Likewise.
|
|
|
e354a5 |
* resolv/ns_ttl.c (ns_parse_ttl): Likewise.
|
|
|
e354a5 |
* sysdeps/x86/cpu-features.c (init_cpu_features): Likewise.
|
|
|
e354a5 |
* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise.
|
|
|
e354a5 |
|
|
|
e354a5 |
diff --git a/elf/dl-exception.c b/elf/dl-exception.c
|
|
|
e354a5 |
index 3e8e0ba3f1442005..d24bf30a5cf39bc2 100644
|
|
|
e354a5 |
--- a/elf/dl-exception.c
|
|
|
e354a5 |
+++ b/elf/dl-exception.c
|
|
|
e354a5 |
@@ -123,6 +123,7 @@ _dl_exception_create_format (struct dl_exception *exception, const char *objname
|
|
|
e354a5 |
++p;
|
|
|
e354a5 |
break;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case 'x':
|
|
|
e354a5 |
length += INT_WIDTH / 4;
|
|
|
e354a5 |
break;
|
|
|
e354a5 |
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
|
|
|
e354a5 |
index fbdd814edf59bc77..ed7d9ab0412d93fd 100644
|
|
|
e354a5 |
--- a/elf/ldconfig.c
|
|
|
e354a5 |
+++ b/elf/ldconfig.c
|
|
|
e354a5 |
@@ -1228,6 +1228,7 @@ parse_conf_include (const char *config_file, unsigned int lineno,
|
|
|
e354a5 |
|
|
|
e354a5 |
case GLOB_NOSPACE:
|
|
|
e354a5 |
errno = ENOMEM;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case GLOB_ABORTED:
|
|
|
e354a5 |
if (opt_verbose)
|
|
|
e354a5 |
error (0, errno, _("%s:%u: cannot read directory %s"),
|
|
|
e354a5 |
diff --git a/elf/rtld.c b/elf/rtld.c
|
|
|
e354a5 |
index 7f030f75a22c532e..8bb5f548a0ff8eb4 100644
|
|
|
e354a5 |
--- a/elf/rtld.c
|
|
|
e354a5 |
+++ b/elf/rtld.c
|
|
|
e354a5 |
@@ -2734,8 +2734,10 @@ print_statistics (hp_timing_t *rtld_total_timep)
|
|
|
e354a5 |
{
|
|
|
e354a5 |
case 3:
|
|
|
e354a5 |
*wp++ = *cp++;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case 2:
|
|
|
e354a5 |
*wp++ = *cp++;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case 1:
|
|
|
e354a5 |
*wp++ = '.';
|
|
|
e354a5 |
*wp++ = *cp++;
|
|
|
e354a5 |
@@ -2797,8 +2799,10 @@ print_statistics (hp_timing_t *rtld_total_timep)
|
|
|
e354a5 |
{
|
|
|
e354a5 |
case 3:
|
|
|
e354a5 |
*wp++ = *cp++;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case 2:
|
|
|
e354a5 |
*wp++ = *cp++;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case 1:
|
|
|
e354a5 |
*wp++ = '.';
|
|
|
e354a5 |
*wp++ = *cp++;
|
|
|
e354a5 |
diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c
|
|
|
e354a5 |
index 2d54dd3c027d11d2..8041a0e5d292f3f5 100644
|
|
|
e354a5 |
--- a/locale/programs/charmap.c
|
|
|
e354a5 |
+++ b/locale/programs/charmap.c
|
|
|
e354a5 |
@@ -713,6 +713,7 @@ only WIDTH definitions are allowed to follow the CHARMAP definition"));
|
|
|
e354a5 |
state = 95;
|
|
|
e354a5 |
continue;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
|
|
|
e354a5 |
case 96:
|
|
|
e354a5 |
if (nowtok != tok_number)
|
|
|
e354a5 |
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
|
|
|
e354a5 |
index 7bb224f044150ab4..add39d4537eaccb5 100644
|
|
|
e354a5 |
--- a/misc/mntent_r.c
|
|
|
e354a5 |
+++ b/misc/mntent_r.c
|
|
|
e354a5 |
@@ -167,8 +167,10 @@ get_mnt_entry (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
|
|
|
e354a5 |
{
|
|
|
e354a5 |
case 0:
|
|
|
e354a5 |
mp->mnt_freq = 0;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case 1:
|
|
|
e354a5 |
mp->mnt_passno = 0;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case 2:
|
|
|
e354a5 |
break;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
diff --git a/posix/wordexp.c b/posix/wordexp.c
|
|
|
e354a5 |
index 7548e0329fdeafaa..048a8068544c81fa 100644
|
|
|
e354a5 |
--- a/posix/wordexp.c
|
|
|
e354a5 |
+++ b/posix/wordexp.c
|
|
|
e354a5 |
@@ -799,6 +799,7 @@ parse_arith (char **word, size_t *word_length, size_t *max_length,
|
|
|
e354a5 |
|
|
|
e354a5 |
case '(':
|
|
|
e354a5 |
++paren_depth;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
default:
|
|
|
e354a5 |
expr = w_addchar (expr, &expr_length, &expr_maxlen, words[*offset]);
|
|
|
e354a5 |
if (expr == NULL)
|
|
|
e354a5 |
@@ -2127,6 +2128,7 @@ parse_backtick (char **word, size_t *word_length, size_t *max_length,
|
|
|
e354a5 |
|
|
|
e354a5 |
case '\'':
|
|
|
e354a5 |
squoting = 1 - squoting;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
default:
|
|
|
e354a5 |
comm = w_addchar (comm, &comm_length, &comm_maxlen, words[*offset]);
|
|
|
e354a5 |
if (comm == NULL)
|
|
|
e354a5 |
diff --git a/resolv/ns_ttl.c b/resolv/ns_ttl.c
|
|
|
e354a5 |
index 079948790b94b05e..d29d9dc00cfcab2c 100644
|
|
|
e354a5 |
--- a/resolv/ns_ttl.c
|
|
|
e354a5 |
+++ b/resolv/ns_ttl.c
|
|
|
e354a5 |
@@ -113,9 +113,13 @@ ns_parse_ttl(const char *src, u_long *dst) {
|
|
|
e354a5 |
ch = toupper(ch);
|
|
|
e354a5 |
switch (ch) {
|
|
|
e354a5 |
case 'W': tmp *= 7;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case 'D': tmp *= 24;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case 'H': tmp *= 60;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case 'M': tmp *= 60;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case 'S': break;
|
|
|
e354a5 |
default: goto einval;
|
|
|
e354a5 |
}
|
|
|
e354a5 |
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
|
|
|
e354a5 |
index 3a02a9c7d08f9603..ade37a9bb3de86cc 100644
|
|
|
e354a5 |
--- a/sysdeps/x86/cpu-features.c
|
|
|
e354a5 |
+++ b/sysdeps/x86/cpu-features.c
|
|
|
e354a5 |
@@ -374,6 +374,7 @@ init_cpu_features (struct cpu_features *cpu_features)
|
|
|
e354a5 |
of Core i3/i5/i7 processors if AVX is available. */
|
|
|
e354a5 |
if (!CPU_FEATURES_CPU_P (cpu_features, AVX))
|
|
|
e354a5 |
break;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
|
|
|
e354a5 |
case 0x1a:
|
|
|
e354a5 |
case 0x1e:
|
|
|
e354a5 |
@@ -401,6 +402,7 @@ init_cpu_features (struct cpu_features *cpu_features)
|
|
|
e354a5 |
/* Xeon E7 v3 with stepping >= 4 has working TSX. */
|
|
|
e354a5 |
if (stepping >= 4)
|
|
|
e354a5 |
break;
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case 0x3c:
|
|
|
e354a5 |
case 0x45:
|
|
|
e354a5 |
case 0x46:
|
|
|
e354a5 |
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
|
|
|
e354a5 |
index 1942ed5061d18c68..23afb3c05dbe17d6 100644
|
|
|
e354a5 |
--- a/sysdeps/x86_64/dl-machine.h
|
|
|
e354a5 |
+++ b/sysdeps/x86_64/dl-machine.h
|
|
|
e354a5 |
@@ -347,6 +347,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
|
|
|
e354a5 |
/* Set to symbol size plus addend. */
|
|
|
e354a5 |
value = sym->st_size;
|
|
|
e354a5 |
# endif
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case R_X86_64_GLOB_DAT:
|
|
|
e354a5 |
case R_X86_64_JUMP_SLOT:
|
|
|
e354a5 |
*reloc_addr = value + reloc->r_addend;
|
|
|
e354a5 |
@@ -460,6 +461,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
|
|
|
e354a5 |
/* Set to symbol size plus addend. */
|
|
|
e354a5 |
value = sym->st_size;
|
|
|
e354a5 |
# endif
|
|
|
e354a5 |
+ /* Fall through. */
|
|
|
e354a5 |
case R_X86_64_32:
|
|
|
e354a5 |
value += reloc->r_addend;
|
|
|
e354a5 |
*(unsigned int *) reloc_addr = value;
|