diff mbox

Implement -Wimplicit-fallthrough (version 8): add gcc_fallthrough()

Message ID 20160901134212.GB3768@redhat.com
State New
Headers show

Commit Message

Marek Polacek Sept. 1, 2016, 1:42 p.m. UTC
Tobias pointed out that I need to add a new gcc_fallthrough into trans-io.c,
so done.

Bootstrapped/regtested on x86_64-linux and ppc64-linux.

2016-08-31  Marek Polacek  <polacek@redhat.com>

	PR c/7652
	* Makefile.in (insn-attrtab.o-warn, insn-dfatab.o-warn,
	insn-latencytab.o-warn, insn-output.o-warn, insn-emit.o-warn): Add
	-Wno-switch-fallthrough.
	* builtins.c (expand_builtin_int_roundingfn_2): Add gcc_fallthrough.
	(expand_builtin): Likewise.
	* config/rs6000/rs6000.c (rs6000_builtin_vectorized_libmass): Likewise.
	* convert.c (convert_to_real_1): Likewise.
	(convert_to_integer_1): Likewise.
	* final.c (output_alternate_entry_point): Likewise.
	* genattrtab.c (make_canonical): Likewise.
	(write_test_expr): Likewise.
	* genpreds.c (validate_exp): Likewise.
	* gimple-ssa-strength-reduction.c
	(find_candidates_dom_walker::before_dom_children): Likewise.
	* godump.c (go_format_type): Likewise.
	* reload1.c (elimination_effects): Likewise.
	* resource.c (mark_referenced_resources): Likewise.
	(mark_set_resources): Likewise.
	* tree-ssa-loop-ivopts.c (find_deriving_biv_for_expr): Likewise.
	* varasm.c (output_addressed_constants): Likewise.
gcc/c-family/
	* c-common.c (resolve_overloaded_builtin): Add gcc_fallthrough.
gcc/c/
	* c-decl.c (pop_scope): Add gcc_fallthrough.
	* c-typeck.c (composite_type): Likewise.
gcc/gcc/cp/
	* error.c (dump_type): Add gcc_fallthrough.
	(dump_decl): Likewise.
	(dump_expr): Likewise.
	* parser.c (cp_parser_storage_class_specifier_opt): Likewise.
	(cp_parser_skip_to_end_of_template_parameter_list): Likewise.
	(cp_parser_cache_defarg): Likewise.
	(cp_parser_omp_for_cond): Likewise.
	* semantics.c (finish_decltype_type): Likewise.
	* typeck.c (structural_comptypes): Likewise.
	(cp_build_binary_op): Likewise.
	(cp_build_modify_expr): Likewise.
gcc/fortran/
	* arith.c (eval_intrinsic): Add gcc_fallthrough.
	* frontend-passes.c (optimize_op): Likewise.
	(gfc_expr_walker): Likewise.
	* parse.c (next_fixed): Likewise.
	* primary.c (match_variable): Likewise.
	* trans-array.c: Likewise.
	* trans-expr.c (flatten_array_ctors_without_strlen): Likewise.
	* trans-io.c (transfer_expr): Likewise.
libstdc++-v3/
	* libsupc++/hash_bytes.cc: Add [[gnu::fallthrough]].


	Marek

Comments

