From 1149b24a6ef5f229a58fa36cfdbe6a1f345ed71b Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 27 Aug 2019 12:03:51 +0000 Subject: added tests covering bug [fa6bf38d07] --- generic/tclTest.c | 21 +++++++++++++++++++++ tests/execute.test | 40 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index 473368c..5e807d4 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -220,6 +220,9 @@ static void SpecialFree(char *blockPtr); static int StaticInitProc(Tcl_Interp *interp); static int TestasyncCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); +static int TestbumpinterpepochObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); static int TestpurebytesobjObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -584,6 +587,8 @@ Tcltest_Init( Tcl_CreateObjCommand(interp, "testgetindexfromobjstruct", TestGetIndexFromObjStructObjCmd, NULL, NULL); Tcl_CreateCommand(interp, "testasync", TestasyncCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "testbumpinterpepoch", + TestbumpinterpepochObjCmd, NULL, NULL); Tcl_CreateCommand(interp, "testchannel", TestChannelCmd, NULL, NULL); Tcl_CreateCommand(interp, "testchannelevent", TestChannelEventCmd, @@ -1022,6 +1027,22 @@ AsyncThreadProc( } #endif +static int +TestbumpinterpepochObjCmd( + ClientData dummy, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ +{ + Interp *iPtr = (Interp *)interp; + if (objc != 1) { + Tcl_WrongNumArgs(interp, 1, objv, ""); + return TCL_ERROR; + } + iPtr->compileEpoch++; + return TCL_OK; +} + /* *---------------------------------------------------------------------- * diff --git a/tests/execute.test b/tests/execute.test index e9668a9..bc9dfcf 100644 --- a/tests/execute.test +++ b/tests/execute.test @@ -37,6 +37,11 @@ testConstraint testobj [expr { testConstraint longIs32bit [expr {int(0x80000000) < 0}] testConstraint testexprlongobj [llength [info commands testexprlongobj]] + +if {[namespace which -command testbumpinterpepoch] eq ""} { + proc testbumpinterpepoch {} { rename ::set ::dummy; rename ::dummy ::set } +} + # Tests for the omnibus TclExecuteByteCode function: # INST_DONE not tested @@ -933,8 +938,7 @@ test execute-8.3 {Stack restoration} -setup { proc f {args} "f $arglst" proc run {} { # bump the interp's epoch - rename ::set ::dummy - rename ::dummy ::set + testbumpinterpepoch catch f msg set msg } @@ -948,8 +952,7 @@ test execute-8.4 {Compile epoch bump effect on stack trace} -setup { } proc FOO {} { catch {error bar} m o - rename ::set ::dummy - rename ::dummy ::set + testbumpinterpepoch return -options $o $m } } -body { @@ -978,6 +981,35 @@ test execute-8.5 {Bug 2038069} -setup { invoked from within "catch \[list error FOO\] m o"} -errorline 2} +test execute-8.6 {Compile epoch bump in global level (bug [fa6bf38d07])} -setup { + interp create slave + slave eval { + package require tcltest + catch [list package require -exact Tcltest [info patchlevel]] + ::tcltest::loadTestedCommands + if {[namespace which -command testbumpinterpepoch] eq ""} { + proc testbumpinterpepoch {} { rename ::set ::dummy; rename ::dummy ::set } + } + } +} -body { + slave eval { + lappend res A; testbumpinterpepoch; lappend res B; return; lappend res C; + } + slave eval { + set i 0; while {[incr i] < 3} { + lappend res A; testbumpinterpepoch; lappend res B; return; lappend res C; + } + } + slave eval { + set i 0; while {[incr i] < 3} { + lappend res A; testbumpinterpepoch; lappend res B; break; lappend res C; + } + } + slave eval {set res} +} -cleanup { + interp delete slave +} -result [lrepeat 3 A B] + test execute-9.1 {Interp result resetting [Bug 1522803]} { set c 0 catch { -- cgit v0.12 From 045b6322e8966c4321b829083490ae5d746f9a92 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 27 Aug 2019 14:56:17 +0000 Subject: more test cases --- tests/execute.test | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/tests/execute.test b/tests/execute.test index bc9dfcf..72d79fd 100644 --- a/tests/execute.test +++ b/tests/execute.test @@ -1005,10 +1005,51 @@ test execute-8.6 {Compile epoch bump in global level (bug [fa6bf38d07])} -setup lappend res A; testbumpinterpepoch; lappend res B; break; lappend res C; } } + slave eval { + catch { + lappend res A; testbumpinterpepoch; lappend res B; error test; lappend res C; + } + } slave eval {set res} } -cleanup { interp delete slave -} -result [lrepeat 3 A B] +} -result [lrepeat 4 A B] +test execute-8.7 {Compile epoch bump in global level (bug [fa6bf38d07]), exception case} -setup { + interp create slave + slave eval { + package require tcltest + catch [list package require -exact Tcltest [info patchlevel]] + ::tcltest::loadTestedCommands + if {[namespace which -command testbumpinterpepoch] eq ""} { + proc testbumpinterpepoch {} { rename ::set ::dummy; rename ::dummy ::set } + } + } +} -body { + set res {} + lappend res [catch { + slave eval { + lappend res A; testbumpinterpepoch; lappend res B; return -code error test; lappend res C; + } + } e] $e + lappend res [catch { + slave eval { + lappend res A; testbumpinterpepoch; lappend res B; error test; lappend res C; + } + } e] $e + lappend res [catch { + slave eval { + lappend res A; testbumpinterpepoch; lappend res B; return -code return test; lappend res C; + } + } e] $e + lappend res [catch { + slave eval { + lappend res A; testbumpinterpepoch; lappend res B; break; lappend res C; + } + } e] $e + list $res [slave eval {set res}] +} -cleanup { + interp delete slave +} -result [list {1 test 1 test 2 test 3 {}} [lrepeat 4 A B]] test execute-9.1 {Interp result resetting [Bug 1522803]} { set c 0 -- cgit v0.12 From 6a3d250548f9acc17013c28b36a7d1fc3490edd5 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 27 Aug 2019 15:00:44 +0000 Subject: fixes [fa6bf38d07]: command invocation (NRE callback to TEBCResume) caused by execution of recompiled TEBC (on epoch bump) --- generic/tclExecute.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 832054e..873cac3 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2400,12 +2400,12 @@ TEBCresume( iPtr->cmdCount += TclGetUInt4AtPtr(pc+5); if (checkInterp) { - checkInterp = 0; if (((codePtr->compileEpoch != iPtr->compileEpoch) || (codePtr->nsEpoch != iPtr->varFramePtr->nsPtr->resolverEpoch)) && !(codePtr->flags & TCL_BYTECODE_PRECOMPILED)) { goto instStartCmdFailed; } + checkInterp = 0; } inst = *(pc += 9); goto peepholeStart; @@ -2975,7 +2975,6 @@ TEBCresume( * INVOCATION BLOCK */ - instEvalStk: case INST_EVAL_STK: bcFramePtr->data.tebc.pc = (char *) pc; iPtr->cmdFramePtr = bcFramePtr; @@ -8157,26 +8156,38 @@ TEBCresume( { const char *bytes; - checkInterp = 1; length = 0; + if (TclInterpReady(interp) == TCL_ERROR) { + goto gotError; + } + /* * We used to switch to direct eval; for NRE-awareness we now * compile and eval the command so that this evaluation does not - * add a new TEBC instance. [Bug 2910748] + * add a new TEBC instance. Bug [2910748], bug [fa6bf38d07] + * + * TODO: recompile, search this command and eval a code starting from, + * so that this evaluation does not add a new TEBC instance without + * NRE-trampoline. */ - if (TclInterpReady(interp) == TCL_ERROR) { - goto gotError; - } - codePtr->flags |= TCL_BYTECODE_RECOMPILE; bytes = GetSrcInfoForPc(pc, codePtr, &length, NULL, NULL); opnd = TclGetUInt4AtPtr(pc+1); pc += (opnd-1); assert(bytes); PUSH_OBJECT(Tcl_NewStringObj(bytes, length)); - goto instEvalStk; + + bcFramePtr->data.tebc.pc = (char *) pc; + iPtr->cmdFramePtr = bcFramePtr; + cleanup = 1; + pc += 1; + /* yield next instruction */ + TEBC_YIELD(); + /* add TEBCResume for this command */ + return TclNRExecuteByteCode(interp, + TclCompileObj(interp, OBJ_AT_TOS, NULL, 0)); } } -- cgit v0.12 From 64f262df8870d2caeeda595d9a4073ae1b40150b Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 27 Aug 2019 15:32:58 +0000 Subject: simplification, use the same "fixed" (and faster) code for INST_EVAL_STK --- generic/tclExecute.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 873cac3..aff2c51 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2976,13 +2976,17 @@ TEBCresume( */ case INST_EVAL_STK: + instEvalStk: bcFramePtr->data.tebc.pc = (char *) pc; iPtr->cmdFramePtr = bcFramePtr; cleanup = 1; pc += 1; + /* yield next instruction */ TEBC_YIELD(); - return TclNREvalObjEx(interp, OBJ_AT_TOS, 0, NULL, 0); + /* add TEBCResume for object at top of stack */ + return TclNRExecuteByteCode(interp, + TclCompileObj(interp, OBJ_AT_TOS, NULL, 0)); case INST_INVOKE_EXPANDED: CLANG_ASSERT(auxObjList); @@ -8178,16 +8182,7 @@ TEBCresume( pc += (opnd-1); assert(bytes); PUSH_OBJECT(Tcl_NewStringObj(bytes, length)); - - bcFramePtr->data.tebc.pc = (char *) pc; - iPtr->cmdFramePtr = bcFramePtr; - cleanup = 1; - pc += 1; - /* yield next instruction */ - TEBC_YIELD(); - /* add TEBCResume for this command */ - return TclNRExecuteByteCode(interp, - TclCompileObj(interp, OBJ_AT_TOS, NULL, 0)); + goto instEvalStk; } } -- cgit v0.12 From cf0b9b27229540852823f29cc7cbeeaa2be4c20c Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 27 Aug 2019 15:40:27 +0000 Subject: small amend: be sure checkInterp is set if entering back the code marked as TCL_BYTECODE_RECOMPILE (normally also set in CACHE_STACK_INFO, but...) --- generic/tclExecute.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index aff2c51..81173da 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2168,7 +2168,7 @@ TEBCresume( int cleanup = PTR2INT(data[2]); Tcl_Obj *objResultPtr; - int checkInterp; /* Indicates when a check of interp readyness + int checkInterp = 0; /* Indicates when a check of interp readyness * is necessary. Set by CACHE_STACK_INFO() */ /* @@ -2203,7 +2203,6 @@ TEBCresume( if (!pc) { /* bytecode is starting from scratch */ - checkInterp = 0; pc = codePtr->codeStart; goto cleanup0; } else { @@ -2227,6 +2226,7 @@ TEBCresume( if (codePtr->flags & TCL_BYTECODE_RECOMPILE) { iPtr->flags |= ERR_ALREADY_LOGGED; codePtr->flags &= ~TCL_BYTECODE_RECOMPILE; + checkInterp = 1; } if (result != TCL_OK) { -- cgit v0.12 From e9a4ca4f22d40f304a6f50f9b410651ce75098cd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 28 Aug 2019 09:59:26 +0000 Subject: Add /* FALLTHRU */ markers in various places (silencing possible GCC warnings). Eliminate some more "register" keywords. Eliminate (or silence) some unused function parameters. --- compat/zlib/contrib/minizip/crypt.h | 2 +- generic/regc_lex.c | 4 +--- generic/regc_nfa.c | 6 ++++++ generic/regcomp.c | 26 ++++---------------------- generic/regcustom.h | 4 ++-- generic/regerror.c | 1 - generic/regex.h | 4 ++-- generic/regexec.c | 8 +++----- generic/regguts.h | 2 +- generic/tclAssembly.c | 13 ++++++------- generic/tclBasic.c | 2 +- generic/tclCkalloc.c | 12 ++++++++++++ generic/tclClock.c | 5 +++++ generic/tclCmdMZ.c | 1 + generic/tclCompile.h | 8 ++++---- generic/tclDictObj.c | 1 + generic/tclExecute.c | 5 +++++ generic/tclOOInt.h | 2 +- generic/tclProc.c | 4 +--- generic/tclRegexp.c | 4 ++-- generic/tclScan.c | 11 +++++------ generic/tclStringObj.c | 2 ++ win/tclWinPipe.c | 1 + 23 files changed, 67 insertions(+), 61 deletions(-) diff --git a/compat/zlib/contrib/minizip/crypt.h b/compat/zlib/contrib/minizip/crypt.h index 1e9e820..ea8ba06 100644 --- a/compat/zlib/contrib/minizip/crypt.h +++ b/compat/zlib/contrib/minizip/crypt.h @@ -51,7 +51,7 @@ static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c) (*(pkeys+1)) += (*(pkeys+0)) & 0xff; (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; { - register int keyshift = (int)((*(pkeys+1)) >> 24); + int keyshift = (int)((*(pkeys+1)) >> 24); (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); } return c; diff --git a/generic/regc_lex.c b/generic/regc_lex.c index affcb48..fba2fc7 100644 --- a/generic/regc_lex.c +++ b/generic/regc_lex.c @@ -905,9 +905,7 @@ lexescape( v->now = save; - /* - * And fall through into octal number. - */ + /* FALLTHRU */ case CHR('0'): NOTE(REG_UUNPORT); diff --git a/generic/regc_nfa.c b/generic/regc_nfa.c index 088c6c0..7f43958 100644 --- a/generic/regc_nfa.c +++ b/generic/regc_nfa.c @@ -2978,6 +2978,9 @@ dumpnfa( dumpcolors(nfa->cm, f); } fflush(f); +#else + (void)nfa; + (void)f; #endif } @@ -3157,6 +3160,9 @@ dumpcnfa( dumpcstate(st, cnfa, f); } fflush(f); +#else + (void)cnfa; + (void)f; #endif } diff --git a/generic/regcomp.c b/generic/regcomp.c index 211cd70..3051446 100644 --- a/generic/regcomp.c +++ b/generic/regcomp.c @@ -59,7 +59,6 @@ static void wordchrs(struct vars *); static struct subre *subre(struct vars *, int, int, struct state *, struct state *); static void freesubre(struct vars *, struct subre *); static void freesrnode(struct vars *, struct subre *); -static void optst(struct vars *, struct subre *); static int numst(struct subre *, int); static void markst(struct subre *); static void cleanst(struct vars *); @@ -395,7 +394,6 @@ compile( dumpnfa(v->nfa, debug); dumpst(v->tree, debug, 1); } - optst(v, v->tree); v->ntree = numst(v->tree, 1); markst(v->tree); cleanst(v); @@ -923,7 +921,7 @@ parseqatom( */ NOTE(REG_UPBOTCH); - /* fallthrough into case PLAIN */ + /* FALLTHRU */ case PLAIN: onechr(v, v->nextvalue, lp, rp); okcolors(v->nfa, v->cm); @@ -1812,25 +1810,6 @@ freesrnode( } /* - - optst - optimize a subRE subtree - ^ static void optst(struct vars *, struct subre *); - */ -static void -optst( - struct vars *v, - struct subre *t) -{ - /* - * DGP (2007-11-13): I assume it was the programmer's intent to eventually - * come back and add code to optimize subRE trees, but the routine coded - * just spends effort traversing the tree and doing nothing. We can do - * nothing with less effort. - */ - - return; -} - -/* - numst - number tree nodes (assigning "id" indexes) ^ static int numst(struct subre *, int); */ @@ -2101,6 +2080,9 @@ dump( } fprintf(f, "\n"); dumpst(g->tree, f, 0); +#else + (void)re; + (void)f; #endif } diff --git a/generic/regcustom.h b/generic/regcustom.h index 681b97d..e7bdca7 100644 --- a/generic/regcustom.h +++ b/generic/regcustom.h @@ -132,7 +132,7 @@ typedef int celt; /* Type to hold chr, or NOCELT */ #if 1 #define AllocVars(vPtr) \ static Tcl_ThreadDataKey varsKey; \ - register struct vars *vPtr = (struct vars *) \ + struct vars *vPtr = (struct vars *) \ Tcl_GetThreadData(&varsKey, sizeof(struct vars)) #else /* @@ -141,7 +141,7 @@ typedef int celt; /* Type to hold chr, or NOCELT */ * faster in practice (measured!) */ #define AllocVars(vPtr) \ - register struct vars *vPtr = (struct vars *) MALLOC(sizeof(struct vars)) + struct vars *vPtr = (struct vars *) MALLOC(sizeof(struct vars)) #define FreeVars(vPtr) \ FREE(vPtr) #endif diff --git a/generic/regerror.c b/generic/regerror.c index 49d93ed..f783217 100644 --- a/generic/regerror.c +++ b/generic/regerror.c @@ -58,7 +58,6 @@ static const struct rerr { size_t /* Actual space needed (including NUL) */ regerror( int code, /* Error code, or REG_ATOI or REG_ITOA */ - const regex_t *preg, /* Associated regex_t (unused at present) */ char *errbuf, /* Result buffer (unless errbuf_size==0) */ size_t errbuf_size) /* Available space in errbuf, can be 0 */ { diff --git a/generic/regex.h b/generic/regex.h index 8845f72..adbd098 100644 --- a/generic/regex.h +++ b/generic/regex.h @@ -232,7 +232,7 @@ typedef struct { * of character is used for error reports is independent of what kind is used * in matching. * - ^ extern size_t regerror(int, const regex_t *, char *, size_t); + ^ extern size_t regerror(int, char *, size_t); */ #define REG_OKAY 0 /* no errors detected */ #define REG_NOMATCH 1 /* failed to match */ @@ -283,7 +283,7 @@ int regexec(regex_t *, const char *, size_t, regmatch_t [], int); MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int); #endif MODULE_SCOPE void regfree(regex_t *); -MODULE_SCOPE size_t regerror(int, const regex_t *, char *, size_t); +MODULE_SCOPE size_t regerror(int, char *, size_t); /* automatically gathered by fwd; do not hand-edit */ /* =====^!^===== end forwards =====^!^===== */ diff --git a/generic/regexec.c b/generic/regexec.c index 6d12827..f174420 100644 --- a/generic/regexec.c +++ b/generic/regexec.c @@ -129,7 +129,7 @@ int exec(regex_t *, const chr *, size_t, rm_detail_t *, size_t, regmatch_t [], i static struct dfa *getsubdfa(struct vars *, struct subre *); static int simpleFind(struct vars *const, struct cnfa *const, struct colormap *const); static int complicatedFind(struct vars *const, struct cnfa *const, struct colormap *const); -static int complicatedFindLoop(struct vars *const, struct cnfa *const, struct colormap *const, struct dfa *const, struct dfa *const, chr **const); +static int complicatedFindLoop(struct vars *const, struct dfa *const, struct dfa *const, chr **const); static void zapallsubs(regmatch_t *const, const size_t); static void zaptreesubs(struct vars *const, struct subre *const); static void subset(struct vars *const, struct subre *const, chr *const, chr *const); @@ -434,7 +434,7 @@ complicatedFind( return v->err; } - ret = complicatedFindLoop(v, cnfa, cm, d, s, &cold); + ret = complicatedFindLoop(v, d, s, &cold); freeDFA(d); freeDFA(s); @@ -453,14 +453,12 @@ complicatedFind( /* - complicatedFindLoop - the heart of complicatedFind - ^ static int complicatedFindLoop(struct vars *, struct cnfa *, struct colormap *, + ^ static int complicatedFindLoop(struct vars *, ^ struct dfa *, struct dfa *, chr **); */ static int complicatedFindLoop( struct vars *const v, - struct cnfa *const cnfa, - struct colormap *const cm, struct dfa *const d, struct dfa *const s, chr **const coldp) /* where to put coldstart pointer */ diff --git a/generic/regguts.h b/generic/regguts.h index 1ac2465..e10711d 100644 --- a/generic/regguts.h +++ b/generic/regguts.h @@ -438,7 +438,7 @@ struct guts { #ifndef AllocVars #define AllocVars(vPtr) \ struct vars var; \ - register struct vars *vPtr = &var + struct vars *vPtr = &var #endif #ifndef FreeVars #define FreeVars(vPtr) ((void) 0) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 39930a7..f05814fa 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -287,8 +287,7 @@ static int GetIntegerOperand(AssemblyEnv*, Tcl_Token**, int*); static int GetNextOperand(AssemblyEnv*, Tcl_Token**, Tcl_Obj**); static void LookForFreshCatches(BasicBlock*, BasicBlock**); static void MoveCodeForJumps(AssemblyEnv*, int); -static void MoveExceptionRangesToBasicBlock(AssemblyEnv*, int, - int); +static void MoveExceptionRangesToBasicBlock(AssemblyEnv*, int); static AssemblyEnv* NewAssemblyEnv(CompileEnv*, int); static int ProcessCatches(AssemblyEnv*); static int ProcessCatchesInBasicBlock(AssemblyEnv*, BasicBlock*, @@ -784,6 +783,7 @@ TclNRAssembleObjCmd( Tcl_Obj* backtrace; /* Object where extra error information is * constructed. */ + (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "bytecodeList"); return TCL_ERROR; @@ -959,7 +959,7 @@ TclCompileAssembleCmd( int numCommands = envPtr->numCommands; int offset = envPtr->codeNext - envPtr->codeStart; int depth = envPtr->currStackDepth; - + (void)cmdPtr; /* * Make sure that the command has a single arg that is a simple word. */ @@ -1808,7 +1808,6 @@ CompileEmbeddedScript( int savedStackDepth = envPtr->currStackDepth; int savedMaxStackDepth = envPtr->maxStackDepth; - int savedCodeIndex = envPtr->codeNext - envPtr->codeStart; int savedExceptArrayNext = envPtr->exceptArrayNext; envPtr->currStackDepth = 0; @@ -1841,8 +1840,7 @@ CompileEmbeddedScript( * need to be fixed up once the stack depth is known. */ - MoveExceptionRangesToBasicBlock(assemEnvPtr, savedCodeIndex, - savedExceptArrayNext); + MoveExceptionRangesToBasicBlock(assemEnvPtr, savedExceptArrayNext); /* * Flush the current basic block. @@ -1901,7 +1899,6 @@ SyncStackDepth( static void MoveExceptionRangesToBasicBlock( AssemblyEnv* assemEnvPtr, /* Assembly environment */ - int savedCodeIndex, /* Start of the embedded code */ int savedExceptArrayNext) /* Saved index of the end of the exception * range array */ { @@ -4310,6 +4307,8 @@ DupAssembleCodeInternalRep( Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) { + (void)srcPtr; + (void)copyPtr; return; } diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 62e7e04..53d1158 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -6510,8 +6510,8 @@ Tcl_ExprLongObj( return TCL_ERROR; } resultPtr = Tcl_NewBignumObj(&big); - /* FALLTHROUGH */ } + /* FALLTHRU */ case TCL_NUMBER_LONG: case TCL_NUMBER_WIDE: case TCL_NUMBER_BIG: diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 70e64f0..26f092f 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -1119,6 +1119,8 @@ Tcl_AttemptDbCkalloc( int line) { char *result; + (void)file; + (void)line; result = (char *) TclpAlloc(size); return result; @@ -1198,6 +1200,8 @@ Tcl_AttemptDbCkrealloc( int line) { char *result; + (void)file; + (void)line; result = (char *) TclpRealloc(ptr, size); return result; @@ -1228,6 +1232,8 @@ Tcl_DbCkfree( const char *file, int line) { + (void)file; + (void)line; TclpFree(ptr); } @@ -1246,12 +1252,14 @@ void Tcl_InitMemory( Tcl_Interp *interp) { + (void)interp; } int Tcl_DumpActiveMemory( const char *fileName) { + (void)fileName; return TCL_OK; } @@ -1260,6 +1268,8 @@ Tcl_ValidateAllMemory( const char *file, int line) { + (void)file; + (void)line; } int @@ -1267,6 +1277,8 @@ TclDumpMemoryInfo( ClientData clientData, int flags) { + (void)clientData; + (void)flags; return 1; } diff --git a/generic/tclClock.c b/generic/tclClock.c index 9ed970c..0e8a941 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -1652,6 +1652,7 @@ ClockGetenvObjCmd( { const char *varName; const char *varValue; + (void)clientData; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1744,6 +1745,7 @@ ClockClicksObjCmd( int index = CLICKS_NATIVE; Tcl_Time now; Tcl_WideInt clicks = 0; + (void)clientData; switch (objc) { case 1: @@ -1806,6 +1808,7 @@ ClockMillisecondsObjCmd( Tcl_Obj *const *objv) /* Parameter values */ { Tcl_Time now; + (void)clientData; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -1842,6 +1845,7 @@ ClockMicrosecondsObjCmd( int objc, /* Parameter count */ Tcl_Obj *const *objv) /* Parameter values */ { + (void)clientData; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; @@ -1994,6 +1998,7 @@ ClockSecondsObjCmd( Tcl_Obj *const *objv) /* Parameter values */ { Tcl_Time now; + (void)clientData; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ae10e74..193eac4 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4578,6 +4578,7 @@ Tcl_TimeRateObjCmd( */ threshold = 1; maxcnt = 0; + /* FALLTHRU */ case TCL_CONTINUE: result = TCL_OK; break; diff --git a/generic/tclCompile.h b/generic/tclCompile.h index aa6d247..1d657a7 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1164,14 +1164,14 @@ MODULE_SCOPE void TclPushVarName(Tcl_Interp *interp, static inline void TclPreserveByteCode( - register ByteCode *codePtr) + ByteCode *codePtr) { codePtr->refCount++; } static inline void TclReleaseByteCode( - register ByteCode *codePtr) + ByteCode *codePtr) { if (codePtr->refCount-- > 1) { return; @@ -1209,7 +1209,7 @@ MODULE_SCOPE Tcl_Obj *TclGetInnerContext(Tcl_Interp *interp, const unsigned char *pc, Tcl_Obj **tosPtr); MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData, - register Tcl_Interp *interp, int objc, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int isLambda); @@ -1420,7 +1420,7 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData, #define TclEmitPush(objIndex, envPtr) \ do { \ - register int _objIndexCopy = (objIndex); \ + int _objIndexCopy = (objIndex); \ if (_objIndexCopy <= 255) { \ TclEmitInstInt1(INST_PUSH1, _objIndexCopy, (envPtr)); \ } else { \ diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 32234a3..a42c123 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -3083,6 +3083,7 @@ DictFilterCmd( Tcl_ResetResult(interp); Tcl_DictObjDone(&search); + /* FALLTHRU */ case TCL_CONTINUE: result = TCL_OK; break; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 779f4a2..c5f5c0c 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2286,10 +2286,12 @@ TEBCresume( objPtr = POP_OBJECT(); TclDecrRefCount(objPtr); } + /* FALLTHRU */ case 2: cleanup2_pushObjResultPtr: objPtr = POP_OBJECT(); TclDecrRefCount(objPtr); + /* FALLTHRU */ case 1: cleanup1_pushObjResultPtr: objPtr = OBJ_AT_TOS; @@ -2306,14 +2308,17 @@ TEBCresume( objPtr = POP_OBJECT(); TclDecrRefCount(objPtr); } + /* FALLTHRU */ case 2: cleanup2: objPtr = POP_OBJECT(); TclDecrRefCount(objPtr); + /* FALLTHRU */ case 1: cleanup1: objPtr = POP_OBJECT(); TclDecrRefCount(objPtr); + /* FALLTHRU */ case 0: /* * We really want to do nothing now, but this is needed for some diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index d90b407..436acd6 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -590,7 +590,7 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr); #undef DUPLICATE /* prevent possible conflict with definition in WINAPI nb30.h */ #define DUPLICATE(target,source,type) \ do { \ - register unsigned len = sizeof(type) * ((target).num=(source).num);\ + size_t len = sizeof(type) * ((target).num=(source).num);\ if (len != 0) { \ memcpy(((target).list=(type*)ckalloc(len)), (source).list, len); \ } else { \ diff --git a/generic/tclProc.c b/generic/tclProc.c index 03cb0f0..06ca565 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -1835,9 +1835,7 @@ InterpProcNR2( Tcl_SetErrorCode(interp, "TCL", "RESULT", "UNEXPECTED", NULL); result = TCL_ERROR; - /* - * Fall through to the TCL_ERROR handling code. - */ + /* FALLTHRU */ case TCL_ERROR: /* diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index cfe6388..19ff8fd 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -726,12 +726,12 @@ TclRegError( const char *p; Tcl_ResetResult(interp); - n = TclReError(status, NULL, buf, sizeof(buf)); + n = TclReError(status, buf, sizeof(buf)); p = (n > sizeof(buf)) ? "..." : ""; Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s%s%s", msg, buf, p)); sprintf(cbuf, "%d", status); - (void) TclReError(REG_ITOA, NULL, cbuf, sizeof(cbuf)); + (void) TclReError(REG_ITOA, cbuf, sizeof(cbuf)); Tcl_SetErrorCode(interp, "REGEXP", cbuf, buf, NULL); } diff --git a/generic/tclScan.c b/generic/tclScan.c index 1ff83af..b0669ab 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -362,8 +362,10 @@ ValidateFormat( format += TclUtfToUniChar(format, &ch); break; } + /* FALLTHRU */ case 'L': flags |= SCAN_LONGER; + /* FALLTHRU */ case 'h': format += TclUtfToUniChar(format, &ch); } @@ -385,9 +387,7 @@ ValidateFormat( Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADWIDTH", NULL); goto error; } - /* - * Fall through! - */ + /* FALLTHRU */ case 'n': case 's': if (flags & (SCAN_LONGER|SCAN_BIG)) { @@ -709,11 +709,10 @@ Tcl_ScanObjCmd( format += TclUtfToUniChar(format, &ch); break; } + /* FALLTHRU */ case 'L': flags |= SCAN_LONGER; - /* - * Fall through so we skip to the next character. - */ + /* FALLTHRU */ case 'h': format += TclUtfToUniChar(format, &ch); } diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index ad578b1..e4db140 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2019,6 +2019,7 @@ Tcl_AppendFormatToObj( errCode = "BADUNSIGNED"; goto errorMsg; } + /* FALLTHRU */ case 'd': case 'o': case 'x': @@ -2616,6 +2617,7 @@ AppendPrintfToObjVA( break; case 'h': size = -1; + /* FALLTHRU */ default: p++; } diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index ce3e746..d8e96d5 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -3447,6 +3447,7 @@ TclPipeThreadStopSignal( SetEvent(evControl); *pipeTIPtr = NULL; + /* FALLTHRU */ case PTI_STATE_DOWN: return 1; -- cgit v0.12