diff options
author | dgp <dgp@users.sourceforge.net> | 2011-07-12 15:08:19 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2011-07-12 15:08:19 (GMT) |
commit | 15d2827a35e23f3221491e1cfc89efa5545e9e9f (patch) | |
tree | 81fddfc984b00375bb7a99c34c2262e343caf8cc /generic | |
parent | c1a48e4df9bd8dcf675799dc7e9fbf4881f236a0 (diff) | |
parent | 768647c04d60b84308cdc21a86e43682d3094333 (diff) | |
download | tcl-15d2827a35e23f3221491e1cfc89efa5545e9e9f.zip tcl-15d2827a35e23f3221491e1cfc89efa5545e9e9f.tar.gz tcl-15d2827a35e23f3221491e1cfc89efa5545e9e9f.tar.bz2 |
platform portable type matching in debug prints.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCompile.c | 14 | ||||
-rw-r--r-- | generic/tclExecute.c | 56 |
2 files changed, 36 insertions, 34 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 0b1a3ff..f29c54e 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2071,7 +2071,7 @@ TclInitByteCodeObj(objPtr, envPtr) #else nextPtr = EncodeCmdLocMap(envPtr, codePtr, (unsigned char *) p); if (((size_t)(nextPtr - p)) != cmdLocBytes) { - panic("TclInitByteCodeObj: encoded cmd location bytes %d != expected size %d\n", (nextPtr - p), cmdLocBytes); + panic("TclInitByteCodeObj: encoded cmd location bytes %ld != expected size %ld\n", (nextPtr - p), cmdLocBytes); } #endif @@ -3555,13 +3555,13 @@ TclPrintByteCodeObj(interp, objPtr) #endif #ifdef TCL_COMPILE_STATS fprintf(stdout, - " Code %d = header %d+inst %d+litObj %d+exc %d+aux %d+cmdMap %d\n", - codePtr->structureSize, - (sizeof(ByteCode) - (sizeof(size_t) + sizeof(Tcl_Time))), + " Code %u = header %u+inst %d+litObj %lu+exc %lu+aux %lu+cmdMap %d\n", + (unsigned int)codePtr->structureSize, + (unsigned int)(sizeof(ByteCode) - (sizeof(size_t) + sizeof(Tcl_Time))), codePtr->numCodeBytes, - (codePtr->numLitObjects * sizeof(Tcl_Obj *)), - (codePtr->numExceptRanges * sizeof(ExceptionRange)), - (codePtr->numAuxDataItems * sizeof(AuxData)), + (unsigned long)(codePtr->numLitObjects * sizeof(Tcl_Obj *)), + (unsigned long)(codePtr->numExceptRanges * sizeof(ExceptionRange)), + (unsigned long)(codePtr->numAuxDataItems * sizeof(AuxData)), codePtr->numCmdLocBytes); #endif /* TCL_COMPILE_STATS */ diff --git a/generic/tclExecute.c b/generic/tclExecute.c index fb74319..1c9d99d 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -3919,14 +3919,16 @@ TclExecuteByteCode(interp, codePtr) TclGetWide(w,valuePtr); if (Tcl_IsShared(valuePtr)) { objResultPtr = Tcl_NewWideIntObj(~w); - TRACE(("0x%llx => (%llu)\n", w, ~w)); + TRACE(("0x%" TCL_LL_MODIFIER "x => (%" TCL_LL_MODIFIER "u)\n", + w, ~w)); NEXT_INST_F(1, 1, 1); } else { /* * valuePtr is unshared. Modify it directly. */ Tcl_SetWideIntObj(valuePtr, ~w); - TRACE(("0x%llx => (%llu)\n", w, ~w)); + TRACE(("0x%" TCL_LL_MODIFIER "x => (%" TCL_LL_MODIFIER "u)\n", + w, ~w)); NEXT_INST_F(1, 0, 0); } } else { @@ -4575,13 +4577,13 @@ PrintByteCodeInfo(codePtr) 0.0); #endif #ifdef TCL_COMPILE_STATS - fprintf(stdout, " Code %d = header %d+inst %d+litObj %d+exc %d+aux %d+cmdMap %d\n", - codePtr->structureSize, - (sizeof(ByteCode) - (sizeof(size_t) + sizeof(Tcl_Time))), + fprintf(stdout, " Code %u = header %u+inst %d+litObj %lu+exc %lu+aux %lu+cmdMap %d\n", + (unsigned int)codePtr->structureSize, + (unsigned int)(sizeof(ByteCode) - (sizeof(size_t) + sizeof(Tcl_Time))), codePtr->numCodeBytes, - (codePtr->numLitObjects * sizeof(Tcl_Obj *)), - (codePtr->numExceptRanges * sizeof(ExceptionRange)), - (codePtr->numAuxDataItems * sizeof(AuxData)), + (unsigned long)(codePtr->numLitObjects * sizeof(Tcl_Obj *)), + (unsigned long)(codePtr->numExceptRanges * sizeof(ExceptionRange)), + (unsigned long)(codePtr->numAuxDataItems * sizeof(AuxData)), codePtr->numCmdLocBytes); #endif /* TCL_COMPILE_STATS */ if (procPtr != NULL) { @@ -6239,11 +6241,11 @@ EvalStatsCmd(unused, interp, objc, objv) statsPtr->totalByteCodeBytes); fprintf(stdout, " Literal bytes %.6g\n", totalLiteralBytes); - fprintf(stdout, " table %d + bkts %d + entries %ld + objects %ld + strings %.6g\n", - sizeof(LiteralTable), - iPtr->literalTable.numBuckets * sizeof(LiteralEntry *), - statsPtr->numLiteralsCreated * sizeof(LiteralEntry), - statsPtr->numLiteralsCreated * sizeof(Tcl_Obj), + fprintf(stdout, " table %u + bkts %lu + entries %lu + objects %lu + strings %.6g\n", + (unsigned int)sizeof(LiteralTable), + (unsigned long)iPtr->literalTable.numBuckets * sizeof(LiteralEntry *), + (unsigned long)statsPtr->numLiteralsCreated * sizeof(LiteralEntry), + (unsigned long)statsPtr->numLiteralsCreated * sizeof(Tcl_Obj), statsPtr->totalLitStringBytes); fprintf(stdout, " Mean code/compile %.1f\n", totalCodeBytes / statsPtr->numCompilations); @@ -6260,11 +6262,11 @@ EvalStatsCmd(unused, interp, objc, objv) statsPtr->currentByteCodeBytes); fprintf(stdout, " Literal bytes %.6g\n", currentLiteralBytes); - fprintf(stdout, " table %d + bkts %d + entries %d + objects %d + strings %.6g\n", - sizeof(LiteralTable), - iPtr->literalTable.numBuckets * sizeof(LiteralEntry *), - iPtr->literalTable.numEntries * sizeof(LiteralEntry), - iPtr->literalTable.numEntries * sizeof(Tcl_Obj), + fprintf(stdout, " table %u + bkts %lu + entries %lu + objects %lu + strings %.6g\n", + (unsigned int)sizeof(LiteralTable), + (unsigned long)iPtr->literalTable.numBuckets * sizeof(LiteralEntry *), + (unsigned long)iPtr->literalTable.numEntries * sizeof(LiteralEntry), + (unsigned long)iPtr->literalTable.numEntries * sizeof(Tcl_Obj), statsPtr->currentLitStringBytes); fprintf(stdout, " Mean code/source %.1f\n", currentCodeBytes / statsPtr->currentSrcBytes); @@ -6355,11 +6357,11 @@ EvalStatsCmd(unused, interp, objc, objv) (sharingBytesSaved * 100.0) / (objBytesIfUnshared + strBytesIfUnshared)); fprintf(stdout, " Bytes with sharing %.6g\n", currentLiteralBytes); - fprintf(stdout, " table %d + bkts %d + entries %d + objects %d + strings %.6g\n", - sizeof(LiteralTable), - iPtr->literalTable.numBuckets * sizeof(LiteralEntry *), - iPtr->literalTable.numEntries * sizeof(LiteralEntry), - iPtr->literalTable.numEntries * sizeof(Tcl_Obj), + fprintf(stdout, " table %u + bkts %lu + entries %lu + objects %lu + strings %.6g\n", + (unsigned int)sizeof(LiteralTable), + (unsigned long)iPtr->literalTable.numBuckets * sizeof(LiteralEntry *), + (unsigned long)iPtr->literalTable.numEntries * sizeof(LiteralEntry), + (unsigned long)iPtr->literalTable.numEntries * sizeof(Tcl_Obj), statsPtr->currentLitStringBytes); fprintf(stdout, " Bytes if no sharing %.6g = objects %.6g + strings %.6g\n", (objBytesIfUnshared + strBytesIfUnshared), @@ -6370,10 +6372,10 @@ EvalStatsCmd(unused, interp, objc, objv) fprintf(stdout, " Literal mgmt overhead %ld (%0.1f%% of bytes with sharing)\n", literalMgmtBytes, (literalMgmtBytes * 100.0) / currentLiteralBytes); - fprintf(stdout, " table %d + buckets %d + entries %d\n", - sizeof(LiteralTable), - iPtr->literalTable.numBuckets * sizeof(LiteralEntry *), - iPtr->literalTable.numEntries * sizeof(LiteralEntry)); + fprintf(stdout, " table %u + buckets %lu + entries %lu\n", + (unsigned int)sizeof(LiteralTable), + (unsigned long)iPtr->literalTable.numBuckets * sizeof(LiteralEntry *), + (unsigned long)iPtr->literalTable.numEntries * sizeof(LiteralEntry)); /* * Breakdown of current ByteCode space requirements. |