Jakub Jelinek Sept. 1, 2016, 2:27 p.m. UTC | #1
On Thu, Sep 01, 2016 at 03:42:12PM +0200, Marek Polacek wrote:
> --- gcc/gcc/c-family/c-common.c
> +++ gcc/gcc/c-family/c-common.c
> @@ -11590,6 +11590,7 @@ resolve_overloaded_builtin (location_t loc, tree function,
>  	    gcc_unreachable ();
>  	}
>  	/* Fallthrough to the normal processing.  */
> +	gcc_fallthrough ();
>        }
>      case BUILT_IN_ATOMIC_EXCHANGE_N:
>      case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_N:
> @@ -11598,6 +11599,7 @@ resolve_overloaded_builtin (location_t loc, tree function,
>        {
>  	fetch_op = false;
>  	/* Fallthrough to further processing.  */
> +	gcc_fallthrough ();
>        }
>      case BUILT_IN_ATOMIC_ADD_FETCH_N:
>      case BUILT_IN_ATOMIC_SUB_FETCH_N:
> @@ -11614,6 +11616,7 @@ resolve_overloaded_builtin (location_t loc, tree function,
>        {
>          orig_format = false;
>  	/* Fallthru for parameter processing.  */
> +	gcc_fallthrough ();
>        }

These 3 look just like misformatted stuff, {}s around for no reason
whatsoever, the first case even badly indented and the latter two with a
single stmt inside of {}.
I think it would be better to just remove the useless outer {} pair
in all the cases, reindent and replace the comments with /* FALLTHRU */

> diff --git gcc/gcc/c/c-typeck.c gcc/gcc/c/c-typeck.c
> index 5194027..e89bdc8 100644
> --- gcc/gcc/c/c-typeck.c
> +++ gcc/gcc/c/c-typeck.c
> @@ -605,7 +605,7 @@ composite_type (tree t1, tree t2)
>  
>  	t1 = build_function_type (valtype, newargs);
>  	t1 = qualify_type (t1, t2);
> -	/* ... falls through ...  */
> +	gcc_fallthrough ();
>        }

One option for here (other than removing the {}s, which would require
separate var declarations from their assignments) would be to just do:
-	/* ... falls through ...  */
       }
+      /* FALLTHRU */

> diff --git gcc/gcc/config/rs6000/rs6000.c gcc/gcc/config/rs6000/rs6000.c
> index 2f15a05..c25314e 100644
> --- gcc/gcc/config/rs6000/rs6000.c
> +++ gcc/gcc/config/rs6000/rs6000.c
> @@ -5489,7 +5489,7 @@ rs6000_builtin_vectorized_libmass (combined_fn fn, tree type_out,
>      CASE_CFN_HYPOT:
>      CASE_CFN_POW:
>        n_args = 2;
> -      /* fall through */
> +      gcc_fallthrough ();
>  
>      CASE_CFN_ACOS:
>      CASE_CFN_ACOSH:

This is needed becase CSE_CFN_ACOS is a macro, right?  I guess it is fine.

> --- gcc/gcc/cp/error.c
> +++ gcc/gcc/cp/error.c
> @@ -576,6 +576,7 @@ dump_type (cxx_pretty_printer *pp, tree t, int flags)
>      default:
>        pp_unsupported_tree (pp, t);
>        /* Fall through to error.  */
> +      gcc_fallthrough ();
>  
>      case ERROR_MARK:
>        pp_string (pp, M_("<type error>"));
> @@ -1277,6 +1278,7 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags)
>      default:
>        pp_unsupported_tree (pp, t);
>        /* Fall through to error.  */
> +      gcc_fallthrough ();
>  
>      case ERROR_MARK:
>        pp_string (pp, M_("<declaration error>"));
> @@ -2778,6 +2780,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags)
>      default:
>        pp_unsupported_tree (pp, t);
>        /* fall through to ERROR_MARK...  */
> +      gcc_fallthrough ();

Why the above ones?  Replacing the comments with /* FALLTHRU */ would be
sufficient IMHO.  Or is there any value in explaining why it falls through?

	Jakub
diff mbox

Patch

diff --git gcc/gcc/Makefile.in gcc/gcc/Makefile.in
index eb5ab61..1046b31 100644
--- gcc/gcc/Makefile.in
+++ gcc/gcc/Makefile.in
@@ -218,6 +218,11 @@  libgcov-merge-tool.o-warn = -Wno-error
 gimple-match.o-warn = -Wno-unused
 generic-match.o-warn = -Wno-unused
 dfp.o-warn = -Wno-strict-aliasing
+insn-attrtab.o-warn = -Wno-implicit-fallthrough
+insn-dfatab.o-warn = -Wno-implicit-fallthrough
+insn-latencytab.o-warn = -Wno-implicit-fallthrough
+insn-output.o-warn = -Wno-implicit-fallthrough
+insn-emit.o-warn = -Wno-implicit-fallthrough
 
 # All warnings have to be shut off in stage1 if the compiler used then
 # isn't gcc; configure determines that.  WARN_CFLAGS will be either
