lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Mar 14, 2018, at 14:59, Roberto Ierusalimschy wrote:

> BTW, there are many other cases of fallthroughs in the code. Why gcc
> only complained about those two?

It does not like where they are.

This fixes it:

diff --git a/src/lcode.c b/src/lcode.c
index 838d03a..2877d25 100644
--- a/src/lcode.c
+++ b/src/lcode.c
@@ -1696,8 +1696,8 @@ void luaK_finish (FuncState *fs) {
           break;  /* no extra work */
         /* else use OP_RETURN to do the extra work */
         SET_OPCODE(*pc, OP_RETURN);
-        /* FALLTHROUGH */
       }
+      /* FALLTHROUGH */
       case OP_RETURN: case OP_TAILCALL: {
         if (p->sizep > 0 || p->is_vararg) {
           SETARG_C(*pc, p->is_vararg ? p->numparams + 1 : 0);
diff --git a/src/lgc.c b/src/lgc.c
index 6ab04f7..d4bd059 100644
--- a/src/lgc.c
+++ b/src/lgc.c
@@ -301,8 +301,8 @@ static void reallymarkobject (global_State *g, GCObject *o) {
         gray2black(o);  /* nothing else to mark */
         break;
       }
-      /* else *//* FALLTHROUGH */
     }
+    /* FALLTHROUGH */
     case LUA_TLCL: case LUA_TCCL: case LUA_TTABLE:
     case LUA_TTHREAD: case LUA_TPROTO: {
       linkobjgclist(o, g->gray);

-- 
Pierre Chapuis