/luavela/src/jit/lj_asm_x86.h:2565:3: error: switch has 2 consecutive identical branches [bugprone-branch-clone,-warnings-as-errors]
case IR_CARG:
^
/luavela/src/jit/lj_asm_x86.h:2570:10: note: last of these clones ends here
break; /* no op; IR -> mcode will happen in the finalizer (TVARGF) */
^
/luavela/src/jit/lj_ffrecord.c:828:22: error: conditional operator with identical true and false expressions [bugprone-branch-clone,-warnings-as-errors]
if (!(op < IR_BROL ? UJ_TARGET_MASKSHIFT : UJ_TARGET_MASKROT) &&
^
/luavela/src/jit/opt/fold.c:1538:26: error: conditional operator with identical true and false expressions [bugprone-branch-clone,-warnings-as-errors]
if ((fins->o < IR_BROL ? UJ_TARGET_MASKSHIFT : UJ_TARGET_MASKROT) &&
^
/luavela/src/lauxlib.h:127:14: error: conditional operator with identical true and false expressions [bugprone-branch-clone,-warnings-as-errors]
char buffer[LUAL_BUFFERSIZE];
^
/luavela/src/luaconf.h:150:41: note: expanded from macro 'LUAL_BUFFERSIZE'
#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
^
/luavela/src/lib/base.c:556:37: error: repeated branch in conditional chain [bugprone-branch-clone,-warnings-as-errors]
else if (co->status == LUA_YIELD) s = "suspended";
^
/luavela/src/lib/base.c:556:52: note: end of the original
else if (co->status == LUA_YIELD) s = "suspended";
^
/luavela/src/lib/base.c:560:8: note: clone 1 starts here
else s = "suspended";
^
/luavela/src/lib/base.c:557:29: error: repeated branch in conditional chain [bugprone-branch-clone,-warnings-as-errors]
else if (co->status != 0) s = "dead";
^
/luavela/src/lib/base.c:557:39: note: end of the original
else if (co->status != 0) s = "dead";
^
/luavela/src/lib/base.c:559:33: note: clone 1 starts here
else if (co->top == co->base) s = "dead";
^
/luavela/src/lib/ffi.c:576:21: error: repeated branch in conditional chain [bugprone-branch-clone,-warnings-as-errors]
if (ct1 == ct2) {
^
/luavela/src/lib/ffi.c:578:6: note: end of the original
} else if (ctype_type(ct1->info) == ctype_type(ct2->info) &&
^
/luavela/src/lib/ffi.c:585:49: note: clone 1 starts here
ct1 == ctype_rawchild(cts, ct2)) {
^
/luavela/src/lib/io.c:115:14: error: conditional operator with identical true and false expressions [bugprone-branch-clone,-warnings-as-errors]
size_t m = LUAL_BUFFERSIZE, n = 0, ok = 0;
^
/luavela/src/luaconf.h:150:41: note: expanded from macro 'LUAL_BUFFERSIZE'
#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
^
/luavela/src/lib/io.c:133:12: error: conditional operator with identical true and false expressions [bugprone-branch-clone,-warnings-as-errors]
for (m = LUAL_BUFFERSIZE, n = 0; ; m += m) {
^
/luavela/src/luaconf.h:150:41: note: expanded from macro 'LUAL_BUFFERSIZE'
#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
^
/luavela/src/lib/io.c:304:43: error: conditional operator with identical true and false expressions [bugprone-branch-clone,-warnings-as-errors]
size_t sz = (size_t)uj_lib_optint(L, 3, LUAL_BUFFERSIZE);
^
/luavela/src/luaconf.h:150:41: note: expanded from macro 'LUAL_BUFFERSIZE'
#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
^
/luavela/src/lib/os.c:164:9: error: conditional operator with identical true and false expressions [bugprone-branch-clone,-warnings-as-errors]
luaL_addchar(&b, *s);
^
/luavela/src/lauxlib.h:131:32: note: expanded from macro 'luaL_addchar'
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
^
/luavela/src/luaconf.h:150:41: note: expanded from macro 'LUAL_BUFFERSIZE'
#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
^
/luavela/src/lib/string.c:597:9: error: conditional operator with identical true and false expressions [bugprone-branch-clone,-warnings-as-errors]
luaL_addchar(b, news[i]);
^
/luavela/src/lauxlib.h:131:32: note: expanded from macro 'luaL_addchar'
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
^
/luavela/src/luaconf.h:150:41: note: expanded from macro 'LUAL_BUFFERSIZE'
#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
^
/luavela/src/lib/string.c:669:7: error: conditional operator with identical true and false expressions [bugprone-branch-clone,-warnings-as-errors]
luaL_addchar(&b, *src++);
^
/luavela/src/lauxlib.h:131:32: note: expanded from macro 'luaL_addchar'
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
^
/luavela/src/luaconf.h:150:41: note: expanded from macro 'LUAL_BUFFERSIZE'
#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
^
/luavela/src/luajit.c:79:5: error: repeated branch in conditional chain [bugprone-branch-clone,-warnings-as-errors]
return 0;
^
/luavela/src/luajit.c:79:13: note: end of the original
return 0;
^
/luavela/src/luajit.c:84:5: note: clone 1 starts here
return 0;
^
/luavela/src/profile/uj_profile.c:137:2: error: switch has 2 consecutive identical branches [bugprone-branch-clone,-warnings-as-errors]
case PS_ERROR:
^
/luavela/src/profile/uj_profile.c:140:9: note: last of these clones ends here
return;
^
/luavela/src/profile/uj_symtab.c:47:3: error: switch has 2 consecutive identical branches [bugprone-branch-clone,-warnings-as-errors]
case (~LJ_TTRACE): {
^
/luavela/src/profile/uj_symtab.c:53:4: note: last of these clones ends here
}
^
/luavela/src/uj_capi.c:272:39: error: repeated branch in conditional chain [bugprone-branch-clone,-warnings-as-errors]
} else if (gettag(o1) != gettag(o2)) {
^
/luavela/src/uj_capi.c:274:3: note: end of the original
} else if (tvispri(o1)) {
^
/luavela/src/uj_capi.c:280:29: note: clone 1 starts here
} else if (!tvistabud(o1)) {
^
/luavela/src/uj_capi_aux.c:151:18: error: conditional operator with identical true and false expressions [bugprone-branch-clone,-warnings-as-errors]
return (size_t)(LUAL_BUFFERSIZE - bufflen(B));
^
/luavela/src/luaconf.h:150:41: note: expanded from macro 'LUAL_BUFFERSIZE'
#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
^
/luavela/src/uj_capi_aux.c:194:3: error: conditional operator with identical true and false expressions [bugprone-branch-clone,-warnings-as-errors]
luaL_addchar(B, *s++);
^
/luavela/src/lauxlib.h:131:32: note: expanded from macro 'luaL_addchar'
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
^
/luavela/src/luaconf.h:150:41: note: expanded from macro 'LUAL_BUFFERSIZE'
#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
^
/luavela/src/uj_capi_aux.c:487:11: error: conditional operator with identical true and false expressions [bugprone-branch-clone,-warnings-as-errors]
char buf[LUAL_BUFFERSIZE];
^
/luavela/src/luaconf.h:150:41: note: expanded from macro 'LUAL_BUFFERSIZE'
#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
^
All the warnings should be verified whether any of them found the real bug or it's just making the noise.
As a result of updating clang-tidy up to version 11, new check
bugprone-branch-cloneproduced several warnings.All the warnings should be verified whether any of them found the real bug or it's just making the noise.