diff --git gcc/gcc/builtins.c gcc/gcc/builtins.c
index b981bcd..9da37dc 100644
--- gcc/gcc/builtins.c
+++ gcc/gcc/builtins.c
@@ -2588,7 +2588,7 @@  expand_builtin_int_roundingfn_2 (tree exp, rtx target)
     {
     CASE_FLT_FN (BUILT_IN_IRINT):
       fallback_fn = BUILT_IN_LRINT;
-      /* FALLTHRU */
+      gcc_fallthrough ();
     CASE_FLT_FN (BUILT_IN_LRINT):
     CASE_FLT_FN (BUILT_IN_LLRINT):
       builtin_optab = lrint_optab;
@@ -2596,7 +2596,7 @@  expand_builtin_int_roundingfn_2 (tree exp, rtx target)
 
     CASE_FLT_FN (BUILT_IN_IROUND):
       fallback_fn = BUILT_IN_LROUND;
-      /* FALLTHRU */
+      gcc_fallthrough ();
     CASE_FLT_FN (BUILT_IN_LROUND):
     CASE_FLT_FN (BUILT_IN_LLROUND):
       builtin_optab = lround_optab;
@@ -5905,6 +5905,7 @@  expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode,
     CASE_FLT_FN (BUILT_IN_ILOGB):
       if (! flag_unsafe_math_optimizations)
 	break;
+      gcc_fallthrough ();
     CASE_FLT_FN (BUILT_IN_ISINF):
     CASE_FLT_FN (BUILT_IN_FINITE):
     case BUILT_IN_ISFINITE:
diff --git gcc/gcc/c-family/c-common.c gcc/gcc/c-family/c-common.c
index b29334a..b08de64 100644
--- gcc/gcc/c-family/c-common.c
+++ gcc/gcc/c-family/c-common.c
@@ -11590,6 +11590,7 @@  resolve_overloaded_builtin (location_t loc, tree function,
 	    gcc_unreachable ();
 	}
 	/* Fallthrough to the normal processing.  */
+	gcc_fallthrough ();
       }
     case BUILT_IN_ATOMIC_EXCHANGE_N:
     case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_N:
@@ -11598,6 +11599,7 @@  resolve_overloaded_builtin (location_t loc, tree function,
       {
 	fetch_op = false;
 	/* Fallthrough to further processing.  */
+	gcc_fallthrough ();
       }
     case BUILT_IN_ATOMIC_ADD_FETCH_N:
     case BUILT_IN_ATOMIC_SUB_FETCH_N:
@@ -11614,6 +11616,7 @@  resolve_overloaded_builtin (location_t loc, tree function,
       {
         orig_format = false;
 	/* Fallthru for parameter processing.  */
+	gcc_fallthrough ();
       }
     case BUILT_IN_SYNC_FETCH_AND_ADD_N:
     case BUILT_IN_SYNC_FETCH_AND_SUB_N:
diff --git gcc/gcc/c/c-decl.c gcc/gcc/c/c-decl.c
index 8f49c35..f6aa767 100644
--- gcc/gcc/c/c-decl.c
+++ gcc/gcc/c/c-decl.c
@@ -1328,7 +1328,7 @@  pop_scope (void)
 		set_type_context (TREE_TYPE (p), context);
 	    }
 
-	  /* Fall through.  */
+	  gcc_fallthrough ();
 	  /* Parameters go in DECL_ARGUMENTS, not BLOCK_VARS, and have
 	     already been put there by store_parm_decls.  Unused-
 	     parameter warnings are handled by function.c.
diff --git gcc/gcc/c/c-typeck.c gcc/gcc/c/c-typeck.c
index 5194027..e89bdc8 100644
--- gcc/gcc/c/c-typeck.c
+++ gcc/gcc/c/c-typeck.c
@@ -605,7 +605,7 @@  composite_type (tree t1, tree t2)
 
 	t1 = build_function_type (valtype, newargs);
 	t1 = qualify_type (t1, t2);
-	/* ... falls through ...  */
+	gcc_fallthrough ();
       }
 
     default:
diff --git gcc/gcc/config/rs6000/rs6000.c gcc/gcc/config/rs6000/rs6000.c
index 2f15a05..c25314e 100644
--- gcc/gcc/config/rs6000/rs6000.c
+++ gcc/gcc/config/rs6000/rs6000.c
@@ -5489,7 +5489,7 @@  rs6000_builtin_vectorized_libmass (combined_fn fn, tree type_out,
     CASE_CFN_HYPOT:
     CASE_CFN_POW:
       n_args = 2;
-      /* fall through */
+      gcc_fallthrough ();
 
     CASE_CFN_ACOS:
     CASE_CFN_ACOSH:
diff --git gcc/gcc/convert.c gcc/gcc/convert.c
index e6b4d29..8f18ee4 100644
--- gcc/gcc/convert.c
+++ gcc/gcc/convert.c
@@ -164,6 +164,7 @@  convert_to_real_1 (tree type, tree expr, bool fold_p)
 	       -fmath-errno.  */
 	    if (flag_errno_math)
 	      break;
+	    gcc_fallthrough ();
 	  CASE_MATHFN (ACOS)
 	  CASE_MATHFN (ACOSH)
 	  CASE_MATHFN (ASIN)
@@ -184,6 +185,7 @@  convert_to_real_1 (tree type, tree expr, bool fold_p)
 	    /* The above functions are not safe to do this conversion.  */
 	    if (!flag_unsafe_math_optimizations)
 	      break;
+	    gcc_fallthrough ();
 	  CASE_MATHFN (SQRT)
 	  CASE_MATHFN (FABS)
 	  CASE_MATHFN (LOGB)
@@ -516,7 +518,7 @@  convert_to_integer_1 (tree type, tree expr, bool dofold)
 	  /* Only convert nearbyint* if we can ignore math exceptions.  */
 	  if (flag_trapping_math)
 	    break;
-	  /* ... Fall through ...  */
+	  gcc_fallthrough ();
 	CASE_FLT_FN (BUILT_IN_RINT):
 	  /* Only convert in ISO C99 mode and with -fno-math-errno.  */
 	  if (!targetm.libc_has_function (function_c99_misc) || flag_errno_math)
diff --git gcc/gcc/cp/error.c gcc/gcc/cp/error.c
index 58cd48c..26dcb7d 100644
--- gcc/gcc/cp/error.c
+++ gcc/gcc/cp/error.c
@@ -576,6 +576,7 @@  dump_type (cxx_pretty_printer *pp, tree t, int flags)
     default:
       pp_unsupported_tree (pp, t);
       /* Fall through to error.  */
+      gcc_fallthrough ();
 
     case ERROR_MARK:
       pp_string (pp, M_("<type error>"));
@@ -1277,6 +1278,7 @@  dump_decl (cxx_pretty_printer *pp, tree t, int flags)
     default:
       pp_unsupported_tree (pp, t);
       /* Fall through to error.  */
+      gcc_fallthrough ();
 
     case ERROR_MARK:
       pp_string (pp, M_("<declaration error>"));
@@ -2778,6 +2780,7 @@  dump_expr (cxx_pretty_printer *pp, tree t, int flags)
     default:
       pp_unsupported_tree (pp, t);
       /* fall through to ERROR_MARK...  */
+      gcc_fallthrough ();
     case ERROR_MARK:
       pp_string (pp, M_("<expression error>"));
       break;
diff --git gcc/gcc/cp/parser.c gcc/gcc/cp/parser.c
index ca9f8b9..fd64be0 100644
--- gcc/gcc/cp/parser.c
+++ gcc/gcc/cp/parser.c
@@ -12980,6 +12980,7 @@  cp_parser_storage_class_specifier_opt (cp_parser* parser)
       if (cxx_dialect != cxx98)
         return NULL_TREE;
       /* Fall through for C++98.  */
+      gcc_fallthrough ();
 
     case RID_REGISTER:
     case RID_STATIC:
@@ -27256,6 +27257,7 @@  cp_parser_skip_to_end_of_template_parameter_list (cp_parser* parser)
 	    }
           /* Fall through for C++0x, so we handle the second `>' in
              the `>>'.  */
+	  gcc_fallthrough ();
 
 	case CPP_GREATER:
 	  if (!nesting_depth && level-- == 0)
@@ -27713,6 +27715,7 @@  cp_parser_cache_defarg (cp_parser *parser, bool nsdmi)
 	  /* Fall through for C++0x, which treats the `>>'
 	     operator like two `>' tokens in certain
 	     cases.  */
+	  gcc_fallthrough ();
 
 	case CPP_GREATER:
 	  if (depth == 0)
@@ -33355,6 +33358,7 @@  cp_parser_omp_for_cond (cp_parser *parser, tree decl, enum tree_code code)
       if (code == CILK_SIMD || code == CILK_FOR)
 	break;
       /* Fall through: OpenMP disallows NE_EXPR.  */
