Commit 295844f6 by Marek Polacek Committed by Marek Polacek

re PR c/7652 (-Wswitch-break : Warn if a switch case falls through)

	PR c/7652
gcc/c-family/
	* c-common.c (resolve_overloaded_builtin): Fix formatting.  Add
	FALLTHRU comments.
gcc/c/
	* c-typeck.c (composite_type): Add FALLTHRU comment.
gcc/gcc/cp/
	* error.c (dump_type): Fix falls through comment.
	(dump_decl): Likewise.
	(dump_expr): Likewise.

From-SVN: r239939
parent 1ca94f36
2016-09-01 Marek Polacek <polacek@redhat.com>
PR c/7652
* c-common.c (resolve_overloaded_builtin): Fix formatting. Add
FALLTHRU comments.
2016-08-29 Marek Polacek <polacek@redhat.com> 2016-08-29 Marek Polacek <polacek@redhat.com>
PR c/77292 PR c/77292
......
...@@ -11589,16 +11589,14 @@ resolve_overloaded_builtin (location_t loc, tree function, ...@@ -11589,16 +11589,14 @@ resolve_overloaded_builtin (location_t loc, tree function,
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
/* Fallthrough to the normal processing. */
} }
/* FALLTHRU */
case BUILT_IN_ATOMIC_EXCHANGE_N: case BUILT_IN_ATOMIC_EXCHANGE_N:
case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_N: case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_N:
case BUILT_IN_ATOMIC_LOAD_N: case BUILT_IN_ATOMIC_LOAD_N:
case BUILT_IN_ATOMIC_STORE_N: case BUILT_IN_ATOMIC_STORE_N:
{
fetch_op = false; fetch_op = false;
/* Fallthrough to further processing. */ /* FALLTHRU */
}
case BUILT_IN_ATOMIC_ADD_FETCH_N: case BUILT_IN_ATOMIC_ADD_FETCH_N:
case BUILT_IN_ATOMIC_SUB_FETCH_N: case BUILT_IN_ATOMIC_SUB_FETCH_N:
case BUILT_IN_ATOMIC_AND_FETCH_N: case BUILT_IN_ATOMIC_AND_FETCH_N:
...@@ -11611,10 +11609,8 @@ resolve_overloaded_builtin (location_t loc, tree function, ...@@ -11611,10 +11609,8 @@ resolve_overloaded_builtin (location_t loc, tree function,
case BUILT_IN_ATOMIC_FETCH_NAND_N: case BUILT_IN_ATOMIC_FETCH_NAND_N:
case BUILT_IN_ATOMIC_FETCH_XOR_N: case BUILT_IN_ATOMIC_FETCH_XOR_N:
case BUILT_IN_ATOMIC_FETCH_OR_N: case BUILT_IN_ATOMIC_FETCH_OR_N:
{
orig_format = false; orig_format = false;
/* Fallthru for parameter processing. */ /* FALLTHRU */
}
case BUILT_IN_SYNC_FETCH_AND_ADD_N: case BUILT_IN_SYNC_FETCH_AND_ADD_N:
case BUILT_IN_SYNC_FETCH_AND_SUB_N: case BUILT_IN_SYNC_FETCH_AND_SUB_N:
case BUILT_IN_SYNC_FETCH_AND_OR_N: case BUILT_IN_SYNC_FETCH_AND_OR_N:
......
2016-09-01 Marek Polacek <polacek@redhat.com>
PR c/7652
* c-typeck.c (composite_type): Add FALLTHRU comment.
2016-08-31 David Malcolm <dmalcolm@redhat.com> 2016-08-31 David Malcolm <dmalcolm@redhat.com>
* c-parser.c (c_parser_declaration_or_fndef): Add trailing space * c-parser.c (c_parser_declaration_or_fndef): Add trailing space
......
...@@ -605,8 +605,8 @@ composite_type (tree t1, tree t2) ...@@ -605,8 +605,8 @@ composite_type (tree t1, tree t2)
t1 = build_function_type (valtype, newargs); t1 = build_function_type (valtype, newargs);
t1 = qualify_type (t1, t2); t1 = qualify_type (t1, t2);
/* ... falls through ... */
} }
/* FALLTHRU */
default: default:
return build_type_attribute_variant (t1, attributes); return build_type_attribute_variant (t1, attributes);
......
2016-09-01 Marek Polacek <polacek@redhat.com>
PR c/7652
* error.c (dump_type): Fix falls through comment.
(dump_decl): Likewise.
(dump_expr): Likewise.
2016-08-30 David Malcolm <dmalcolm@redhat.com> 2016-08-30 David Malcolm <dmalcolm@redhat.com>
* parser.c (cp_parser_enclosed_template_argument_list): Add fix-it * parser.c (cp_parser_enclosed_template_argument_list): Add fix-it
......
...@@ -575,7 +575,7 @@ dump_type (cxx_pretty_printer *pp, tree t, int flags) ...@@ -575,7 +575,7 @@ dump_type (cxx_pretty_printer *pp, tree t, int flags)
default: default:
pp_unsupported_tree (pp, t); pp_unsupported_tree (pp, t);
/* Fall through to error. */ /* Fall through. */
case ERROR_MARK: case ERROR_MARK:
pp_string (pp, M_("<type error>")); pp_string (pp, M_("<type error>"));
...@@ -1276,7 +1276,7 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags) ...@@ -1276,7 +1276,7 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags)
default: default:
pp_unsupported_tree (pp, t); pp_unsupported_tree (pp, t);
/* Fall through to error. */ /* Fall through. */
case ERROR_MARK: case ERROR_MARK:
pp_string (pp, M_("<declaration error>")); pp_string (pp, M_("<declaration error>"));
...@@ -2777,7 +2777,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags) ...@@ -2777,7 +2777,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags)
`report_error_function'. That could cause an infinite loop. */ `report_error_function'. That could cause an infinite loop. */
default: default:
pp_unsupported_tree (pp, t); pp_unsupported_tree (pp, t);
/* fall through to ERROR_MARK... */ /* Fall through. */
case ERROR_MARK: case ERROR_MARK:
pp_string (pp, M_("<expression error>")); pp_string (pp, M_("<expression error>"));
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment