From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 773F0589F42; Tue, 15 Aug 2023 16:17:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 773F0589F42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1692105426; bh=Yrh8f0lPlyZU4Seb7p2314tuLOXm54c40CSH3KJ9t0k=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=fYN1GUNE69aIpWdcTzFGxh2JwuWTFoAP6ZRvrXgqnWovnWiqyqLczycnlV+9Slckf Y2u4OIkhChd3ZsX3Wt5Ip0MyrPNs1qkj5Pk8YmMW6PDpnSDqIpC1o8g3XCI6XQp8Lo glGGMqzqrPFUqJai0FOjLqj6yDr9fYqXedB/mVCQ= Received: from smtp53.i.mail.ru (smtp53.i.mail.ru [95.163.41.90]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 39A82589F42 for ; Tue, 15 Aug 2023 16:17:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 39A82589F42 Received: by smtp53.i.mail.ru with esmtpa (envelope-from ) id 1qVtuy-00EIqs-1j; Tue, 15 Aug 2023 16:17:04 +0300 Date: Tue, 15 Aug 2023 16:17:04 +0300 To: Sergey Kaplun Message-ID: References: <4a61aa2abda31b52418bdfee2890be727e4738a4.1691592488.git.skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4a61aa2abda31b52418bdfee2890be727e4738a4.1691592488.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD969E04B5EED670DC804E38A5F9341E5D89B81E0241E25E490182A05F5380850407F064EB8383FB3EA35FED4F1C8EECC82779B8432C502310A56DD05F0459DD2FF X-C1DE0DAB: 0D63561A33F958A585AF483590E1965096EF65C08AB5295AE009ED81786A57A7F87CCE6106E1FC07E67D4AC08A07B9B064E7220B7C550592CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0AD5177F0B940C8B66ECE892A7B2722663E91682638B966EB3F662256BEEFA9527FC164960877BC4E503BC920B965BA665201743D10542207397D2F2CEE7261B3248F940932FE8ADF9C37FD76D11AF80A0D8401B6E15CD62A22FB0C9A64B1F3520EEA455F16B58544A21C197AAF4D2E4732965026E5D17F6739C77C69D99B9914278E50E1F0597A6FD5CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojHVl7ekwB6hjUSYQ3r6/lLQ== X-Mailru-Sender: 11C2EC085EDE56FA38FD4C59F7EFE407721A58A5B596453B9C6958A2B39942E1B25386A05AB4F18ED51284F0FE6F529ABC7555A253F5B200DF104D74F62EE79D27EC13EC74F6107F4198E0F3ECE9B5443453F38A29522196 X-Mras: OK Subject: Re: [Tarantool-patches] [PATCH luajit 11/19] Fix GCC 7 -Wimplicit-fallthrough warnings. X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the patch! LGTM as trivial, except for a few comments regarding the commit message below. On Wed, Aug 09, 2023 at 06:36:00PM +0300, Sergey Kaplun via Tarantool-patches wrote: > From: Mike Pall > > (cherry-picked from commit d4ee80342770d1281e2ce877f8ae8ab1d99e6528) > > This patch adds the `/* fallthrough */` where it may trigger the > `-Wimplicit-fallthrough` [1] warning. Some cases still not covered by Typo: s/cases still/cases are still/ > this comment and will be fixed in the future commits. Typo: s/in the/in/ > > [1]: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-fallthrough > > Sergey Kaplun: > * added the description for the commit > > Part of tarantool/tarantool#8825 > --- > dynasm/dasm_arm.h | 2 ++ > dynasm/dasm_mips.h | 1 + > dynasm/dasm_ppc.h | 1 + > dynasm/dasm_x86.h | 18 ++++++++++++++---- > src/lj_asm.c | 7 ++++++- > src/lj_cparse.c | 10 ++++++++++ > src/lj_err.c | 1 + > src/lj_opt_sink.c | 2 +- > src/lj_parse.c | 3 ++- > src/luajit.c | 1 + > 10 files changed, 39 insertions(+), 7 deletions(-) > > diff --git a/dynasm/dasm_arm.h b/dynasm/dasm_arm.h > index a43f7c66..1d404ccd 100644 > --- a/dynasm/dasm_arm.h > +++ b/dynasm/dasm_arm.h > @@ -254,6 +254,7 @@ void dasm_put(Dst_DECL, int start, ...) > case DASM_IMMV8: > CK((n & 3) == 0, RANGE_I); > n >>= 2; > + /* fallthrough */ > case DASM_IMML8: > case DASM_IMML12: > CK(n >= 0 ? ((n>>((ins>>5)&31)) == 0) : > @@ -371,6 +372,7 @@ int dasm_encode(Dst_DECL, void *buffer) > break; > case DASM_REL_LG: > CK(n >= 0, UNDEF_LG); > + /* fallthrough */ > case DASM_REL_PC: > CK(n >= 0, UNDEF_PC); > n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base) - 4; > diff --git a/dynasm/dasm_mips.h b/dynasm/dasm_mips.h > index 4b49fd8c..71a835b2 100644 > --- a/dynasm/dasm_mips.h > +++ b/dynasm/dasm_mips.h > @@ -350,6 +350,7 @@ int dasm_encode(Dst_DECL, void *buffer) > break; > case DASM_REL_LG: > CK(n >= 0, UNDEF_LG); > + /* fallthrough */ > case DASM_REL_PC: > CK(n >= 0, UNDEF_PC); > n = *DASM_POS2PTR(D, n); > diff --git a/dynasm/dasm_ppc.h b/dynasm/dasm_ppc.h > index 3a7ee9b0..83fc030a 100644 > --- a/dynasm/dasm_ppc.h > +++ b/dynasm/dasm_ppc.h > @@ -354,6 +354,7 @@ int dasm_encode(Dst_DECL, void *buffer) > break; > case DASM_REL_LG: > CK(n >= 0, UNDEF_LG); > + /* fallthrough */ > case DASM_REL_PC: > CK(n >= 0, UNDEF_PC); > n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base); > diff --git a/dynasm/dasm_x86.h b/dynasm/dasm_x86.h > index bc636357..2a276042 100644 > --- a/dynasm/dasm_x86.h > +++ b/dynasm/dasm_x86.h > @@ -194,12 +194,13 @@ void dasm_put(Dst_DECL, int start, ...) > switch (action) { > case DASM_DISP: > if (n == 0) { if (mrm < 0) mrm = p[-2]; if ((mrm&7) != 5) break; } > - case DASM_IMM_DB: if (((n+128)&-256) == 0) goto ob; > + /* fallthrough */ > + case DASM_IMM_DB: if (((n+128)&-256) == 0) goto ob; /* fallthrough */ > case DASM_REL_A: /* Assumes ptrdiff_t is int. !x64 */ > case DASM_IMM_D: ofs += 4; break; > case DASM_IMM_S: CK(((n+128)&-256) == 0, RANGE_I); goto ob; > case DASM_IMM_B: CK((n&-256) == 0, RANGE_I); ob: ofs++; break; > - case DASM_IMM_WB: if (((n+128)&-256) == 0) goto ob; > + case DASM_IMM_WB: if (((n+128)&-256) == 0) goto ob; /* fallthrough */ > case DASM_IMM_W: CK((n&-65536) == 0, RANGE_I); ofs += 2; break; > case DASM_SPACE: p++; ofs += n; break; > case DASM_SETLABEL: b[pos-2] = -0x40000000; break; /* Neg. label ofs. */ > @@ -207,8 +208,8 @@ void dasm_put(Dst_DECL, int start, ...) > if (*p < 0x40 && p[1] == DASM_DISP) mrm = n; > if (*p < 0x20 && (n&7) == 4) ofs++; > switch ((*p++ >> 3) & 3) { > - case 3: n |= b[pos-3]; > - case 2: n |= b[pos-2]; > + case 3: n |= b[pos-3]; /* fallthrough */ > + case 2: n |= b[pos-2]; /* fallthrough */ > case 1: if (n <= 7) { b[pos-1] |= 0x10; ofs--; } > } > continue; > @@ -329,11 +330,14 @@ int dasm_link(Dst_DECL, size_t *szp) > pos += 2; > break; > } > + /* fallthrough */ > case DASM_SPACE: case DASM_IMM_LG: case DASM_VREG: p++; > + /* fallthrough */ > case DASM_DISP: case DASM_IMM_S: case DASM_IMM_B: case DASM_IMM_W: > case DASM_IMM_D: case DASM_IMM_WB: case DASM_IMM_DB: > case DASM_SETLABEL: case DASM_REL_A: case DASM_IMM_PC: pos++; break; > case DASM_LABEL_LG: p++; > + /* fallthrough */ > case DASM_LABEL_PC: b[pos++] += ofs; break; /* Fix label offset. */ > case DASM_ALIGN: ofs -= (b[pos++]+ofs)&*p++; break; /* Adjust ofs. */ > case DASM_EXTERN: p += 2; break; > @@ -391,12 +395,15 @@ int dasm_encode(Dst_DECL, void *buffer) > if (mrm != 5) { mm[-1] -= 0x80; break; } } > if (((n+128) & -256) != 0) goto wd; else mm[-1] -= 0x40; > } > + /* fallthrough */ > case DASM_IMM_S: case DASM_IMM_B: wb: dasmb(n); break; > case DASM_IMM_DB: if (((n+128)&-256) == 0) { > db: if (!mark) mark = cp; mark[-2] += 2; mark = NULL; goto wb; > } else mark = NULL; > + /* fallthrough */ > case DASM_IMM_D: wd: dasmd(n); break; > case DASM_IMM_WB: if (((n+128)&-256) == 0) goto db; else mark = NULL; > + /* fallthrough */ > case DASM_IMM_W: dasmw(n); break; > case DASM_VREG: { > int t = *p++; > @@ -421,6 +428,7 @@ int dasm_encode(Dst_DECL, void *buffer) > } > case DASM_REL_LG: p++; if (n >= 0) goto rel_pc; > b++; n = (int)(ptrdiff_t)D->globals[-n]; > + /* fallthrough */ > case DASM_REL_A: rel_a: n -= (int)(ptrdiff_t)(cp+4); goto wd; /* !x64 */ > case DASM_REL_PC: rel_pc: { > int shrink = *b++; > @@ -432,6 +440,7 @@ int dasm_encode(Dst_DECL, void *buffer) > } > case DASM_IMM_LG: > p++; if (n < 0) { n = (int)(ptrdiff_t)D->globals[-n]; goto wd; } > + /* fallthrough */ > case DASM_IMM_PC: { > int *pb = DASM_POS2PTR(D, n); > n = *pb < 0 ? pb[1] : (*pb + (int)(ptrdiff_t)base); > @@ -452,6 +461,7 @@ int dasm_encode(Dst_DECL, void *buffer) > case DASM_EXTERN: n = DASM_EXTERN(Dst, cp, p[1], *p); p += 2; goto wd; > case DASM_MARK: mark = cp; break; > case DASM_ESC: action = *p++; > + /* fallthrough */ > default: *cp++ = action; break; > case DASM_SECTION: case DASM_STOP: goto stop; > } > diff --git a/src/lj_asm.c b/src/lj_asm.c > index 15de7e33..2d570bb9 100644 > --- a/src/lj_asm.c > +++ b/src/lj_asm.c > @@ -2188,9 +2188,12 @@ static void asm_setup_regsp(ASMState *as) > if (ir->op2 != REF_NIL && as->evenspill < 4) > as->evenspill = 4; /* lj_cdata_newv needs 4 args. */ > } > + /* fallthrough */ > #else > + /* fallthrough */ > case IR_CNEW: > #endif > + /* fallthrough */ > case IR_TNEW: case IR_TDUP: case IR_CNEWI: case IR_TOSTR: > case IR_BUFSTR: > ir->prev = REGSP_HINT(RID_RET); > @@ -2206,6 +2209,7 @@ static void asm_setup_regsp(ASMState *as) > case IR_LDEXP: > #endif > #endif > + /* fallthrough */ > case IR_POW: > if (!LJ_SOFTFP && irt_isnum(ir->t)) { > if (inloop) > @@ -2217,7 +2221,7 @@ static void asm_setup_regsp(ASMState *as) > continue; > #endif > } > - /* fallthrough for integer POW */ > + /* fallthrough */ /* for integer POW */ > case IR_DIV: case IR_MOD: > if (!irt_isnum(ir->t)) { > ir->prev = REGSP_HINT(RID_RET); > @@ -2254,6 +2258,7 @@ static void asm_setup_regsp(ASMState *as) > case IR_BSHL: case IR_BSHR: case IR_BSAR: > if ((as->flags & JIT_F_BMI2)) /* Except if BMI2 is available. */ > break; > + /* fallthrough */ > case IR_BROL: case IR_BROR: > if (!irref_isk(ir->op2) && !ra_hashint(IR(ir->op2)->r)) { > IR(ir->op2)->r = REGSP_HINT(RID_ECX); > diff --git a/src/lj_cparse.c b/src/lj_cparse.c > index 07c643d4..cd032b8e 100644 > --- a/src/lj_cparse.c > +++ b/src/lj_cparse.c > @@ -595,28 +595,34 @@ static void cp_expr_infix(CPState *cp, CPValue *k, int pri) > k->id = k2.id > k3.id ? k2.id : k3.id; > continue; > } > + /* fallthrough */ > case 1: > if (cp_opt(cp, CTOK_OROR)) { > cp_expr_sub(cp, &k2, 2); k->i32 = k->u32 || k2.u32; k->id = CTID_INT32; > continue; > } > + /* fallthrough */ > case 2: > if (cp_opt(cp, CTOK_ANDAND)) { > cp_expr_sub(cp, &k2, 3); k->i32 = k->u32 && k2.u32; k->id = CTID_INT32; > continue; > } > + /* fallthrough */ > case 3: > if (cp_opt(cp, '|')) { > cp_expr_sub(cp, &k2, 4); k->u32 = k->u32 | k2.u32; goto arith_result; > } > + /* fallthrough */ > case 4: > if (cp_opt(cp, '^')) { > cp_expr_sub(cp, &k2, 5); k->u32 = k->u32 ^ k2.u32; goto arith_result; > } > + /* fallthrough */ > case 5: > if (cp_opt(cp, '&')) { > cp_expr_sub(cp, &k2, 6); k->u32 = k->u32 & k2.u32; goto arith_result; > } > + /* fallthrough */ > case 6: > if (cp_opt(cp, CTOK_EQ)) { > cp_expr_sub(cp, &k2, 7); k->i32 = k->u32 == k2.u32; k->id = CTID_INT32; > @@ -625,6 +631,7 @@ static void cp_expr_infix(CPState *cp, CPValue *k, int pri) > cp_expr_sub(cp, &k2, 7); k->i32 = k->u32 != k2.u32; k->id = CTID_INT32; > continue; > } > + /* fallthrough */ > case 7: > if (cp_opt(cp, '<')) { > cp_expr_sub(cp, &k2, 8); > @@ -659,6 +666,7 @@ static void cp_expr_infix(CPState *cp, CPValue *k, int pri) > k->id = CTID_INT32; > continue; > } > + /* fallthrough */ > case 8: > if (cp_opt(cp, CTOK_SHL)) { > cp_expr_sub(cp, &k2, 9); k->u32 = k->u32 << k2.u32; > @@ -671,6 +679,7 @@ static void cp_expr_infix(CPState *cp, CPValue *k, int pri) > k->u32 = k->u32 >> k2.u32; > continue; > } > + /* fallthrough */ > case 9: > if (cp_opt(cp, '+')) { > cp_expr_sub(cp, &k2, 10); k->u32 = k->u32 + k2.u32; > @@ -680,6 +689,7 @@ static void cp_expr_infix(CPState *cp, CPValue *k, int pri) > } else if (cp_opt(cp, '-')) { > cp_expr_sub(cp, &k2, 10); k->u32 = k->u32 - k2.u32; goto arith_result; > } > + /* fallthrough */ > case 10: > if (cp_opt(cp, '*')) { > cp_expr_unary(cp, &k2); k->u32 = k->u32 * k2.u32; goto arith_result; > diff --git a/src/lj_err.c b/src/lj_err.c > index 9903d273..8d7134d9 100644 > --- a/src/lj_err.c > +++ b/src/lj_err.c > @@ -167,6 +167,7 @@ static void *err_unwind(lua_State *L, void *stopcf, int errcode) > case FRAME_CONT: /* Continuation frame. */ > if (frame_iscont_fficb(frame)) > goto unwind_c; > + /* fallthrough */ > case FRAME_VARG: /* Vararg frame. */ > frame = frame_prevd(frame); > break; > diff --git a/src/lj_opt_sink.c b/src/lj_opt_sink.c > index a16d112f..c16363e7 100644 > --- a/src/lj_opt_sink.c > +++ b/src/lj_opt_sink.c > @@ -100,8 +100,8 @@ static void sink_mark_ins(jit_State *J) > (LJ_32 && ir+1 < irlast && (ir+1)->o == IR_HIOP && > !sink_checkphi(J, ir, (ir+1)->op2)))) > irt_setmark(ir->t); /* Mark ineligible allocation. */ > - /* fallthrough */ > #endif > + /* fallthrough */ > case IR_USTORE: > irt_setmark(IR(ir->op2)->t); /* Mark stored value. */ > break; > diff --git a/src/lj_parse.c b/src/lj_parse.c > index 343fa797..e238afa3 100644 > --- a/src/lj_parse.c > +++ b/src/lj_parse.c > @@ -2684,7 +2684,8 @@ static int parse_stmt(LexState *ls) > lj_lex_next(ls); > parse_goto(ls); > break; > - } /* else: fallthrough */ > + } > + /* fallthrough */ > default: > parse_call_assign(ls); > break; > diff --git a/src/luajit.c b/src/luajit.c > index 1ca24301..3a3ec247 100644 > --- a/src/luajit.c > +++ b/src/luajit.c > @@ -421,6 +421,7 @@ static int collectargs(char **argv, int *flags) > break; > case 'e': > *flags |= FLAGS_EXEC; > + /* fallthrough */ > case 'j': /* LuaJIT extension */ > case 'l': > *flags |= FLAGS_OPTION; > -- > 2.41.0 >