re PR c/7652 (-Wswitch-break : Warn if a switch case falls through)
authorMarek Polacek <polacek@redhat.com>
Thu, 1 Sep 2016 14:59:50 +0000 (14:59 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 1 Sep 2016 14:59:50 +0000 (14:59 +0000)
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

gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c/ChangeLog
gcc/c/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/error.c

index 2a38deb1666e5e66150245f7c9f0d9bd59cbe81a..8a40f75da4f4fd70d62a6dda9c9bbee7dba88111 100644 (file)
@@ -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
index b29334ad9af2f3fd43eff20c07c4415fab4dc58d..399ba975184e934bc061113286787840a7531291 100644 (file)
@@ -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:
index 3ac6648b45a2f6c4b599b9e72fd5e89eb41cd4a0..6b00f9a5f1e6b9695ac889c731098e493160439a 100644 (file)
@@ -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
index 51940273d69a239f812bb29fb7b148f0f13afb12..fc7a71ef21ab5270fed470c291a1c06d9d8472ff 100644 (file)
@@ -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);
index c553796d7bf75237c03e95eb249f179d351b6652..e68ee629600ae9ad1de847b6e48d84b60c4ea7e3 100644 (file)
@@ -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
index 58cd48c0a1406048f8a02e39ba78372ca09095ef..88049ee8f1a4bf2fe5dc2ea2e7879dc0f5f5f07c 100644 (file)
@@ -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;