diff options
author | Joshua Watt <jpewhacker@gmail.com> | 2018-02-09 10:27:18 -0600 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2018-02-10 03:19:26 +0100 |
commit | 555e15ebe8bf1eb33d00747173cfc80cc65648a4 (patch) | |
tree | 6aa9cca6e04514cbc45d88f96a873cc6a4767472 /backends | |
parent | 240a068fcf3eb6bbcda525f80c8778de62621d9e (diff) |
Use fallthrough attribute.
Use __attribute__ ((fallthrough)) to indicate switch case fall through
instead of a comment. This ensures that the fallthrough warning is not
triggered even if the file is pre-processed (hence stripping the
comments) before it is compiled.
The actual fallback implementation is hidden behind a FALLBACK macro in
case the compiler doesn't support it.
Finally, the -Wimplict-fallthrough warning was upgraded to only allow
the attribute to satisfy it; a comment alone is no longer sufficient.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Diffstat (limited to 'backends')
-rw-r--r-- | backends/ChangeLog | 22 | ||||
-rw-r--r-- | backends/aarch64_retval.c | 2 | ||||
-rw-r--r-- | backends/alpha_retval.c | 4 | ||||
-rw-r--r-- | backends/arm_regs.c | 2 | ||||
-rw-r--r-- | backends/arm_retval.c | 2 | ||||
-rw-r--r-- | backends/i386_regs.c | 2 | ||||
-rw-r--r-- | backends/i386_retval.c | 4 | ||||
-rw-r--r-- | backends/ia64_retval.c | 2 | ||||
-rw-r--r-- | backends/linux-core-note.c | 2 | ||||
-rw-r--r-- | backends/m68k_retval.c | 4 | ||||
-rw-r--r-- | backends/ppc64_retval.c | 6 | ||||
-rw-r--r-- | backends/ppc_regs.c | 2 | ||||
-rw-r--r-- | backends/ppc_retval.c | 4 | ||||
-rw-r--r-- | backends/s390_retval.c | 4 | ||||
-rw-r--r-- | backends/sh_retval.c | 2 | ||||
-rw-r--r-- | backends/sparc_retval.c | 2 | ||||
-rw-r--r-- | backends/tilegx_retval.c | 4 | ||||
-rw-r--r-- | backends/x86_64_regs.c | 2 | ||||
-rw-r--r-- | backends/x86_64_retval.c | 2 |
19 files changed, 48 insertions, 26 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog index 190ae968..098bed76 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,25 @@ +2018-02-09 Joshua Watt <JPEWhacker@gmail.com> + + * aarch64_retval.c (aarch64_return_value_location): Use FALLTHROUGH + macro instead of comment. + * alpha_retval.c (alpha_return_value_location): Likewise. + * arm_regs.c (arm_register_info): Likewise. + * arm_retval.c (arm_return_value_location): Likewise. + * i386_regs.c (i386_register_info): Likewise. + * i386_retval.c (i386_return_value_location): Likewise. + * ia64_retval.c (ia64_return_value_location): Likewise. + * linux-core-note.c (core_note): Likewise. + * m68k_retval.c (m68k_return_value_location): Likewise. + * ppc64_retval.c (ppc64_return_value_location): Likewise. + * ppc_regs.c (ppc_register_info): Likewise. + * ppc_retval.c (ppc_return_value_location): Likewise. + * s390_retval.c (s390_return_value_location): Likewise. + * sh_retval.c (sh_return_value_location): Likewise. + * sparc_retval.c (sparc_return_value_location): Likewise. + * tilegx_retval.c (tilegx_return_value_location): Likewise. + * x86_64_regs.c (x86_64_register_info): Likewise. + * x86_64_retval.c (x86_64_return_value_location): Likewise. + 2017-10-24 Mark Wielaard <mark@klomp.org> * Makefile.am (m68k_corenote_no_Wpacked_not_aligned): New variable. diff --git a/backends/aarch64_retval.c b/backends/aarch64_retval.c index 68de307e..1308340b 100644 --- a/backends/aarch64_retval.c +++ b/backends/aarch64_retval.c @@ -292,7 +292,7 @@ aarch64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) assert (count > 0); if (count <= 4) return pass_hfa (locp, base_size, count); - /* Fall through. */ + FALLTHROUGH; case 1: /* Not a HFA. */ diff --git a/backends/alpha_retval.c b/backends/alpha_retval.c index 53dbfa45..d9bae3bc 100644 --- a/backends/alpha_retval.c +++ b/backends/alpha_retval.c @@ -85,7 +85,7 @@ alpha_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_base_type: case DW_TAG_enumeration_type: @@ -131,7 +131,7 @@ alpha_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) } } - /* Else fall through. */ + FALLTHROUGH; case DW_TAG_structure_type: case DW_TAG_class_type: diff --git a/backends/arm_regs.c b/backends/arm_regs.c index 21c5ad3a..a46a4c99 100644 --- a/backends/arm_regs.c +++ b/backends/arm_regs.c @@ -77,7 +77,7 @@ arm_register_info (Ebl *ebl __attribute__ ((unused)), case 16 + 0 ... 16 + 7: regno += 96 - 16; - /* Fall through. */ + FALLTHROUGH; case 96 + 0 ... 96 + 7: *setname = "FPA"; *type = DW_ATE_float; diff --git a/backends/arm_retval.c b/backends/arm_retval.c index 7aced742..1c28f016 100644 --- a/backends/arm_retval.c +++ b/backends/arm_retval.c @@ -82,7 +82,7 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_base_type: case DW_TAG_enumeration_type: diff --git a/backends/i386_regs.c b/backends/i386_regs.c index fd963a62..7ec93bb9 100644 --- a/backends/i386_regs.c +++ b/backends/i386_regs.c @@ -92,7 +92,7 @@ i386_register_info (Ebl *ebl __attribute__ ((unused)), case 5: case 8: *type = DW_ATE_address; - /* Fallthrough */ + FALLTHROUGH; case 0 ... 3: case 6 ... 7: name[0] = 'e'; diff --git a/backends/i386_retval.c b/backends/i386_retval.c index 4aa646fe..32fec728 100644 --- a/backends/i386_retval.c +++ b/backends/i386_retval.c @@ -85,7 +85,7 @@ i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_base_type: case DW_TAG_enumeration_type: @@ -123,7 +123,7 @@ i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) if (size <= 8) return nloc_intregpair; } - /* Fallthrough */ + FALLTHROUGH; case DW_TAG_structure_type: case DW_TAG_class_type: diff --git a/backends/ia64_retval.c b/backends/ia64_retval.c index dcd5f28d..03ea4d89 100644 --- a/backends/ia64_retval.c +++ b/backends/ia64_retval.c @@ -260,7 +260,7 @@ ia64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_base_type: case DW_TAG_enumeration_type: diff --git a/backends/linux-core-note.c b/backends/linux-core-note.c index 08282ba4..9faae4c3 100644 --- a/backends/linux-core-note.c +++ b/backends/linux-core-note.c @@ -226,7 +226,7 @@ EBLHOOK(core_note) (const GElf_Nhdr *nhdr, const char *name, if (memcmp (name, "CORE", nhdr->n_namesz) == 0) break; /* Buggy old Linux kernels didn't terminate "LINUX". */ - /* Fall through. */ + FALLTHROUGH; case sizeof "LINUX": if (memcmp (name, "LINUX", nhdr->n_namesz) == 0) diff --git a/backends/m68k_retval.c b/backends/m68k_retval.c index c68ed022..a653ba3a 100644 --- a/backends/m68k_retval.c +++ b/backends/m68k_retval.c @@ -92,7 +92,7 @@ m68k_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_base_type: case DW_TAG_enumeration_type: @@ -135,7 +135,7 @@ m68k_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) if (size <= 8) return nloc_intregpair; } - /* Fallthrough */ + FALLTHROUGH; case DW_TAG_structure_type: case DW_TAG_class_type: case DW_TAG_union_type: diff --git a/backends/ppc64_retval.c b/backends/ppc64_retval.c index a2519839..eb1c11ec 100644 --- a/backends/ppc64_retval.c +++ b/backends/ppc64_retval.c @@ -96,7 +96,7 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_base_type: case DW_TAG_enumeration_type: @@ -141,7 +141,7 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) return nloc_intreg; } - /* Else fall through. */ + FALLTHROUGH; case DW_TAG_structure_type: case DW_TAG_class_type: case DW_TAG_union_type: @@ -161,7 +161,7 @@ ppc64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) return nloc_vmxreg; } } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_string_type: if (dwarf_aggregate_size (typedie, &size) == 0 && size <= 8) diff --git a/backends/ppc_regs.c b/backends/ppc_regs.c index c2d50118..43d2534f 100644 --- a/backends/ppc_regs.c +++ b/backends/ppc_regs.c @@ -140,7 +140,7 @@ ppc_register_info (Ebl *ebl __attribute__ ((unused)), case 100: if (*bits == 32) return stpcpy (name, "mq") + 1 - name; - /* Fallthrough */ + FALLTHROUGH; case 102 ... 107: name[0] = 's'; name[1] = 'p'; diff --git a/backends/ppc_retval.c b/backends/ppc_retval.c index b14a99f1..39b42da1 100644 --- a/backends/ppc_retval.c +++ b/backends/ppc_retval.c @@ -108,7 +108,7 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_base_type: case DW_TAG_enumeration_type: @@ -172,7 +172,7 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) return nloc_intregquad; } } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_structure_type: case DW_TAG_class_type: diff --git a/backends/s390_retval.c b/backends/s390_retval.c index a927d46a..2043f985 100644 --- a/backends/s390_retval.c +++ b/backends/s390_retval.c @@ -87,7 +87,7 @@ s390_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_base_type: case DW_TAG_enumeration_type: @@ -127,7 +127,7 @@ s390_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) return size <= asize ? nloc_intreg : nloc_intregpair; } } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_structure_type: case DW_TAG_class_type: diff --git a/backends/sh_retval.c b/backends/sh_retval.c index d44f2601..33d7d964 100644 --- a/backends/sh_retval.c +++ b/backends/sh_retval.c @@ -84,7 +84,7 @@ sh_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_base_type: case DW_TAG_enumeration_type: diff --git a/backends/sparc_retval.c b/backends/sparc_retval.c index e1b17753..fb81cdce 100644 --- a/backends/sparc_retval.c +++ b/backends/sparc_retval.c @@ -91,7 +91,7 @@ sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_base_type: case DW_TAG_enumeration_type: diff --git a/backends/tilegx_retval.c b/backends/tilegx_retval.c index db81a20b..7f7d24b0 100644 --- a/backends/tilegx_retval.c +++ b/backends/tilegx_retval.c @@ -79,7 +79,7 @@ tilegx_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_base_type: case DW_TAG_enumeration_type: @@ -113,7 +113,7 @@ tilegx_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) return nloc_intreg; } - /* Else fall through. */ + FALLTHROUGH; case DW_TAG_structure_type: case DW_TAG_class_type: case DW_TAG_union_type: diff --git a/backends/x86_64_regs.c b/backends/x86_64_regs.c index 84304407..ef987daf 100644 --- a/backends/x86_64_regs.c +++ b/backends/x86_64_regs.c @@ -87,7 +87,7 @@ x86_64_register_info (Ebl *ebl __attribute__ ((unused)), case 6 ... 7: *type = DW_ATE_address; - /* Fallthrough */ + FALLTHROUGH; case 0 ... 5: name[0] = 'r'; name[1] = baseregs[regno][0]; diff --git a/backends/x86_64_retval.c b/backends/x86_64_retval.c index b3799ae0..f9114cb1 100644 --- a/backends/x86_64_retval.c +++ b/backends/x86_64_retval.c @@ -100,7 +100,7 @@ x86_64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); } - /* Fall through. */ + FALLTHROUGH; case DW_TAG_base_type: case DW_TAG_enumeration_type: |