2016-07-11  Marek Polacek  <pola...@redhat.com>

        PR c/7652
        * cp-demangle.c (d_print_comp_inner): Use D_FALLTHRU.
        (d_print_mod): Likewise.
        * cplus-dem.c (demangle_signature): Likewise.
        (demangle_fund_type): Likewise.
        (do_hpacc_template_const_value): Likewise.
        * d-demangle.c (dlang_value): Likewise.
        * hashtab.c (iterative_hash): Likewise.
        * regex.c (FALLTHRU): Define.
        (byte_re_match_2_internal): Use FALLTHRU.

diff --git gcc/libiberty/cp-demangle.c gcc/libiberty/cp-demangle.c
index 09d6469..6bd8e65 100644
--- gcc/libiberty/cp-demangle.c
+++ gcc/libiberty/cp-demangle.c
@@ -4824,6 +4824,7 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
          mod_inner = d_left (sub);
       }
       /* Fall through.  */
+      D_FALLTHRU ();
 
     case DEMANGLE_COMPONENT_RESTRICT_THIS:
     case DEMANGLE_COMPONENT_VOLATILE_THIS:
@@ -5634,11 +5635,13 @@ d_print_mod (struct d_print_info *dpi, int options,
     case DEMANGLE_COMPONENT_REFERENCE_THIS:
       /* For the ref-qualifier, put a space before the &.  */
       d_append_char (dpi, ' ');
+      D_FALLTHRU ();
     case DEMANGLE_COMPONENT_REFERENCE:
       d_append_char (dpi, '&');
       return;
     case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
       d_append_char (dpi, ' ');
+      D_FALLTHRU ();
     case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
       d_append_string (dpi, "&&");
       return;
diff --git gcc/libiberty/cplus-dem.c gcc/libiberty/cplus-dem.c
index d04c32a..97aa2c7 100644
--- gcc/libiberty/cplus-dem.c
+++ gcc/libiberty/cplus-dem.c
@@ -1642,6 +1642,7 @@ demangle_signature (struct work_stuff *work,
          else
            /* fall through */
            {;}
+         D_FALLTHRU ();
 
        default:
          if (AUTO_DEMANGLING || GNU_DEMANGLING)
@@ -3992,6 +3993,8 @@ demangle_fund_type (struct work_stuff *work,
          success = 0;
          break;
        }
+      /* XXX Really fallthru?  */
+      D_FALLTHRU ();
     case 'I':
       (*mangled)++;
       if (**mangled == '_')
@@ -4086,7 +4089,8 @@ do_hpacc_template_const_value (struct work_stuff *work 
ATTRIBUTE_UNUSED,
     {
       case 'N':
         string_append (result, "-");
-        /* fall through */
+       /* fall through */
+       D_FALLTHRU ();
       case 'P':
         (*mangled)++;
         break;
diff --git gcc/libiberty/d-demangle.c gcc/libiberty/d-demangle.c
index 4ad90a6..e7d39e4 100644
--- gcc/libiberty/d-demangle.c
+++ gcc/libiberty/d-demangle.c
@@ -1244,6 +1244,7 @@ dlang_value (string *decl, const char *mangled, const 
char *name, char type)
       if (*mangled < '0' || *mangled > '9')
        return NULL;
       /* Fall through */
+     D_FALLTHRU ();
     case '0': case '1': case '2': case '3': case '4':
     case '5': case '6': case '7': case '8': case '9':
       mangled = dlang_parse_integer (decl, mangled, type);
diff --git gcc/libiberty/hashtab.c gcc/libiberty/hashtab.c
index 04607ea..cd8d8c5 100644
--- gcc/libiberty/hashtab.c
+++ gcc/libiberty/hashtab.c
@@ -962,18 +962,18 @@ iterative_hash (const PTR k_in /* the key */,
   c += length;
   switch(len)              /* all the case statements fall through */
     {
-    case 11: c+=((hashval_t)k[10]<<24);
-    case 10: c+=((hashval_t)k[9]<<16);
-    case 9 : c+=((hashval_t)k[8]<<8);
+    case 11: c+=((hashval_t)k[10]<<24); D_FALLTHRU ();
+    case 10: c+=((hashval_t)k[9]<<16); D_FALLTHRU ();
+    case 9 : c+=((hashval_t)k[8]<<8); D_FALLTHRU ();
       /* the first byte of c is reserved for the length */
-    case 8 : b+=((hashval_t)k[7]<<24);
-    case 7 : b+=((hashval_t)k[6]<<16);
-    case 6 : b+=((hashval_t)k[5]<<8);
-    case 5 : b+=k[4];
-    case 4 : a+=((hashval_t)k[3]<<24);
-    case 3 : a+=((hashval_t)k[2]<<16);
-    case 2 : a+=((hashval_t)k[1]<<8);
-    case 1 : a+=k[0];
+    case 8 : b+=((hashval_t)k[7]<<24); D_FALLTHRU ();
+    case 7 : b+=((hashval_t)k[6]<<16); D_FALLTHRU ();
+    case 6 : b+=((hashval_t)k[5]<<8); D_FALLTHRU ();
+    case 5 : b+=k[4]; D_FALLTHRU ();
+    case 4 : a+=((hashval_t)k[3]<<24); D_FALLTHRU ();
+    case 3 : a+=((hashval_t)k[2]<<16); D_FALLTHRU ();
+    case 2 : a+=((hashval_t)k[1]<<8); D_FALLTHRU ();
+    case 1 : a+=k[0]; D_FALLTHRU ();
       /* case 0: nothing left to add */
     }
   mix(a,b,c);
diff --git gcc/libiberty/regex.c gcc/libiberty/regex.c
index 9ffc3f4..c8e5ea9 100644
--- gcc/libiberty/regex.c
+++ gcc/libiberty/regex.c
@@ -1368,6 +1368,12 @@ static const char *re_error_msgid[] =
 
 #endif /* INSIDE_RECURSION */
 
+#if __GNUC__ >= 7
+# define FALLTHRU() __builtin_fallthrough ()
+#else
+# define FALLTHRU()
+#endif
+
 #ifndef DEFINED_ONCE
 /* Avoiding alloca during matching, to placate r_alloc.  */
 
@@ -2493,6 +2499,7 @@ PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
           if ((syntax & RE_BK_PLUS_QM)
               || (syntax & RE_LIMITED_OPS))
             goto normal_char;
+         FALLTHRU ();
         handle_plus:
         case '*':
           /* If there is no previous pattern... */
@@ -3654,6 +3661,7 @@ PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
             case '(':
               if (syntax & RE_NO_BK_PARENS)
                 goto normal_backslash;
+             FALLTHRU ();
 
             handle_open:
               bufp->re_nsub++;
@@ -3711,6 +3719,7 @@ PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
                  else
                    FREE_STACK_RETURN (REG_ERPAREN);
                }
+             FALLTHRU ();
 
             handle_close:
               if (fixup_alt_jump)
@@ -3774,6 +3783,7 @@ PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
             case '|':                                  /* `\|'.  */
               if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
                 goto normal_backslash;
+             FALLTHRU ();
             handle_alt:
               if (syntax & RE_LIMITED_OPS)
                 goto normal_char;
@@ -3824,6 +3834,7 @@ PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
                         operator.  */
                  || (syntax & RE_NO_BK_BRACES))
                 goto normal_backslash;
+             FALLTHRU ();
 
             handle_interval:
               {
@@ -6697,6 +6708,7 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp,
                 {
                   case jump_n:
                    is_a_jump_n = true;
+                   FALLTHRU ();
                   case pop_failure_jump:
                  case maybe_pop_jump:
                  case jump:
@@ -7126,7 +7138,7 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp,
              goto unconditional_jump;
            }
         /* Note fall through.  */
-
+       FALLTHRU ();
 
        /* The end of a simple repeat has a pop_failure_jump back to
            its matching on_failure_jump, where the latter will push a
@@ -7151,6 +7163,7 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp,
                                reg_dummy, reg_dummy, reg_info_dummy);
           }
          /* Note fall through.  */
+         FALLTHRU ();
 
        unconditional_jump:
 #ifdef _LIBC
@@ -7453,6 +7466,7 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp,
                 {
                 case jump_n:
                   is_a_jump_n = true;
+                 FALLTHRU ();
                 case maybe_pop_jump:
                 case pop_failure_jump:
                 case jump:
@@ -7718,6 +7732,7 @@ PREFIX(common_op_match_null_string_p) (UCHAR_T **p, 
UCHAR_T *end,
 
     case set_number_at:
       p1 += 2 * OFFSET_ADDRESS_SIZE;
+      FALLTHRU ();
 
     default:
       /* All other opcodes mean we cannot match the empty string.  */

Reply via email to