diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-28 11:45:42 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-28 11:45:42 (GMT) |
commit | b7f809ade5521067cf0d90daa4b24ae48fd7e525 (patch) | |
tree | 0454687fff6f9605ebe2b160834f66b1acf33fd3 /generic | |
parent | fa1cc2cd3f640af44f4f766c1fdcbf4822b8053e (diff) | |
parent | da423a1424e34834a64c209244ef64ca7c275f7d (diff) | |
download | tcl-b7f809ade5521067cf0d90daa4b24ae48fd7e525.zip tcl-b7f809ade5521067cf0d90daa4b24ae48fd7e525.tar.gz tcl-b7f809ade5521067cf0d90daa4b24ae48fd7e525.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic')
-rw-r--r-- | generic/regc_lex.c | 4 | ||||
-rw-r--r-- | generic/regc_nfa.c | 6 | ||||
-rw-r--r-- | generic/regcomp.c | 26 | ||||
-rw-r--r-- | generic/regerror.c | 1 | ||||
-rw-r--r-- | generic/regex.h | 4 | ||||
-rw-r--r-- | generic/regexec.c | 8 | ||||
-rw-r--r-- | generic/tclAssembly.c | 13 | ||||
-rw-r--r-- | generic/tclBasic.c | 2 | ||||
-rw-r--r-- | generic/tclCkalloc.c | 12 | ||||
-rw-r--r-- | generic/tclClock.c | 5 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 1 | ||||
-rw-r--r-- | generic/tclDictObj.c | 1 | ||||
-rw-r--r-- | generic/tclExecute.c | 35 | ||||
-rw-r--r-- | generic/tclProc.c | 4 | ||||
-rw-r--r-- | generic/tclRegexp.c | 4 | ||||
-rw-r--r-- | generic/tclScan.c | 11 | ||||
-rw-r--r-- | generic/tclStringObj.c | 2 | ||||
-rw-r--r-- | generic/tclTest.c | 21 |
18 files changed, 96 insertions, 64 deletions
diff --git a/generic/regc_lex.c b/generic/regc_lex.c index 4c8f15f..d299b49 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 240fcfe..7507137 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 1098d4e..5284b55 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 *); @@ -393,7 +392,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); @@ -921,7 +919,7 @@ parseqatom( */ NOTE(REG_UPBOTCH); - /* fallthrough into case PLAIN */ + /* FALLTHRU */ case PLAIN: onechr(v, v->nextvalue, lp, rp); okcolors(v->nfa, v->cm); @@ -1810,25 +1808,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); */ @@ -2099,6 +2078,9 @@ dump( } fprintf(f, "\n"); dumpst(g->tree, f, 0); +#else + (void)re; + (void)f; #endif } diff --git a/generic/regerror.c b/generic/regerror.c index 14f92f6..fb685f6 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 938b31e..72f7037 100644 --- a/generic/regex.h +++ b/generic/regex.h @@ -216,7 +216,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 */ @@ -267,7 +267,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 2c056e1..fa5ca2a 100644 --- a/generic/regexec.c +++ b/generic/regexec.c @@ -128,7 +128,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); @@ -429,7 +429,7 @@ complicatedFind( return v->err; } - ret = complicatedFindLoop(v, cnfa, cm, d, s, &cold); + ret = complicatedFindLoop(v, d, s, &cold); freeDFA(d); freeDFA(s); @@ -448,14 +448,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/tclAssembly.c b/generic/tclAssembly.c index 32d4724..ded61fb 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*, @@ -795,6 +794,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; @@ -968,7 +968,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. */ @@ -1818,7 +1818,6 @@ CompileEmbeddedScript( int savedStackDepth = envPtr->currStackDepth; int savedMaxStackDepth = envPtr->maxStackDepth; - int savedCodeIndex = envPtr->codeNext - envPtr->codeStart; int savedExceptArrayNext = envPtr->exceptArrayNext; envPtr->currStackDepth = 0; @@ -1851,8 +1850,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. @@ -1911,7 +1909,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 */ { @@ -4320,6 +4317,8 @@ DupAssembleCodeInternalRep( Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) { + (void)srcPtr; + (void)copyPtr; return; } diff --git a/generic/tclBasic.c b/generic/tclBasic.c index f7b8f71..9d4e424 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -6266,8 +6266,8 @@ Tcl_ExprLongObj( return TCL_ERROR; } resultPtr = Tcl_NewBignumObj(&big); - /* FALLTHROUGH */ } + /* FALLTHRU */ case TCL_NUMBER_INT: case TCL_NUMBER_BIG: result = TclGetLongFromObj(interp, resultPtr, ptr); diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index f1d36cb..3c6e615 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -1068,6 +1068,8 @@ Tcl_AttemptDbCkalloc( int line) { void *result; + (void)file; + (void)line; result = TclpAlloc(size); return result; @@ -1149,6 +1151,8 @@ Tcl_AttemptDbCkrealloc( int line) { void *result; + (void)file; + (void)line; result = TclpRealloc(ptr, size); return result; @@ -1180,6 +1184,8 @@ Tcl_DbCkfree( const char *file, int line) { + (void)file; + (void)line; TclpFree(ptr); } @@ -1198,12 +1204,14 @@ void Tcl_InitMemory( Tcl_Interp *interp) { + (void)interp; } int Tcl_DumpActiveMemory( const char *fileName) { + (void)fileName; return TCL_OK; } @@ -1212,6 +1220,8 @@ Tcl_ValidateAllMemory( const char *file, int line) { + (void)file; + (void)line; } int @@ -1219,6 +1229,8 @@ TclDumpMemoryInfo( ClientData clientData, int flags) { + (void)clientData; + (void)flags; return 1; } diff --git a/generic/tclClock.c b/generic/tclClock.c index c5677a5..29c95d5 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 482c8d4..3142d1a 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4449,6 +4449,7 @@ Tcl_TimeRateObjCmd( */ threshold = 1; maxcnt = 0; + /* FALLTHRU */ case TCL_CONTINUE: result = TCL_OK; break; diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 84e8ed4..bb552bf 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -3202,6 +3202,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 f9b6566..a4b5d38 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2012,7 +2012,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() */ /* @@ -2047,7 +2047,6 @@ TEBCresume( if (!pc) { /* bytecode is starting from scratch */ - checkInterp = 0; pc = codePtr->codeStart; goto cleanup0; } else { @@ -2069,8 +2068,9 @@ TEBCresume( goto abnormalReturn; } if (codePtr->flags & TCL_BYTECODE_RECOMPILE) { - iPtr->flags |= ERR_ALREADY_LOGGED; codePtr->flags &= ~TCL_BYTECODE_RECOMPILE; + checkInterp = 1; + iPtr->flags |= ERR_ALREADY_LOGGED; } if (result != TCL_OK) { @@ -2130,10 +2130,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; @@ -2150,14 +2152,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 @@ -2245,12 +2250,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; @@ -2684,15 +2689,18 @@ TEBCresume( * INVOCATION BLOCK */ - instEvalStk: 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); @@ -7396,19 +7404,22 @@ TEBCresume( const char *bytes; size_t xxx1length; - checkInterp = 1; xxx1length = 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, &xxx1length, NULL, NULL); opnd = TclGetUInt4AtPtr(pc+1); diff --git a/generic/tclProc.c b/generic/tclProc.c index b4192c0..febf97d 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -1843,9 +1843,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 53241ef..7f97288 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -724,12 +724,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 95006ca..ba9ccbe 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -363,8 +363,10 @@ ValidateFormat( format += TclUtfToUniChar(format, &ch); break; } + /* FALLTHRU */ case 'L': flags |= SCAN_LONGER; + /* FALLTHRU */ case 'h': format += TclUtfToUniChar(format, &ch); } @@ -386,9 +388,7 @@ ValidateFormat( Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADWIDTH", NULL); goto error; } - /* - * Fall through! - */ + /* FALLTHRU */ case 'n': case 's': if (flags & (SCAN_LONGER|SCAN_BIG)) { @@ -703,11 +703,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 872a0bf..de05ed4 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1962,6 +1962,7 @@ Tcl_AppendFormatToObj( } case 'u': + /* FALLTHRU */ case 'd': case 'o': case 'p': @@ -2614,6 +2615,7 @@ AppendPrintfToObjVA( break; case 'h': size = -1; + /* FALLTHRU */ default: p++; } diff --git a/generic/tclTest.c b/generic/tclTest.c index b98218e..72a6276 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -220,6 +220,9 @@ static void SpecialFree(void *blockPtr); static int StaticInitProc(Tcl_Interp *interp); static int TestasyncCmd(void *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 TestbytestringObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -596,6 +599,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, @@ -1037,6 +1042,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; +} + /* *---------------------------------------------------------------------- * |