rts: annotate switch/case with '/* fallthrough */'
authorSergei Trofimovich <slyfox@gentoo.org>
Sun, 14 May 2017 19:22:37 +0000 (20:22 +0100)
committerSergei Trofimovich <slyfox@gentoo.org>
Sun, 14 May 2017 19:30:53 +0000 (20:30 +0100)
Fixes gcc-7.1.0 warnings of form:

  rts/sm/Scav.c:559:9: error:
     error: this statement may fall through [-Werror=implicit-fallthrough=]
             scavenge_fun_srt(info);
             ^~~~~~~~~~~~~~~~~~~~~~

Many of places are indeed unobvious and some are
already annotated by comments.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
rts/RaiseAsync.c
rts/sm/CNF.c
rts/sm/MarkWeak.c
rts/sm/Sanity.c
rts/sm/Scav.c

index 31cc915..e04a875 100644 (file)
@@ -459,6 +459,7 @@ check_target:
         // fall to next
     }
 #endif
+    /* fallthrough */
     case BlockedOnCCall:
         blockedThrowTo(cap,target,msg);
         return THROWTO_BLOCKED;
index f740d05..bdb018d 100644 (file)
@@ -689,14 +689,17 @@ verify_consistency_block (StgCompactNFData *str, StgCompactNFDataBlock *block)
         switch (info->type) {
         case CONSTR_1_0:
             check_object_in_compact(str, UNTAG_CLOSURE(q->payload[0]));
+            /* fallthrough */
         case CONSTR_0_1:
             p += sizeofW(StgClosure) + 1;
             break;
 
         case CONSTR_2_0:
             check_object_in_compact(str, UNTAG_CLOSURE(q->payload[1]));
+            /* fallthrough */
         case CONSTR_1_1:
             check_object_in_compact(str, UNTAG_CLOSURE(q->payload[0]));
+            /* fallthrough */
         case CONSTR_0_2:
             p += sizeofW(StgClosure) + 2;
             break;
@@ -928,6 +931,7 @@ fixup_block(StgCompactNFDataBlock *block, StgWord *fixup_table, uint32_t count)
             if (!fixup_one_pointer(fixup_table, count,
                                    &((StgClosure*)p)->payload[0]))
                 return false;
+            /* fallthrough */
         case CONSTR_0_1:
             p += sizeofW(StgClosure) + 1;
             break;
@@ -936,10 +940,12 @@ fixup_block(StgCompactNFDataBlock *block, StgWord *fixup_table, uint32_t count)
             if (!fixup_one_pointer(fixup_table, count,
                                    &((StgClosure*)p)->payload[1]))
                 return false;
+            /* fallthrough */
         case CONSTR_1_1:
             if (!fixup_one_pointer(fixup_table, count,
                                    &((StgClosure*)p)->payload[0]))
                 return false;
+            /* fallthrough */
         case CONSTR_0_2:
             p += sizeofW(StgClosure) + 2;
             break;
index c7a87a2..691e56a 100644 (file)
@@ -155,6 +155,7 @@ traverseWeakPtrList(void)
 
       // otherwise, fall through...
   }
+  /* fallthrough */
 
   case WeakPtrs:
   {
index 6bfa1cb..53b1010 100644 (file)
@@ -102,6 +102,7 @@ checkStackFrame( StgPtr c )
 
     case UPDATE_FRAME:
       ASSERT(LOOKS_LIKE_CLOSURE_PTR(((StgUpdateFrame*)c)->updatee));
+    /* fallthrough */
     case ATOMICALLY_FRAME:
     case CATCH_RETRY_FRAME:
     case CATCH_STM_FRAME:
index ab7b69f..d26a893 100644 (file)
@@ -557,6 +557,7 @@ scavenge_block (bdescr *bd)
 
     case FUN_1_0:
         scavenge_fun_srt(info);
+        /* fallthrough */
     case CONSTR_1_0:
         evacuate(&((StgClosure *)p)->payload[0]);
         p += sizeofW(StgHeader) + 1;
@@ -569,6 +570,7 @@ scavenge_block (bdescr *bd)
 
     case FUN_0_1:
         scavenge_fun_srt(info);
+        /* fallthrough */
     case CONSTR_0_1:
         p += sizeofW(StgHeader) + 1;
         break;
@@ -580,6 +582,7 @@ scavenge_block (bdescr *bd)
 
     case FUN_0_2:
         scavenge_fun_srt(info);
+        /* fallthrough */
     case CONSTR_0_2:
         p += sizeofW(StgHeader) + 2;
         break;
@@ -592,6 +595,7 @@ scavenge_block (bdescr *bd)
 
     case FUN_1_1:
         scavenge_fun_srt(info);
+        /* fallthrough */
     case CONSTR_1_1:
         evacuate(&((StgClosure *)p)->payload[0]);
         p += sizeofW(StgHeader) + 2;