diff options
author | Marek Polacek <polacek@redhat.com> | 2016-09-01 14:59:50 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2016-09-01 14:59:50 +0000 |
commit | 295844f68760cd2c8d38e5cd42ba0f81b55cb65b (patch) | |
tree | c6953867918ca0a6a2b88c76240d748598ee1ef1 | |
parent | 1ca94f3674693ee3fa656a2f8c560f3bb8aa4a6e (diff) | |
download | gcc-295844f68760cd2c8d38e5cd42ba0f81b55cb65b.zip gcc-295844f68760cd2c8d38e5cd42ba0f81b55cb65b.tar.gz gcc-295844f68760cd2c8d38e5cd42ba0f81b55cb65b.tar.bz2 |
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
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 18 | ||||
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 2 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/error.c | 6 |
6 files changed, 29 insertions, 15 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 2a38deb..8a40f75 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +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> PR c/77292 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index b29334a..399ba97 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -11547,7 +11547,7 @@ resolve_overloaded_builtin (location_t loc, tree function, /* Handle these 4 together so that they can fall through to the next case if the call is transformed to an _N variant. */ switch (orig_code) - { + { case BUILT_IN_ATOMIC_EXCHANGE: { if (resolve_overloaded_atomic_exchange (loc, function, params, @@ -11588,17 +11588,15 @@ resolve_overloaded_builtin (location_t loc, tree function, } default: gcc_unreachable (); - } - /* Fallthrough to the normal processing. */ + } } + /* FALLTHRU */ case BUILT_IN_ATOMIC_EXCHANGE_N: case BUILT_IN_ATOMIC_COMPARE_EXCHANGE_N: case BUILT_IN_ATOMIC_LOAD_N: case BUILT_IN_ATOMIC_STORE_N: - { - fetch_op = false; - /* Fallthrough to further processing. */ - } + fetch_op = false; + /* FALLTHRU */ case BUILT_IN_ATOMIC_ADD_FETCH_N: case BUILT_IN_ATOMIC_SUB_FETCH_N: case BUILT_IN_ATOMIC_AND_FETCH_N: @@ -11611,10 +11609,8 @@ resolve_overloaded_builtin (location_t loc, tree function, case BUILT_IN_ATOMIC_FETCH_NAND_N: case BUILT_IN_ATOMIC_FETCH_XOR_N: case BUILT_IN_ATOMIC_FETCH_OR_N: - { - orig_format = false; - /* Fallthru for parameter processing. */ - } + orig_format = false; + /* FALLTHRU */ case BUILT_IN_SYNC_FETCH_AND_ADD_N: case BUILT_IN_SYNC_FETCH_AND_SUB_N: case BUILT_IN_SYNC_FETCH_AND_OR_N: diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 3ac6648..6b00f9a 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +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> * c-parser.c (c_parser_declaration_or_fndef): Add trailing space diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 5194027..fc7a71e 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -605,8 +605,8 @@ composite_type (tree t1, tree t2) t1 = build_function_type (valtype, newargs); t1 = qualify_type (t1, t2); - /* ... falls through ... */ } + /* FALLTHRU */ default: return build_type_attribute_variant (t1, attributes); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c553796..e68ee62 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +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> * parser.c (cp_parser_enclosed_template_argument_list): Add fix-it diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 58cd48c..88049ee 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -575,7 +575,7 @@ dump_type (cxx_pretty_printer *pp, tree t, int flags) default: pp_unsupported_tree (pp, t); - /* Fall through to error. */ + /* Fall through. */ case ERROR_MARK: pp_string (pp, M_("<type error>")); @@ -1276,7 +1276,7 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags) default: pp_unsupported_tree (pp, t); - /* Fall through to error. */ + /* Fall through. */ case ERROR_MARK: pp_string (pp, M_("<declaration error>")); @@ -2777,7 +2777,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags) `report_error_function'. That could cause an infinite loop. */ default: pp_unsupported_tree (pp, t); - /* fall through to ERROR_MARK... */ + /* Fall through. */ case ERROR_MARK: pp_string (pp, M_("<expression error>")); break; |