+      gcc_fallthrough ();
     default:
       return error_mark_node;
     }
diff --git gcc/gcc/cp/semantics.c gcc/gcc/cp/semantics.c
index 9ab8439..cf2dd52 100644
--- gcc/gcc/cp/semantics.c
+++ gcc/gcc/cp/semantics.c
@@ -8894,6 +8894,7 @@  finish_decltype_type (tree expr, bool id_expression_or_member_access_p,
               break;
             }
           /* Fall through for fields that aren't bitfields.  */
+	  gcc_fallthrough ();
 
         case FUNCTION_DECL:
         case VAR_DECL:
diff --git gcc/gcc/cp/typeck.c gcc/gcc/cp/typeck.c
index a591d29..7509f6e 100644
--- gcc/gcc/cp/typeck.c
+++ gcc/gcc/cp/typeck.c
@@ -1306,6 +1306,7 @@  structural_comptypes (tree t1, tree t2, int strict)
       if (TYPE_REF_IS_RVALUE (t1) != TYPE_REF_IS_RVALUE (t2))
 	return false;
       /* fall through to checks for pointer types */
+      gcc_fallthrough ();
 
     case POINTER_TYPE:
       if (TYPE_MODE (t1) != TYPE_MODE (t2)
@@ -4265,6 +4266,7 @@  cp_build_binary_op (location_t location,
 	}
       /* The pointer - int case is just like pointer + int; fall
 	 through.  */
+      gcc_fallthrough ();
     case PLUS_EXPR:
       if ((code0 == POINTER_TYPE || code1 == POINTER_TYPE)
 	  && (code0 == INTEGER_TYPE || code1 == INTEGER_TYPE))
@@ -7531,7 +7533,7 @@  cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
 			    TREE_OPERAND (lhs, 1)),
 		    TREE_OPERAND (lhs, 0),
 		    TREE_OPERAND (lhs, 1));
-      /* Fall through.  */
+      gcc_fallthrough ();
 
       /* Handle (a ? b : c) used as an "lvalue".  */
     case COND_EXPR:
diff --git gcc/gcc/final.c gcc/gcc/final.c
index eccc3d8..29c12fd 100644
--- gcc/gcc/final.c
+++ gcc/gcc/final.c
@@ -2096,9 +2096,11 @@  output_alternate_entry_point (FILE *file, rtx_insn *insn)
     case LABEL_WEAK_ENTRY:
 #ifdef ASM_WEAKEN_LABEL
       ASM_WEAKEN_LABEL (file, name);
+      gcc_fallthrough ();
 #endif
     case LABEL_GLOBAL_ENTRY:
       targetm.asm_out.globalize_label (file, name);
+      gcc_fallthrough ();
     case LABEL_STATIC_ENTRY:
 #ifdef ASM_OUTPUT_TYPE_DIRECTIVE
       ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function");
diff --git gcc/gcc/fortran/arith.c gcc/gcc/fortran/arith.c
index 47a5504..8af7540 100644
--- gcc/gcc/fortran/arith.c
+++ gcc/gcc/fortran/arith.c
@@ -1521,7 +1521,7 @@  eval_intrinsic (gfc_intrinsic_op op,
 	  break;
 	}
 
-    /* Fall through  */
+    gcc_fallthrough ();
     /* Numeric binary  */
     case INTRINSIC_PLUS:
     case INTRINSIC_MINUS:
diff --git gcc/gcc/fortran/frontend-passes.c gcc/gcc/fortran/frontend-passes.c
index c138f4d..c7256e7 100644
--- gcc/gcc/fortran/frontend-passes.c
+++ gcc/gcc/fortran/frontend-passes.c
@@ -1463,7 +1463,7 @@  optimize_op (gfc_expr *e)
     case INTRINSIC_LT:
       changed = optimize_comparison (e, op);
 
-      /* Fall through */
+      gcc_fallthrough ();
       /* Look at array constructors.  */
     case INTRINSIC_PLUS:
     case INTRINSIC_MINUS:
@@ -3331,6 +3331,7 @@  gfc_expr_walker (gfc_expr **e, walk_expr_fn_t exprfn, void *data)
 
 	    /* Fall through to the variable case in order to walk the
 	       reference.  */
+	    gcc_fallthrough ();
 
 	  case EXPR_SUBSTRING:
 	  case EXPR_VARIABLE:
diff --git gcc/gcc/fortran/parse.c gcc/gcc/fortran/parse.c
index deba431..025eb47 100644
--- gcc/gcc/fortran/parse.c
+++ gcc/gcc/fortran/parse.c
@@ -1257,7 +1257,7 @@  next_fixed (void)
 		  return decode_oacc_directive ();
 		}
 	    }
-	  /* FALLTHROUGH */
+	  gcc_fallthrough ();
 
 	  /* Comments have already been skipped by the time we get
 	     here so don't bother checking for them.  */
diff --git gcc/gcc/fortran/primary.c gcc/gcc/fortran/primary.c
index 396edf2..331ba88 100644
--- gcc/gcc/fortran/primary.c
+++ gcc/gcc/fortran/primary.c
@@ -3415,6 +3415,7 @@  match_variable (gfc_expr **result, int equiv_flag, int host_flag)
 	break;
 
       /* Fall through to error */
+      gcc_fallthrough ();
 
     default:
       gfc_error ("%qs at %C is not a variable", sym->name);
diff --git gcc/gcc/fortran/trans-array.c gcc/gcc/fortran/trans-array.c
index 2699a76..690a3f4 100644
--- gcc/gcc/fortran/trans-array.c
+++ gcc/gcc/fortran/trans-array.c
@@ -4032,6 +4032,7 @@  done:
 		    continue;
 		  }
 		  /* Otherwise fall through GFC_SS_FUNCTION.  */
+		  gcc_fallthrough ();
 	      }
 	    case GFC_ISYM_LCOBOUND:
 	    case GFC_ISYM_UCOBOUND:
diff --git gcc/gcc/fortran/trans-expr.c gcc/gcc/fortran/trans-expr.c
index 19239fb..f0b68f2 100644
--- gcc/gcc/fortran/trans-expr.c
+++ gcc/gcc/fortran/trans-expr.c
@@ -2116,6 +2116,7 @@  flatten_array_ctors_without_strlen (gfc_expr* e)
 	}
 
       /* Otherwise, fall through to handle constructor elements.  */
+      gcc_fallthrough ();
     case EXPR_STRUCTURE:
       for (c = gfc_constructor_first (e->value.constructor);
 	   c; c = gfc_constructor_next (c))
diff --git gcc/gcc/fortran/trans-io.c gcc/gcc/fortran/trans-io.c
index 2c84349..5572899 100644
--- gcc/gcc/fortran/trans-io.c
+++ gcc/gcc/fortran/trans-io.c
@@ -2380,6 +2380,7 @@  transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr,
 	    }
 	  /* If a CLASS object gets through to here, fall through and ICE.  */
 	}
+      gcc_fallthrough ();
     default:
       gfc_internal_error ("Bad IO basetype (%d)", ts->type);
     }
diff --git gcc/gcc/genattrtab.c gcc/gcc/genattrtab.c
index 1668e71..c8e166e 100644
--- gcc/gcc/genattrtab.c
+++ gcc/gcc/genattrtab.c
@@ -1219,6 +1219,7 @@  make_canonical (file_location loc, struct attr_desc *attr, rtx exp)
 
       exp = newexp;
       /* Fall through to COND case since this is now a COND.  */
+      gcc_fallthrough ();
 
     case COND:
       {
@@ -3615,6 +3616,7 @@  write_test_expr (FILE *outf, rtx exp, unsigned int attrs_cached, int flags,
 	}
 
       /* Otherwise, fall through to normal unary operator.  */
+      gcc_fallthrough ();
 
     /* Unary operators.  */
     case ABS:  case NEG:
diff --git gcc/gcc/genpreds.c gcc/gcc/genpreds.c
index 4c9dfc6..f2cedb5 100644
--- gcc/gcc/genpreds.c
+++ gcc/gcc/genpreds.c
@@ -74,7 +74,7 @@  validate_exp (rtx exp, const char *name, file_location loc)
 	      }
 	  }
       }
-      /* fall through */
+      gcc_fallthrough ();
 
       /* These need no special checking.  */
     case MATCH_OPERAND:
