238 lines
7.1 KiB
Diff
238 lines
7.1 KiB
Diff
|
From d70d92889c4a8b0781207343a73b1dc4eccdffd3 Mon Sep 17 00:00:00 2001
|
||
|
From: Khem Raj <raj.khem@gmail.com>
|
||
|
Date: Tue, 25 Apr 2017 15:50:55 -0700
|
||
|
Subject: [PATCH 1/2] Fix fallthrough warnings
|
||
|
|
||
|
Upstream-Status: Pending
|
||
|
|
||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||
|
---
|
||
|
backends/i386_regs.c | 1 +
|
||
|
backends/i386_retval.c | 1 +
|
||
|
backends/linux-core-note.c | 4 ++--
|
||
|
backends/mips_retval.c | 2 +-
|
||
|
backends/parisc_retval.c | 2 +-
|
||
|
backends/ppc_regs.c | 2 +-
|
||
|
backends/x86_64_regs.c | 1 +
|
||
|
libcpu/i386_disasm.c | 2 +-
|
||
|
libdw/cfi.c | 3 +++
|
||
|
libdw/encoded-value.h | 1 +
|
||
|
libdwfl/dwfl_report_elf.c | 1 +
|
||
|
src/addr2line.c | 1 +
|
||
|
src/elflint.c | 4 +++-
|
||
|
src/objdump.c | 2 +-
|
||
|
14 files changed, 19 insertions(+), 8 deletions(-)
|
||
|
|
||
|
diff --git a/backends/i386_regs.c b/backends/i386_regs.c
|
||
|
index 5cf0d81..11b0bcb 100644
|
||
|
--- a/backends/i386_regs.c
|
||
|
+++ b/backends/i386_regs.c
|
||
|
@@ -89,6 +89,7 @@ i386_register_info (Ebl *ebl __attribute__ ((unused)),
|
||
|
case 5:
|
||
|
case 8:
|
||
|
*type = DW_ATE_address;
|
||
|
+ /* fallthru */
|
||
|
case 0 ... 3:
|
||
|
case 6 ... 7:
|
||
|
name[0] = 'e';
|
||
|
diff --git a/backends/i386_retval.c b/backends/i386_retval.c
|
||
|
index c3bab10..ffbf901 100644
|
||
|
--- a/backends/i386_retval.c
|
||
|
+++ b/backends/i386_retval.c
|
||
|
@@ -137,6 +137,7 @@ i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||
|
|
||
|
/* Else fall through. */
|
||
|
}
|
||
|
+ /* fallthru */
|
||
|
|
||
|
case DW_TAG_structure_type:
|
||
|
case DW_TAG_class_type:
|
||
|
diff --git a/backends/linux-core-note.c b/backends/linux-core-note.c
|
||
|
index 9d01219..a6cd5ab 100644
|
||
|
--- a/backends/linux-core-note.c
|
||
|
+++ b/backends/linux-core-note.c
|
||
|
@@ -194,8 +194,8 @@ EBLHOOK(core_note) (nhdr, name, regs_offset, nregloc, reglocs, nitems, items)
|
||
|
case sizeof "CORE":
|
||
|
if (memcmp (name, "CORE", nhdr->n_namesz) == 0)
|
||
|
break;
|
||
|
- /* Buggy old Linux kernels didn't terminate "LINUX".
|
||
|
- Fall through. */
|
||
|
+ /* Buggy old Linux kernels didn't terminate "LINUX". */
|
||
|
+ /* fallthru */
|
||
|
|
||
|
case sizeof "LINUX":
|
||
|
if (memcmp (name, "LINUX", nhdr->n_namesz) == 0)
|
||
|
diff --git a/backends/mips_retval.c b/backends/mips_retval.c
|
||
|
index 33f12a7..b25b1b7 100644
|
||
|
--- a/backends/mips_retval.c
|
||
|
+++ b/backends/mips_retval.c
|
||
|
@@ -300,7 +300,7 @@ mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||
|
|
||
|
/* Else fall through. Shouldn't happen though (at least with gcc) */
|
||
|
}
|
||
|
-
|
||
|
+ /* fallthrough */
|
||
|
case DW_TAG_structure_type:
|
||
|
case DW_TAG_class_type:
|
||
|
case DW_TAG_union_type:
|
||
|
diff --git a/backends/parisc_retval.c b/backends/parisc_retval.c
|
||
|
index 592a702..7aa5b17 100644
|
||
|
--- a/backends/parisc_retval.c
|
||
|
+++ b/backends/parisc_retval.c
|
||
|
@@ -167,7 +167,7 @@ parisc_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp, in
|
||
|
|
||
|
/* Else fall through. */
|
||
|
}
|
||
|
-
|
||
|
+ /* fallthru */
|
||
|
case DW_TAG_structure_type:
|
||
|
case DW_TAG_class_type:
|
||
|
case DW_TAG_union_type:
|
||
|
diff --git a/backends/ppc_regs.c b/backends/ppc_regs.c
|
||
|
index 637c25d..8277c54 100644
|
||
|
--- a/backends/ppc_regs.c
|
||
|
+++ b/backends/ppc_regs.c
|
||
|
@@ -137,7 +137,7 @@ ppc_register_info (Ebl *ebl __attribute__ ((unused)),
|
||
|
case 100:
|
||
|
if (*bits == 32)
|
||
|
return stpcpy (name, "mq") + 1 - name;
|
||
|
-
|
||
|
+ /* fallthru */
|
||
|
case 102 ... 107:
|
||
|
name[0] = 's';
|
||
|
name[1] = 'p';
|
||
|
diff --git a/backends/x86_64_regs.c b/backends/x86_64_regs.c
|
||
|
index 8eb0d33..e941cf3 100644
|
||
|
--- a/backends/x86_64_regs.c
|
||
|
+++ b/backends/x86_64_regs.c
|
||
|
@@ -84,6 +84,7 @@ x86_64_register_info (Ebl *ebl __attribute__ ((unused)),
|
||
|
|
||
|
case 6 ... 7:
|
||
|
*type = DW_ATE_address;
|
||
|
+ /* fallthru */
|
||
|
case 0 ... 5:
|
||
|
name[0] = 'r';
|
||
|
name[1] = baseregs[regno][0];
|
||
|
diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
|
||
|
index 0eabe0a..84b85d0 100644
|
||
|
--- a/libcpu/i386_disasm.c
|
||
|
+++ b/libcpu/i386_disasm.c
|
||
|
@@ -788,7 +788,7 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
|
||
|
++param_start;
|
||
|
break;
|
||
|
}
|
||
|
-
|
||
|
+ /* fallthru */
|
||
|
default:
|
||
|
assert (! "INVALID not handled");
|
||
|
abort ();
|
||
|
diff --git a/libdw/cfi.c b/libdw/cfi.c
|
||
|
index aeb48e6..38b3050 100644
|
||
|
--- a/libdw/cfi.c
|
||
|
+++ b/libdw/cfi.c
|
||
|
@@ -143,6 +143,7 @@ execute_cfi (Dwarf_CFI *cache,
|
||
|
|
||
|
case DW_CFA_advance_loc1:
|
||
|
operand = *program++;
|
||
|
+ /* fallthru */
|
||
|
case DW_CFA_advance_loc + 0 ... DW_CFA_advance_loc + CFI_PRIMARY_MAX:
|
||
|
advance_loc:
|
||
|
loc += operand * cie->code_alignment_factor;
|
||
|
@@ -227,6 +228,7 @@ execute_cfi (Dwarf_CFI *cache,
|
||
|
|
||
|
case DW_CFA_offset_extended:
|
||
|
get_uleb128 (operand, program);
|
||
|
+ cfi_assert (program < end);
|
||
|
case DW_CFA_offset + 0 ... DW_CFA_offset + CFI_PRIMARY_MAX:
|
||
|
get_uleb128 (offset, program);
|
||
|
offset *= cie->data_alignment_factor;
|
||
|
@@ -290,6 +292,7 @@ execute_cfi (Dwarf_CFI *cache,
|
||
|
|
||
|
case DW_CFA_restore_extended:
|
||
|
get_uleb128 (operand, program);
|
||
|
+ /* fallthru */
|
||
|
case DW_CFA_restore + 0 ... DW_CFA_restore + CFI_PRIMARY_MAX:
|
||
|
|
||
|
if (unlikely (abi_cfi) && likely (opcode == DW_CFA_restore))
|
||
|
diff --git a/libdw/encoded-value.h b/libdw/encoded-value.h
|
||
|
index e118a1c..17190c8 100644
|
||
|
--- a/libdw/encoded-value.h
|
||
|
+++ b/libdw/encoded-value.h
|
||
|
@@ -82,6 +82,7 @@ encoded_value_size (const Elf_Data *data, const unsigned char e_ident[],
|
||
|
if (*end++ & 0x80u)
|
||
|
return end - p;
|
||
|
}
|
||
|
+ return 0;
|
||
|
|
||
|
default:
|
||
|
abort ();
|
||
|
diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c
|
||
|
index 062a647..8a30816 100644
|
||
|
--- a/libdwfl/dwfl_report_elf.c
|
||
|
+++ b/libdwfl/dwfl_report_elf.c
|
||
|
@@ -185,6 +185,7 @@ __libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name,
|
||
|
case ET_CORE:
|
||
|
/* An assigned base address is meaningless for these. */
|
||
|
base = 0;
|
||
|
+ /* fallthru */
|
||
|
|
||
|
case ET_DYN:
|
||
|
default:;
|
||
|
diff --git a/src/addr2line.c b/src/addr2line.c
|
||
|
index 48f017b..4a2cc5b 100644
|
||
|
--- a/src/addr2line.c
|
||
|
+++ b/src/addr2line.c
|
||
|
@@ -457,6 +457,7 @@ handle_address (const char *string, Dwfl *dwfl)
|
||
|
case 1:
|
||
|
addr = 0;
|
||
|
j = i;
|
||
|
+ /* fallthru */
|
||
|
case 2:
|
||
|
if (string[j] != '\0')
|
||
|
break;
|
||
|
diff --git a/src/elflint.c b/src/elflint.c
|
||
|
index a25af97..3d75391 100644
|
||
|
--- a/src/elflint.c
|
||
|
+++ b/src/elflint.c
|
||
|
@@ -218,6 +218,7 @@ parse_opt (int key, char *arg __attribute__ ((unused)),
|
||
|
|
||
|
case 'd':
|
||
|
is_debuginfo = true;
|
||
|
+ break;
|
||
|
|
||
|
case ARGP_gnuld:
|
||
|
gnuld = true;
|
||
|
@@ -3735,6 +3736,7 @@ section [%2zu] '%s': merge flag set but entry size is zero\n"),
|
||
|
case SHT_NOBITS:
|
||
|
if (is_debuginfo)
|
||
|
break;
|
||
|
+ /* fallthru */
|
||
|
default:
|
||
|
ERROR (gettext ("\
|
||
|
section [%2zu] '%s' has unexpected type %d for an executable section\n"),
|
||
|
@@ -4036,7 +4038,7 @@ section [%2d] '%s': unknown core file note type %" PRIu32
|
||
|
if (nhdr.n_namesz == sizeof "Linux"
|
||
|
&& !memcmp (data->d_buf + name_offset, "Linux", sizeof "Linux"))
|
||
|
break;
|
||
|
-
|
||
|
+ /* fallthru */
|
||
|
default:
|
||
|
if (shndx == 0)
|
||
|
ERROR (gettext ("\
|
||
|
diff --git a/src/objdump.c b/src/objdump.c
|
||
|
index 1234c79..8c39a5b 100644
|
||
|
--- a/src/objdump.c
|
||
|
+++ b/src/objdump.c
|
||
|
@@ -238,7 +238,7 @@ parse_opt (int key, char *arg,
|
||
|
program_invocation_short_name);
|
||
|
exit (EXIT_FAILURE);
|
||
|
}
|
||
|
-
|
||
|
+ /* fallthru */
|
||
|
default:
|
||
|
return ARGP_ERR_UNKNOWN;
|
||
|
}
|
||
|
--
|
||
|
2.12.2
|
||
|
|