This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
-Wimplicit-fallthrough error fixes
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 6 Oct 2016 10:10:37 +1030
- Subject: -Wimplicit-fallthrough error fixes
- Authentication-results: sourceware.org; auth=none
Well, not all are errors, but a little more substantive than just
fiddling with comments.
bfd/
* coffcode.h (coff_slurp_symbol_table): Revert accidental commit
made 2015-01-08.
* elf32-nds32.c (nds32_elf_grok_psinfo): Add missing break.
* reloc.c (bfd_default_reloc_type_lookup): Add missing breaks.
opcodes/
* arc-ext.c (create_map): Add missing break.
* msp430-decode.opc (encode_as): Likewise.
* msp430-decode.c: Regenerate.
binutils/
* coffdump.c (dump_coff_where): Add missing break.
* stabs.c (stab_xcoff_builtin_type): Likewise.
gas/
* config/tc-arc.c (find_opcode_match): Add missing break.
* config/tc-i960.c (get_cdisp): Likewise.
* config/tc-metag.c (parse_swap, md_apply_fix): Likewise.
* config/tc-mt.c (md_parse_option): Likewise.
* config/tc-nds32.c (nds32_apply_fix): Likewise.
* config/tc-hppa.c (pa_ip): Assert rather than testing last
condition of multiple if statements.
* config/tc-s390.c (s390_exp_compare): Return 0 on error.
* config/tc-tic4x.c (tic4x_operand_parse): Add as_bad and break
out of case rather than falling into next case. Formatting.
ld/
* plugin.c (asymbol_from_plugin_symbol): Avoid compiler warning
by adding return.
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 20829fc..31050ec 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5055,14 +5055,14 @@ coff_slurp_symbol_table (bfd * abfd)
#if defined(TIC80COFF) || defined(TICOFF)
case C_UEXT: /* Tentative external definition. */
#endif
+ case C_EXTLAB: /* External load time label. */
+ case C_HIDDEN: /* Ext symbol in dmert public lib. */
default:
_bfd_error_handler
(_("%B: Unrecognized storage class %d for %s symbol `%s'"),
abfd, src->u.syment.n_sclass,
dst->symbol.section->name, dst->symbol.name);
ret = FALSE;
- case C_EXTLAB: /* External load time label. */
- case C_HIDDEN: /* Ext symbol in dmert public lib. */
dst->symbol.flags = BSF_DEBUGGING;
dst->symbol.value = (src->u.syment.n_value);
break;
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index fc47c7f..0f2d6da 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -3046,6 +3046,7 @@ nds32_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
_bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
elf_tdata (abfd)->core->command =
_bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
+ break;
default:
return FALSE;
diff --git a/bfd/reloc.c b/bfd/reloc.c
index dbaa6a9..58cffdf 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -7770,10 +7770,12 @@ bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
{
case 64:
BFD_FAIL ();
+ break;
case 32:
return &bfd_howto_32;
case 16:
BFD_FAIL ();
+ break;
default:
BFD_FAIL ();
}
diff --git a/binutils/coffdump.c b/binutils/coffdump.c
index e9aa76f..6404458 100644
--- a/binutils/coffdump.c
+++ b/binutils/coffdump.c
@@ -267,6 +267,7 @@ dump_coff_where (struct coff_where *p)
break;
case coff_where_strtag:
printf ("STRTAG");
+ break;
case coff_where_entag:
printf ("ENTAG");
break;
diff --git a/binutils/stabs.c b/binutils/stabs.c
index aebde7a..d209094 100644
--- a/binutils/stabs.c
+++ b/binutils/stabs.c
@@ -3432,6 +3432,7 @@ stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info,
case 9:
name = "unsigned";
rettype = debug_make_int_type (dhandle, 4, TRUE);
+ break;
case 10:
name = "unsigned long";
rettype = debug_make_int_type (dhandle, 4, TRUE);
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 58adf0b..d480bf1 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -1929,6 +1929,7 @@ find_opcode_match (const struct arc_opcode_hash_entry *entry,
case O_absent:
if (!generic_reloc_p (operand->default_reloc))
goto match_failed;
+ break;
default:
break;
}
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index aea78dc..f5cdc2c 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -3505,8 +3505,9 @@ pa_ip (char *str)
/* M bit is explicit in the major opcode. */
INSERT_FIELD_AND_CONTINUE (opcode, a, 2);
}
- else if (*args == 'e')
+ else
{
+ gas_assert (*args == 'e');
/* Stash the ma/mb flag temporarily in the
instruction. We will use (and remove it)
later when handling 'J', 'K', '<' & '>'. */
diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c
index 59ef760..5afbb6f 100644
--- a/gas/config/tc-i960.c
+++ b/gas/config/tc-i960.c
@@ -577,6 +577,7 @@ get_cdisp (const char *dispP, /* Displacement as specified in source instruction
{
case O_illegal:
as_bad (_("expression syntax error"));
+ break;
case O_symbol:
if (S_GET_SEGMENT (e.X_add_symbol) == now_seg
diff --git a/gas/config/tc-metag.c b/gas/config/tc-metag.c
index bbc34f7..e9f8687 100644
--- a/gas/config/tc-metag.c
+++ b/gas/config/tc-metag.c
@@ -2040,6 +2040,7 @@ parse_swap (const char *line, metag_insn *insn,
as_bad (_("PC, CT, TR and TT are treated as if they are a single unit but operands must be in different units"));
return NULL;
}
+ break;
default:
/* Registers must be in different units. */
@@ -7109,6 +7110,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
break;
case BFD_RELOC_64:
md_number_to_chars (buf, value, 8);
+ break;
case BFD_RELOC_METAG_RELBRANCH:
if (!value)
diff --git a/gas/config/tc-mt.c b/gas/config/tc-mt.c
index bbcd87e..1ae271e 100644
--- a/gas/config/tc-mt.c
+++ b/gas/config/tc-mt.c
@@ -133,6 +133,7 @@ md_parse_option (int c ATTRIBUTE_UNUSED, const char * arg)
mt_mach_bitmask = 1 << MACH_MS2;
mt_arch = ms2;
}
+ break;
case OPTION_NO_SCHED_REST:
no_scheduling_restrictions = 1;
break;
diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c
index f8a9277..de59f46 100644
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -6605,6 +6605,7 @@ nds32_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
break;
case BFD_RELOC_64:
md_number_to_chars (where, value, 8);
+ break;
default:
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Internal error: Unknown fixup type %d (`%s')"),
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 356bbb0..bc318ee 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -929,6 +929,7 @@ s390_exp_compare (expressionS *exp1, expressionS *exp2)
case O_big:
as_bad (_("Can't handle O_big in s390_exp_compare"));
+ return 0;
case O_symbol: /* X_add_symbol & X_add_number must be equal. */
case O_symbol_rva:
diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c
index 407fe17..84c9ece 100644
--- a/gas/config/tc-tic4x.c
+++ b/gas/config/tc-tic4x.c
@@ -1553,10 +1553,10 @@ tic4x_operand_parse (char *s, tic4x_operand_t *operand)
/* Allow ori ^foo, ar0 to be equivalent to ldi .hi.foo, ar0 */
/* WARNING : The TI C40 assembler cannot do this. */
else if (exp->X_op == O_symbol)
- {
- operand->mode = M_HI;
- break;
- }
+ operand->mode = M_HI;
+ else
+ as_bad (_("Expecting a constant value"));
+ break;
case '#':
input_line_pointer = tic4x_expression (++input_line_pointer, exp);
@@ -1576,14 +1576,11 @@ tic4x_operand_parse (char *s, tic4x_operand_t *operand)
/* Allow ori foo, ar0 to be equivalent to ldi .lo.foo, ar0 */
/* WARNING : The TI C40 assembler cannot do this. */
else if (exp->X_op == O_symbol)
- {
- operand->mode = M_IMMED;
- break;
- }
-
+ operand->mode = M_IMMED;
else
as_bad (_("Expecting a constant value"));
break;
+
case '\\':
#endif
case '@':
diff --git a/ld/plugin.c b/ld/plugin.c
index 36094dd..80d22e2 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -430,6 +430,8 @@ asymbol_from_plugin_symbol (bfd *abfd, asymbol *asym,
default:
einfo (_("%P%F: unknown ELF symbol visibility: %d!\n"),
ldsym->visibility);
+ return LDPS_ERR;
+
case LDPV_DEFAULT:
visibility = STV_DEFAULT;
break;
diff --git a/opcodes/arc-ext.c b/opcodes/arc-ext.c
index c12cabe..3cf3e2f 100644
--- a/opcodes/arc-ext.c
+++ b/opcodes/arc-ext.c
@@ -170,6 +170,7 @@ create_map (unsigned char *block,
arc_extension_map.
coreRegisters[number - FIRST_EXTENSION_CORE_REGISTER].name
= xstrdup (name);
+ break;
}
case EXT_COND_CODE:
diff --git a/opcodes/msp430-decode.opc b/opcodes/msp430-decode.opc
index 084a6a5..9428467 100644
--- a/opcodes/msp430-decode.opc
+++ b/opcodes/msp430-decode.opc
@@ -237,6 +237,7 @@ encode_as (int reg, int as, LocalData *ld, int ext)
break;
case MSR_None:
SA (0);
+ break;
default:
SM (reg, 0);
break;
--
Alan Modra
Australia Development Lab, IBM