libiberty: Fix -Wimplicit-fallthrough warnings.
authorMark Wielaard <mjw@redhat.com>
Fri, 4 Nov 2016 23:55:01 +0000 (23:55 +0000)
committerMark Wielaard <mark@klomp.org>
Fri, 18 Nov 2016 10:06:18 +0000 (11:06 +0100)
Adjust some comments, add some explicit fall through comments or explicit
returns where necessary to not get implicit-fallthrough warnings.

All fall throughs were deliberate. In one case I added an explicit return
false for clarity instead of falling through a default case (that also
would return false).

libiberty/ChangeLog:

       * cplus-dem.c (demangle_signature): Move fall through comment.
       (demangle_fund_type): Add fall through comment between 'G' and 'I'.
       * hashtab.c (iterative_hash): Add fall through comments.
       * regex.c (regex_compile): Add Fall through comment after '+'/'?'.
       (byte_re_match_2_internal): Add Fall through comment after jump_n.
       Change "Note fall through" to "Fall through".
       (common_op_match_null_string_p): Return false after set_number_at
       instead of fall through.

libiberty/ChangeLog
libiberty/cplus-dem.c
libiberty/hashtab.c
libiberty/regex.c

index 5dd812b748a4246cfccb9104550b154a779c925b..27c275b9e6cd9d9c257f9872ae4b3903ac697d4c 100644 (file)
@@ -1,3 +1,14 @@
+2016-11-02  Mark Wielaard  <mjw@redhat.com>
+
+       * cplus-dem.c (demangle_signature): Move fall through comment.
+       (demangle_fund_type): Add fall through comment between 'G' and 'I'.
+       * hashtab.c (iterative_hash): Add fall through comments.
+       * regex.c (regex_compile): Add Fall through comment after '+'/'?'.
+       (byte_re_match_2_internal): Add Fall through comment after jump_n.
+       Change "Note fall through" to "Fall through".
+       (common_op_match_null_string_p): Return false after set_number_at
+       instead of fall through.
+
 2016-11-01  Jason Merrill  <jason@redhat.com>
 
        * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor.
index 7f63397f2d447ef9e06e133c33d3931754b6dd1c..c955bfbe1e7d768b452a5ee24141c4581b3b7849 100644 (file)
@@ -1657,9 +1657,7 @@ demangle_signature (struct work_stuff *work,
              (*mangled)++;
              break;
            }
-         else
-           /* fall through */
-           {;}
+         /* fall through */
 
        default:
          if (AUTO_DEMANGLING || GNU_DEMANGLING)
@@ -4024,6 +4022,7 @@ demangle_fund_type (struct work_stuff *work,
          success = 0;
          break;
        }
+      /* fall through */
     case 'I':
       (*mangled)++;
       if (**mangled == '_')
index 04607ea6a0167bb2c48a7ac847bc5ac968b3a783..99381b17fd60805883a8eb665c73821292b9b8b3 100644 (file)
@@ -962,17 +962,17 @@ 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);        /* fall through */
+    case 10: c+=((hashval_t)k[9]<<16); /* fall through */
+    case 9 : c+=((hashval_t)k[8]<<8);  /* fall through */
       /* 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 8 : b+=((hashval_t)k[7]<<24); /* fall through */
+    case 7 : b+=((hashval_t)k[6]<<16); /* fall through */
+    case 6 : b+=((hashval_t)k[5]<<8);  /* fall through */
+    case 5 : b+=k[4];                  /* fall through */
+    case 4 : a+=((hashval_t)k[3]<<24); /* fall through */
+    case 3 : a+=((hashval_t)k[2]<<16); /* fall through */
+    case 2 : a+=((hashval_t)k[1]<<8);  /* fall through */
     case 1 : a+=k[0];
       /* case 0: nothing left to add */
     }
index 9ffc3f47f006d89b7c046b704e7ac6cc0ae78d80..6854e3b41a018dca47e68afb74e33b12e93dd8b3 100644 (file)
@@ -2493,6 +2493,7 @@ PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
           if ((syntax & RE_BK_PLUS_QM)
               || (syntax & RE_LIMITED_OPS))
             goto normal_char;
+         /* Fall through.  */
         handle_plus:
         case '*':
           /* If there is no previous pattern... */
@@ -6697,6 +6698,7 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp,
                 {
                   case jump_n:
                    is_a_jump_n = true;
+                   /* Fall through.  */
                   case pop_failure_jump:
                  case maybe_pop_jump:
                  case jump:
@@ -7125,7 +7127,7 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp,
               DEBUG_PRINT1 ("  Match => jump.\n");
              goto unconditional_jump;
            }
-        /* Note fall through.  */
+        /* Fall through.  */
 
 
        /* The end of a simple repeat has a pop_failure_jump back to
@@ -7150,7 +7152,7 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp,
                                dummy_low_reg, dummy_high_reg,
                                reg_dummy, reg_dummy, reg_info_dummy);
           }
-         /* Note fall through.  */
+         /* Fall through.  */
 
        unconditional_jump:
 #ifdef _LIBC
@@ -7453,6 +7455,7 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp,
                 {
                 case jump_n:
                   is_a_jump_n = true;
+                 /* Fall through.  */
                 case maybe_pop_jump:
                 case pop_failure_jump:
                 case jump:
@@ -7718,6 +7721,7 @@ PREFIX(common_op_match_null_string_p) (UCHAR_T **p, UCHAR_T *end,
 
     case set_number_at:
       p1 += 2 * OFFSET_ADDRESS_SIZE;
+      return false;
 
     default:
       /* All other opcodes mean we cannot match the empty string.  */
This page took 0.03494 seconds and 4 git commands to generate.