[commit: ghc] master: rts: annotate switch/case with '/* fallthrough */' (230416f)

git at git.haskell.org git at git.haskell.org
Sun May 14 19:34:42 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/230416f8b6f6731064115a2905ad354e27b7d605/ghc

>---------------------------------------------------------------

commit 230416f8b6f6731064115a2905ad354e27b7d605
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date:   Sun May 14 20:22:37 2017 +0100

    rts: annotate switch/case with '/* fallthrough */'
    
    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 at gentoo.org>


>---------------------------------------------------------------

230416f8b6f6731064115a2905ad354e27b7d605
 rts/RaiseAsync.c  | 1 +
 rts/sm/CNF.c      | 6 ++++++
 rts/sm/MarkWeak.c | 1 +
 rts/sm/Sanity.c   | 1 +
 rts/sm/Scav.c     | 4 ++++
 5 files changed, 13 insertions(+)

diff --git a/rts/RaiseAsync.c b/rts/RaiseAsync.c
index 31cc915..e04a875 100644
--- a/rts/RaiseAsync.c
+++ b/rts/RaiseAsync.c
@@ -459,6 +459,7 @@ check_target:
         // fall to next
     }
 #endif
+    /* fallthrough */
     case BlockedOnCCall:
         blockedThrowTo(cap,target,msg);
         return THROWTO_BLOCKED;
diff --git a/rts/sm/CNF.c b/rts/sm/CNF.c
index f740d05..bdb018d 100644
--- a/rts/sm/CNF.c
+++ b/rts/sm/CNF.c
@@ -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;
diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c
index c7a87a2..691e56a 100644
--- a/rts/sm/MarkWeak.c
+++ b/rts/sm/MarkWeak.c
@@ -155,6 +155,7 @@ traverseWeakPtrList(void)
 
       // otherwise, fall through...
   }
+  /* fallthrough */
 
   case WeakPtrs:
   {
diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c
index 6bfa1cb..53b1010 100644
--- a/rts/sm/Sanity.c
+++ b/rts/sm/Sanity.c
@@ -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:
diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c
index ab7b69f..d26a893 100644
--- a/rts/sm/Scav.c
+++ b/rts/sm/Scav.c
@@ -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;



More information about the ghc-commits mailing list