From 33eea6856d85ce80c6097dd8d3673632e57b38bf Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 28 Feb 2022 11:43:20 +0000 Subject: Backout part of previous commit, making compile.test work again with --enable-symbols=all --- generic/tclCmdAH.c | 6 +++--- generic/tclCompCmds.c | 12 ++++++------ generic/tclCompile.h | 12 ++++++------ generic/tclDisassemble.c | 17 ++++++++--------- generic/tclExecute.c | 18 +++++++++--------- 5 files changed, 32 insertions(+), 33 deletions(-) diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 00bcdff..9bab9bf 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -2474,9 +2474,9 @@ EachloopCmd( int objc, /* The arguments being passed in... */ Tcl_Obj *const objv[]) { - size_t i, j, numLists = (objc-2) / 2; + int numLists = (objc-2) / 2; struct ForeachState *statePtr; - int result; + int i, j, result; if (objc < 4 || (objc%2 != 0)) { Tcl_WrongNumArgs(interp, 1, objv, @@ -2558,7 +2558,7 @@ EachloopCmd( if ((statePtr->argcList[i] % statePtr->varcList[i]) != 0) { j++; } - if (j > (size_t)statePtr->maxj) { + if (j > statePtr->maxj) { statePtr->maxj = j; } } diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 39a21c8..a44e7dd 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -2845,9 +2845,9 @@ CompileEachloopCmd( * body's code. Misuse loopCtTemp for storing the jump size. */ - jumpBackOffset = envPtr->exceptArrayPtr[range].codeOffset - - envPtr->exceptArrayPtr[range].continueOffset; - infoPtr->loopCtTemp = jumpBackOffset; + jumpBackOffset = envPtr->exceptArrayPtr[range].continueOffset - + envPtr->exceptArrayPtr[range].codeOffset; + infoPtr->loopCtTemp = -jumpBackOffset; /* * The command's result is an empty string if not collecting. If @@ -2895,7 +2895,7 @@ DupForeachInfo( ForeachInfo *srcPtr = (ForeachInfo *)clientData; ForeachInfo *dupPtr; ForeachVarList *srcListPtr, *dupListPtr; - size_t numVars, i, j, numLists = srcPtr->numLists; + int numVars, i, j, numLists = srcPtr->numLists; dupPtr = (ForeachInfo *)Tcl_Alloc(offsetof(ForeachInfo, varLists) + numLists * sizeof(ForeachVarList *)); @@ -3002,8 +3002,8 @@ PrintForeachInfo( if (j) { Tcl_AppendToObj(appendObj, ", ", -1); } - Tcl_AppendPrintfToObj(appendObj, "%%v%" TCL_Z_MODIFIER "u", - (size_t)varsPtr->varIndexes[j]); + Tcl_AppendPrintfToObj(appendObj, "%%v%u", + (unsigned) varsPtr->varIndexes[j]); } Tcl_AppendToObj(appendObj, "]", -1); } diff --git a/generic/tclCompile.h b/generic/tclCompile.h index c24150d..0d37c6b 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -871,7 +871,7 @@ typedef struct InstructionDesc { * computations. The value INT_MIN signals * that the instruction's worst case effect is * (1-opnd1). */ - size_t numOperands; /* Number of operands. */ + int numOperands; /* Number of operands. */ InstOperandType opTypes[MAX_INSTRUCTION_OPERANDS]; /* The type of each operand. */ } InstructionDesc; @@ -934,14 +934,14 @@ typedef enum { typedef struct JumpFixup { TclJumpType jumpType; /* Indicates the kind of jump. */ - size_t codeOffset; /* Offset of the first byte of the one-byte + unsigned int codeOffset; /* Offset of the first byte of the one-byte * forward jump's code. */ - size_t cmdIndex; /* Index of the first command after the one + int cmdIndex; /* Index of the first command after the one * for which the jump was emitted. Used to * update the code offsets for subsequent * commands if the two-byte jump at jumpPc * must be replaced with a five-byte one. */ - size_t exceptIndex; /* Index of the first range entry in the + int exceptIndex; /* Index of the first range entry in the * ExceptionRange array after the current one. * This field is used to adjust the code * offsets in subsequent ExceptionRange @@ -953,8 +953,8 @@ typedef struct JumpFixup { typedef struct JumpFixupArray { JumpFixup *fixup; /* Points to start of jump fixup array. */ - size_t next; /* Index of next free array entry. */ - size_t end; /* Index of last usable entry in array. */ + int next; /* Index of next free array entry. */ + int end; /* Index of last usable entry in array. */ int mallocedArray; /* 1 if array was expanded and fixups points * into the heap, else 0. */ JumpFixup staticFixupSpace[JUMPFIXUP_INIT_ENTRIES]; diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index 4839586..f946221 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -541,8 +541,7 @@ FormatInstruction( const InstructionDesc *instDesc = &tclInstructionTable[opCode]; unsigned char *codeStart = codePtr->codeStart; unsigned pcOffset = pc - codeStart; - int opnd = 0, j, numBytes = 1; - size_t i; + int opnd = 0, i, j, numBytes = 1; int localCt = procPtr ? procPtr->numCompiledLocals : 0; CompiledLocal *localPtr = procPtr ? procPtr->firstLocalPtr : NULL; char suffixBuffer[128]; /* Additional info to print after main opcode @@ -942,8 +941,8 @@ DisassembleByteCodeAsDicts( Tcl_Obj *description, *literals, *variables, *instructions, *inst; Tcl_Obj *aux, *exn, *commands, *file; unsigned char *pc, *opnd, *codeOffPtr, *codeLenPtr, *srcOffPtr, *srcLenPtr; - int val, line, codeOffset, codeLength, sourceOffset, sourceLength; - size_t i; + int codeOffset, codeLength, sourceOffset, sourceLength; + int i, val, line; ByteCodeGetInternalRep(objPtr, &tclByteCodeType, codePtr); @@ -952,7 +951,7 @@ DisassembleByteCodeAsDicts( */ TclNewObj(literals); - for (i=0 ; i<(size_t)codePtr->numLitObjects ; i++) { + for (i=0 ; inumLitObjects ; i++) { Tcl_ListObjAppendElement(NULL, literals, codePtr->objArrayPtr[i]); } @@ -962,7 +961,7 @@ DisassembleByteCodeAsDicts( TclNewObj(variables); if (codePtr->procPtr) { - size_t localCount = codePtr->procPtr->numCompiledLocals; + int localCount = codePtr->procPtr->numCompiledLocals; CompiledLocal *localPtr = codePtr->procPtr->firstLocalPtr; for (i=0 ; inextPtr) { @@ -1112,7 +1111,7 @@ DisassembleByteCodeAsDicts( */ TclNewObj(aux); - for (i=0 ; i<(size_t)codePtr->numAuxDataItems ; i++) { + for (i=0 ; inumAuxDataItems ; i++) { AuxData *auxData = &codePtr->auxDataArrayPtr[i]; Tcl_Obj *auxDesc = Tcl_NewStringObj(auxData->type->name, -1); @@ -1139,7 +1138,7 @@ DisassembleByteCodeAsDicts( */ TclNewObj(exn); - for (i=0 ; i<(size_t)codePtr->numExceptRanges ; i++) { + for (i=0 ; inumExceptRanges ; i++) { ExceptionRange *rangePtr = &codePtr->exceptArrayPtr[i]; switch (rangePtr->type) { @@ -1179,7 +1178,7 @@ DisassembleByteCodeAsDicts( srcOffPtr = codePtr->srcDeltaStart; srcLenPtr = codePtr->srcLengthStart; codeOffset = sourceOffset = 0; - for (i=0 ; i<(size_t)codePtr->numCommands ; i++) { + for (i=0 ; inumCommands ; i++) { Tcl_Obj *cmd; codeOffset += Decode(codeOffPtr); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index ab4aef7..0eb971f 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -4424,9 +4424,9 @@ TEBCresume( if (traceInstructions) { strncpy(cmdNameBuf, TclGetString(objv[0]), 20); } else { - fprintf(stdout, "%d: (%" TCL_Z_MODIFIER "u) invoking ", + fprintf(stdout, "%d: (%u) invoking ", iPtr->numLevels, - (size_t)(pc - codePtr->codeStart)); + (unsigned)(pc - codePtr->codeStart)); } for (i = 0; i < (size_t)opnd; i++) { TclPrintObject(stdout, objv[i], 15); @@ -6218,11 +6218,11 @@ TEBCresume( ForeachInfo *infoPtr; Tcl_Obj *listPtr, **elements; ForeachVarList *varListPtr; - size_t numLists, numVars; - int listTmpDepth, listLen; + int numLists, listLen, numVars; + int listTmpDepth; size_t iterNum, iterMax, iterTmp; - size_t varIndex, valIndex, j; - size_t i; + int varIndex, valIndex, j; + long i; case INST_FOREACH_START: /* @@ -6330,7 +6330,7 @@ TEBCresume( valIndex = (iterNum * numVars); for (j = 0; j < numVars; j++) { - if (valIndex >= (size_t)listLen) { + if (valIndex >= listLen) { TclNewObj(valuePtr); } else { valuePtr = elements[valIndex]; @@ -6355,7 +6355,7 @@ TEBCresume( if (TclPtrSetVarIdx(interp, varPtr, NULL, NULL, NULL, valuePtr, TCL_LEAVE_ERR_MSG, varIndex)==NULL){ CACHE_STACK_INFO(); - TRACE_APPEND(("ERROR init. index temp %" TCL_Z_MODIFIER "d: %.30s", + TRACE_APPEND(("ERROR init. index temp %d: %.30s", varIndex, O2S(Tcl_GetObjResult(interp)))); goto gotError; } @@ -6402,7 +6402,7 @@ TEBCresume( tmpPtr = OBJ_AT_DEPTH(1); infoPtr = (ForeachInfo *)tmpPtr->internalRep.twoPtrValue.ptr1; numLists = infoPtr->numLists; - TRACE_APPEND(("=> appending to list at depth %" TCL_Z_MODIFIER "d\n", 3 + numLists)); + TRACE_APPEND(("=> appending to list at depth %d\n", 3 + numLists)); objPtr = OBJ_AT_DEPTH(3 + numLists); Tcl_ListObjAppendElement(NULL, objPtr, OBJ_AT_TOS); -- cgit v0.12