diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-29 13:28:32 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-29 13:28:32 (GMT) |
commit | 4187ab8e37b22866a8b3a8727b9d661bca6378c8 (patch) | |
tree | adefcd33b5268f2e85014860b1f8aca78237da6c /generic/tclCompCmdsSZ.c | |
parent | 4796062aab8a24df621cf33dbe862f72b36986f8 (diff) | |
parent | a812c806619d185a0f16bfa431b848006ba98044 (diff) | |
download | tcl-4187ab8e37b22866a8b3a8727b9d661bca6378c8.zip tcl-4187ab8e37b22866a8b3a8727b9d661bca6378c8.tar.gz tcl-4187ab8e37b22866a8b3a8727b9d661bca6378c8.tar.bz2 |
Merge tip-548
Diffstat (limited to 'generic/tclCompCmdsSZ.c')
-rw-r--r-- | generic/tclCompCmdsSZ.c | 71 |
1 files changed, 61 insertions, 10 deletions
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index b24397a..b9ef056 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -45,13 +45,12 @@ static int CompileUnaryOpCmd(Tcl_Interp *interp, CompileEnv *envPtr); static void IssueSwitchChainedTests(Tcl_Interp *interp, CompileEnv *envPtr, int mode, int noCase, - int valueIndex, int numWords, - Tcl_Token **bodyToken, int *bodyLines, - int **bodyNext); -static void IssueSwitchJumpTable(Tcl_Interp *interp, - CompileEnv *envPtr, int valueIndex, int numWords, Tcl_Token **bodyToken, - int *bodyLines, int **bodyContLines); + int *bodyLines, int **bodyNext); +static void IssueSwitchJumpTable(Tcl_Interp *interp, + CompileEnv *envPtr, int numWords, + Tcl_Token **bodyToken, int *bodyLines, + int **bodyContLines); static int IssueTryClausesInstructions(Tcl_Interp *interp, CompileEnv *envPtr, Tcl_Token *bodyToken, int numHandlers, int *matchCodes, @@ -138,6 +137,7 @@ TclCompileSetCmd( Tcl_Token *varTokenPtr, *valueTokenPtr; int isAssignment, isScalar, localIndex, numWords; DefineLineInformation; /* TIP #280 */ + (void)cmdPtr; numWords = parsePtr->numWords; if ((numWords != 2) && (numWords != 3)) { @@ -233,6 +233,7 @@ TclCompileStringCatCmd( Tcl_Token *wordTokenPtr; Tcl_Obj *obj, *folded; DefineLineInformation; /* TIP #280 */ + (void)cmdPtr; /* Trivial case, no arg */ @@ -303,6 +304,7 @@ TclCompileStringCmpCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; + (void)cmdPtr; /* * We don't support any flags; the bytecode isn't that sophisticated. @@ -335,6 +337,7 @@ TclCompileStringEqualCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; + (void)cmdPtr; /* * We don't support any flags; the bytecode isn't that sophisticated. @@ -367,6 +370,7 @@ TclCompileStringFirstCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; + (void)cmdPtr; /* * We don't support any flags; the bytecode isn't that sophisticated. @@ -399,6 +403,7 @@ TclCompileStringLastCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; + (void)cmdPtr; /* * We don't support any flags; the bytecode isn't that sophisticated. @@ -431,6 +436,7 @@ TclCompileStringIndexCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; + (void)cmdPtr; if (parsePtr->numWords != 3) { return TCL_ERROR; @@ -460,6 +466,7 @@ TclCompileStringInsertCmd( Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ int idx; + (void)cmdPtr; if (parsePtr->numWords != 4) { return TCL_ERROR; @@ -885,6 +892,7 @@ TclCompileStringLenCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; Tcl_Obj *objPtr; + (void)cmdPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -988,6 +996,7 @@ TclCompileStringRangeCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *stringTokenPtr, *fromTokenPtr, *toTokenPtr; int idx1, idx2; + (void)cmdPtr; if (parsePtr->numWords != 4) { return TCL_ERROR; @@ -1064,6 +1073,7 @@ TclCompileStringReplaceCmd( Tcl_Token *tokenPtr, *valueTokenPtr; DefineLineInformation; /* TIP #280 */ int first, last; + (void)cmdPtr; if (parsePtr->numWords < 4 || parsePtr->numWords > 5) { return TCL_ERROR; @@ -1262,6 +1272,7 @@ TclCompileStringTrimLCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; + (void)cmdPtr; if (parsePtr->numWords != 2 && parsePtr->numWords != 3) { return TCL_ERROR; @@ -1290,6 +1301,7 @@ TclCompileStringTrimRCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; + (void)cmdPtr; if (parsePtr->numWords != 2 && parsePtr->numWords != 3) { return TCL_ERROR; @@ -1318,6 +1330,7 @@ TclCompileStringTrimCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; + (void)cmdPtr; if (parsePtr->numWords != 2 && parsePtr->numWords != 3) { return TCL_ERROR; @@ -1472,6 +1485,7 @@ TclCompileSubstCmd( Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr); int code = TCL_ERROR; DefineLineInformation; /* TIP #280 */ + (void)cmdPtr; if (numArgs == 0) { return TCL_ERROR; @@ -1816,6 +1830,7 @@ TclCompileSwitchCmd( int result = TCL_ERROR; DefineLineInformation; /* TIP #280 */ int *clNext = envPtr->clNext; + (void)cmdPtr; /* * Only handle the following versions: @@ -2080,10 +2095,10 @@ TclCompileSwitchCmd( CompileWord(envPtr, valueTokenPtr, interp, valueIndex); if (mode == Switch_Exact) { - IssueSwitchJumpTable(interp, envPtr, valueIndex, numWords, bodyToken, + IssueSwitchJumpTable(interp, envPtr, numWords, bodyToken, bodyLines, bodyContLines); } else { - IssueSwitchChainedTests(interp, envPtr, mode, noCase, valueIndex, + IssueSwitchChainedTests(interp, envPtr, mode, noCase, numWords, bodyToken, bodyLines, bodyContLines); } result = TCL_OK; @@ -2124,7 +2139,6 @@ IssueSwitchChainedTests( CompileEnv *envPtr, /* Holds resulting instructions. */ int mode, /* Exact, Glob or Regexp */ int noCase, /* Case-insensitivity flag. */ - int valueIndex, /* The value to match against. */ int numBodyTokens, /* Number of tokens describing things the * switch can match against and bodies to * execute when the match succeeds. */ @@ -2373,7 +2387,6 @@ static void IssueSwitchJumpTable( Tcl_Interp *interp, /* Context for compiling script bodies. */ CompileEnv *envPtr, /* Holds resulting instructions. */ - int valueIndex, /* The value to match against. */ int numBodyTokens, /* Number of tokens describing things the * switch can match against and bodies to * execute when the match succeeds. */ @@ -2607,6 +2620,7 @@ PrintJumptableInfo( Tcl_HashSearch search; const char *keyPtr; int offset, i = 0; + (void)codePtr; hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search); for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) { @@ -2637,6 +2651,8 @@ DisassembleJumptableInfo( Tcl_HashSearch search; const char *keyPtr; int offset; + (void)codePtr; + (void)pcOffset; hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search); for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) { @@ -2678,6 +2694,7 @@ TclCompileTailcallCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = parsePtr->tokenPtr; int i; + (void)cmdPtr; if (parsePtr->numWords < 2 || parsePtr->numWords > 256 || envPtr->procPtr == NULL) { @@ -2727,6 +2744,7 @@ TclCompileThrowCmd( Tcl_Token *codeToken, *msgToken; Tcl_Obj *objPtr; int codeKnown, codeIsList, codeIsValid, len; + (void)cmdPtr; if (numWords != 3) { return TCL_ERROR; @@ -2832,6 +2850,7 @@ TclCompileTryCmd( Tcl_Obj **matchClauses = NULL; int *matchCodes=NULL, *resultVarIndices=NULL, *optionVarIndices=NULL; int i; + (void)cmdPtr; if (numWords < 2) { return TCL_ERROR; @@ -3639,6 +3658,7 @@ TclCompileUnsetCmd( Tcl_Token *varTokenPtr; int isScalar, localIndex, flags = 1, i, varCount = 0, haveFlags = 0; DefineLineInformation; /* TIP #280 */ + (void)cmdPtr; /* TODO: Consider support for compiling expanded args. */ @@ -3781,6 +3801,7 @@ TclCompileWhileCmd( * infinite loop. */ Tcl_Obj *boolObj; DefineLineInformation; /* TIP #280 */ + (void)cmdPtr; if (parsePtr->numWords != 3) { return TCL_ERROR; @@ -3952,6 +3973,8 @@ TclCompileYieldCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + (void)cmdPtr; + if (parsePtr->numWords < 1 || parsePtr->numWords > 2) { return TCL_ERROR; } @@ -3998,6 +4021,7 @@ TclCompileYieldToCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); int i; + (void)cmdPtr; if (parsePtr->numWords < 2) { return TCL_ERROR; @@ -4245,6 +4269,7 @@ TclCompileInvertOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileUnaryOpCmd(interp, parsePtr, INST_BITNOT, envPtr); } @@ -4256,6 +4281,7 @@ TclCompileNotOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileUnaryOpCmd(interp, parsePtr, INST_LNOT, envPtr); } @@ -4267,6 +4293,7 @@ TclCompileAddOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileAssociativeBinaryOpCmd(interp, parsePtr, "0", INST_ADD, envPtr); } @@ -4279,6 +4306,7 @@ TclCompileMulOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileAssociativeBinaryOpCmd(interp, parsePtr, "1", INST_MULT, envPtr); } @@ -4291,6 +4319,7 @@ TclCompileAndOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileAssociativeBinaryOpCmd(interp, parsePtr, "-1", INST_BITAND, envPtr); } @@ -4303,6 +4332,7 @@ TclCompileOrOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileAssociativeBinaryOpCmd(interp, parsePtr, "0", INST_BITOR, envPtr); } @@ -4315,6 +4345,7 @@ TclCompileXorOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileAssociativeBinaryOpCmd(interp, parsePtr, "0", INST_BITXOR, envPtr); } @@ -4335,6 +4366,7 @@ TclCompilePowOpCmd( Tcl_Token *tokenPtr = parsePtr->tokenPtr; DefineLineInformation; /* TIP #280 */ int words; + (void)cmdPtr; for (words=1 ; words<parsePtr->numWords ; words++) { tokenPtr = TokenAfter(tokenPtr); @@ -4358,6 +4390,7 @@ TclCompileLshiftOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_LSHIFT, envPtr); } @@ -4369,6 +4402,7 @@ TclCompileRshiftOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_RSHIFT, envPtr); } @@ -4380,6 +4414,7 @@ TclCompileModOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_MOD, envPtr); } @@ -4391,6 +4426,7 @@ TclCompileNeqOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_NEQ, envPtr); } @@ -4402,6 +4438,7 @@ TclCompileStrneqOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_STR_NEQ, envPtr); } @@ -4413,6 +4450,7 @@ TclCompileInOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_LIST_IN, envPtr); } @@ -4424,6 +4462,7 @@ TclCompileNiOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_LIST_NOT_IN, envPtr); } @@ -4436,6 +4475,7 @@ TclCompileLessOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_LT, envPtr); } @@ -4447,6 +4487,7 @@ TclCompileLeqOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_LE, envPtr); } @@ -4458,6 +4499,7 @@ TclCompileGreaterOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_GT, envPtr); } @@ -4469,6 +4511,7 @@ TclCompileGeqOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_GE, envPtr); } @@ -4480,6 +4523,7 @@ TclCompileEqOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_EQ, envPtr); } @@ -4491,6 +4535,7 @@ TclCompileStreqOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_STR_EQ, envPtr); } @@ -4502,6 +4547,7 @@ TclCompileStrLtOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_STR_LT, envPtr); } @@ -4513,6 +4559,7 @@ TclCompileStrLeOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_STR_LE, envPtr); } @@ -4524,6 +4571,7 @@ TclCompileStrGtOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_STR_GT, envPtr); } @@ -4535,6 +4583,7 @@ TclCompileStrGeOpCmd( * compiled. */ CompileEnv *envPtr) { + (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_STR_GE, envPtr); } @@ -4549,6 +4598,7 @@ TclCompileMinusOpCmd( Tcl_Token *tokenPtr = parsePtr->tokenPtr; DefineLineInformation; /* TIP #280 */ int words; + (void)cmdPtr; /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords == 1) { @@ -4595,6 +4645,7 @@ TclCompileDivOpCmd( Tcl_Token *tokenPtr = parsePtr->tokenPtr; DefineLineInformation; /* TIP #280 */ int words; + (void)cmdPtr; /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords == 1) { |