re PR c/7652 (-Wswitch-break : Warn if a switch case falls through)
authorMarek Polacek <polacek@redhat.com>
Thu, 18 Aug 2016 10:28:03 +0000 (10:28 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 18 Aug 2016 10:28:03 +0000 (10:28 +0000)
PR c/7652
gcc/cp/
* call.c (add_builtin_candidate): Add gcc_fallthrough.
* cxx-pretty-print.c (pp_cxx_unqualified_id): Likewise.
* parser.c (cp_parser_skip_to_end_of_statement): Likewise.
(cp_parser_cache_defarg): Likewise.
libcpp/
* pch.c (write_macdef): Add CPP_FALLTHRU.

From-SVN: r239566

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cxx-pretty-print.c
gcc/cp/parser.c
libcpp/ChangeLog
libcpp/pch.c

index 52965b8cfe081d02c7b34753d9dfe3f1404cf2ee..705a0346452b89c1c4a8a741b1637d0ea79e89a0 100644 (file)
@@ -1,3 +1,11 @@
+2016-08-18  Marek Polacek  <polacek@redhat.com>
+
+       PR c/7652
+       * call.c (add_builtin_candidate): Add gcc_fallthrough.
+       * cxx-pretty-print.c (pp_cxx_unqualified_id): Likewise.
+       * parser.c (cp_parser_skip_to_end_of_statement): Likewise.
+       (cp_parser_cache_defarg): Likewise.
+
 2016-08-12  Marek Polacek  <polacek@redhat.com>
 
        PR c/7652
index 0203cd1c7b2673659a9c4d1b484c40f25d6c4928..05f0431b2a5dc12ed54efcbf677298ed41fe5f13 100644 (file)
@@ -2544,6 +2544,8 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
          type2 = ptrdiff_type_node;
          break;
        }
+      /* XXX Really fallthru?  */
+      /* FALLTHRU */
     case MULT_EXPR:
     case TRUNC_DIV_EXPR:
       if (ARITHMETIC_TYPE_P (type1) && ARITHMETIC_TYPE_P (type2))
index 370476c1916e158a09005e5c2ff31ad474465597..f4d2a2eef2307293e54a9843d3f965b267bd3eb6 100644 (file)
@@ -142,6 +142,8 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
 
     case OVERLOAD:
       t = OVL_CURRENT (t);
+      /* XXX Really fallthru?  */
+      /* FALLTHRU */
     case VAR_DECL:
     case PARM_DECL:
     case CONST_DECL:
index 48510d0927fd00e58c3baa80dc2c7c5fc14d53af..690e92846a83bdfa638452c3863b0a054bb54951 100644 (file)
@@ -3490,6 +3490,8 @@ cp_parser_skip_to_end_of_statement (cp_parser* parser)
              cp_lexer_consume_token (parser->lexer);
              return;
            }
+         /* XXX Really fallthru?  */
+         /* FALLTHRU */
 
        case CPP_OPEN_BRACE:
          ++nesting_depth;
@@ -27669,6 +27671,8 @@ cp_parser_cache_defarg (cp_parser *parser, bool nsdmi)
              parser->in_template_argument_list_p = saved_italp;
              break;
            }
+         /* XXX Really fallthru?  */
+         /* FALLTHRU */
        case CPP_CLOSE_PAREN:
        case CPP_ELLIPSIS:
          /* If we run into a non-nested `;', `}', or `]',
index c049599784b0d9e46ad80ada16d0889b3a0f9580..e700dfe31e06cfa2f9877163d522be9188af8346 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-18  Marek Polacek  <polacek@redhat.com>
+
+       PR c/7652
+       * pch.c (write_macdef): Add CPP_FALLTHRU.
+
 2016-08-12  Marek Polacek  <polacek@redhat.com>
 
        PR c/7652
index fb9696d5769435169ea1526553a32a161e06a41f..04064c0af354e110b729a63111a769f58f48bf6e 100644 (file)
@@ -55,6 +55,8 @@ write_macdef (cpp_reader *pfile, cpp_hashnode *hn, void *file_p)
     case NT_VOID:
       if (! (hn->flags & NODE_POISONED))
        return 1;
+      /* XXX Really fallthru?  */
+      /* FALLTHRU */
 
     case NT_MACRO:
       if ((hn->flags & NODE_BUILTIN)