diff --git gcc/gcc/gimple-ssa-strength-reduction.c gcc/gcc/gimple-ssa-strength-reduction.c
index 9e0b3d1..e65be92 100644
--- gcc/gcc/gimple-ssa-strength-reduction.c
+++ gcc/gcc/gimple-ssa-strength-reduction.c
@@ -1690,7 +1690,7 @@  find_candidates_dom_walker::before_dom_children (basic_block bb)
 	    case POINTER_PLUS_EXPR:
 	    case MINUS_EXPR:
 	      rhs2 = gimple_assign_rhs2 (gs);
-	      /* Fall-through.  */
+	      gcc_fallthrough ();
 
 	    CASE_CONVERT:
 	    case MODIFY_EXPR:
diff --git gcc/gcc/godump.c gcc/gcc/godump.c
index e3448a1..608542c 100644
--- gcc/gcc/godump.c
+++ gcc/gcc/godump.c
@@ -893,6 +893,7 @@  go_format_type (struct godump_container *container, tree type,
     case UNION_TYPE:
       is_union = true;
       /* Fall through to RECORD_TYPE case.  */
+      gcc_fallthrough ();
     case RECORD_TYPE:
       {
 	unsigned int prev_field_end;
diff --git gcc/gcc/reload1.c gcc/gcc/reload1.c
index 2a9a562..be3d110 100644
--- gcc/gcc/reload1.c
+++ gcc/gcc/reload1.c
@@ -3030,6 +3030,7 @@  elimination_effects (rtx x, machine_mode mem_mode)
 	break;
 
       /* Fall through to generic unary operation case.  */
+      gcc_fallthrough ();
     case STRICT_LOW_PART:
     case NEG:          case NOT:
     case SIGN_EXTEND:  case ZERO_EXTEND:
diff --git gcc/gcc/resource.c gcc/gcc/resource.c
index ae2f5d8..6e58b3b 100644
--- gcc/gcc/resource.c
+++ gcc/gcc/resource.c
@@ -364,6 +364,7 @@  mark_referenced_resources (rtx x, struct resources *res,
 	}
 
       /* ... fall through to other INSN processing ...  */
+      gcc_fallthrough ();
 
     case INSN:
     case JUMP_INSN:
@@ -674,6 +675,7 @@  mark_set_resources (rtx x, struct resources *res, int in_dest,
 	}
 
       /* ... and also what its RTL says it modifies, if anything.  */
+      gcc_fallthrough ();
 
     case JUMP_INSN:
     case INSN:
diff --git gcc/gcc/tree-ssa-loop-ivopts.c gcc/gcc/tree-ssa-loop-ivopts.c
index 62ba71b..1f9eb8a 100644
--- gcc/gcc/tree-ssa-loop-ivopts.c
+++ gcc/gcc/tree-ssa-loop-ivopts.c
@@ -1885,8 +1885,8 @@  find_deriving_biv_for_expr (struct ivopts_data *data, tree expr)
       iv = find_deriving_biv_for_expr (data, e2);
       if (iv)
 	return iv;
+      gcc_fallthrough ();
 
-      /* Fallthru.  */
     CASE_CONVERT:
       /* Casts are simple.  */
       return find_deriving_biv_for_expr (data, e1);
diff --git gcc/gcc/varasm.c gcc/gcc/varasm.c
index 00a9b30..fc56b98 100644
--- gcc/gcc/varasm.c
+++ gcc/gcc/varasm.c
@@ -4173,7 +4173,7 @@  output_addressed_constants (tree exp)
     case POINTER_PLUS_EXPR:
     case MINUS_EXPR:
       output_addressed_constants (TREE_OPERAND (exp, 1));
-      /* Fall through.  */
+      gcc_fallthrough ();
 
     CASE_CONVERT:
     case VIEW_CONVERT_EXPR:
diff --git gcc/libstdc++-v3/libsupc++/hash_bytes.cc gcc/libstdc++-v3/libsupc++/hash_bytes.cc
index 2e5bbfa..1042de6 100644
--- gcc/libstdc++-v3/libsupc++/hash_bytes.cc
+++ gcc/libstdc++-v3/libsupc++/hash_bytes.cc
@@ -95,8 +95,10 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       {
       case 3:
 	hash ^= static_cast<unsigned char>(buf[2]) << 16;
+	[[gnu::fallthrough]];
       case 2:
 	hash ^= static_cast<unsigned char>(buf[1]) << 8;
+	[[gnu::fallthrough]];
       case 1:
 	hash ^= static_cast<unsigned char>(buf[0]);
 	hash *= m;