summaryrefslogtreecommitdiffstats
path: root/test/noencoder.h5
Commit message (Collapse)AuthorAgeFilesLines
* [svn-r15037] Description:Quincey Koziol2008-05-191-0/+0
| | | | | | | Better cleanup of internal structures when no szip encoder. Tested on: Linux/32 2.6 (kagiso) w/szip-no encoder
* [svn-r8781] James Laird2004-07-011-0/+0
Purpose: HDF5 now supports SZIP with no encoder. Description: SZIP can be configured to have both encoder and decoder or just to have the decoder. HDF5 can now query the configuration of any filter, and will throw errors if users try to write using a filter with encoding disabled. Solution: Added H5Zget_filter_info function, changed API for H5Pget_filter and H5P_get_filter_by_id. See SZIP RFC. Platforms tested: Copper (fortran, C++, parallel), Sleipnir (C++), Arabica (fortran, C++), Verbena (fortran, C++) Misc. update:
eof(int)); if (nocase) { - u2lc = TclStackAlloc(interp, mapElemc * sizeof(int)); + u2lc = (int *)TclStackAlloc(interp, mapElemc * sizeof(int)); } for (index = 0; index < mapElemc; index++) { mapStrings[index] = Tcl_GetUnicodeFromObj(mapElemv[index], diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index a6ac797..90549b0 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -919,7 +919,7 @@ ParseExpr( break; case SCRIPT: { - Tcl_Parse *nestedPtr = + Tcl_Parse *nestedPtr = (Tcl_Parse *) TclStackAlloc(interp, sizeof(Tcl_Parse)); tokenPtr = parsePtr->tokenPtr + parsePtr->numTokens; @@ -1838,7 +1838,7 @@ Tcl_ParseExpr( OpNode *opTree = NULL; /* Will point to the tree of operators. */ Tcl_Obj *litList = Tcl_NewObj(); /* List to hold the literals. */ Tcl_Obj *funcList = Tcl_NewObj(); /* List to hold the functon names. */ - Tcl_Parse *exprParsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse)); + Tcl_Parse *exprParsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse)); /* Holds the Tcl_Tokens of substitutions. */ if (numBytes < 0) { @@ -2156,7 +2156,7 @@ TclCompileExpr( OpNode *opTree = NULL; /* Will point to the tree of operators */ Tcl_Obj *litList = Tcl_NewObj(); /* List to hold the literals */ Tcl_Obj *funcList = Tcl_NewObj(); /* List to hold the functon names*/ - Tcl_Parse *parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse)); + Tcl_Parse *parsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse)); /* Holds the Tcl_Tokens of substitutions */ int code = ParseExpr(interp, script, numBytes, &opTree, litList, @@ -2226,7 +2226,7 @@ ExecConstantExprTree( * bytecode, so there's no need to tend to TIP 280 issues. */ - envPtr = TclStackAlloc(interp, sizeof(CompileEnv)); + envPtr = (CompileEnv *)TclStackAlloc(interp, sizeof(CompileEnv)); TclInitCompileEnv(interp, envPtr, NULL, 0, NULL, 0); CompileExprTree(interp, nodes, index, litObjvPtr, NULL, NULL, envPtr, 0 /* optimize */); @@ -2321,13 +2321,13 @@ CompileExprTree( break; } case QUESTION: - newJump = TclStackAlloc(interp, sizeof(JumpList)); + newJump = (JumpList *)TclStackAlloc(interp, sizeof(JumpList)); newJump->next = jumpPtr; jumpPtr = newJump; TclEmitForwardJump(envPtr, TCL_FALSE_JUMP, &jumpPtr->jump); break; case COLON: - newJump = TclStackAlloc(interp, sizeof(JumpList)); + newJump = (JumpList *)TclStackAlloc(interp, sizeof(JumpList)); newJump->next = jumpPtr; jumpPtr = newJump; TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, @@ -2340,7 +2340,7 @@ CompileExprTree( break; case AND: case OR: - newJump = TclStackAlloc(interp, sizeof(JumpList)); + newJump = (JumpList *)TclStackAlloc(interp, sizeof(JumpList)); newJump->next = jumpPtr; jumpPtr = newJump; TclEmitForwardJump(envPtr, (nodePtr->lexeme == AND) @@ -2632,9 +2632,9 @@ TclSortingOpCmd( Tcl_SetObjResult(interp, Tcl_NewBooleanObj(1)); } else { TclOpCmdClientData *occdPtr = clientData; - Tcl_Obj **litObjv = TclStackAlloc(interp, + Tcl_Obj **litObjv = (Tcl_Obj **)TclStackAlloc(interp, 2 * (objc-2) * sizeof(Tcl_Obj *)); - OpNode *nodes = TclStackAlloc(interp, 2 * (objc-2) * sizeof(OpNode)); + OpNode *nodes = (OpNode *)TclStackAlloc(interp, 2 * (objc-2) * sizeof(OpNode)); unsigned char lexeme; int i, lastAnd = 1; Tcl_Obj *const *litObjPtrPtr = litObjv; @@ -2761,7 +2761,7 @@ TclVariadicOpCmd( return code; } else { Tcl_Obj *const *litObjv = objv + 1; - OpNode *nodes = TclStackAlloc(interp, (objc-1) * sizeof(OpNode)); + OpNode *nodes = (OpNode *)TclStackAlloc(interp, (objc-1) * sizeof(OpNode)); int i, lastOp = OT_LITERAL; nodes[0].lexeme = START; diff --git a/generic/tclCompile.c b/generic/tclCompile.c index c10e3ee..6faa273 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1148,7 +1148,7 @@ CleanupByteCode( (char *) codePtr); if (hePtr) { - ReleaseCmdWordData(Tcl_GetHashValue(hePtr)); + ReleaseCmdWordData((ExtCmdLoc *)Tcl_GetHashValue(hePtr)); Tcl_DeleteHashEntry(hePtr); } } @@ -1554,7 +1554,7 @@ TclInitCompileEnv( * ...) which may make change the type as well. */ - CmdFrame *ctxPtr = TclStackAlloc(interp, sizeof(CmdFrame)); + CmdFrame *ctxPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame)); int pc = 0; *ctxPtr = *invoker; @@ -2452,7 +2452,7 @@ TclCompileTokens( if (numCL >= maxNumCL) { maxNumCL *= 2; - clPosition = ckrealloc(clPosition, + clPosition = (int *)ckrealloc(clPosition, maxNumCL * sizeof(int)); } clPosition[numCL] = clPos; diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index f3b0981..7862a0f 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -2499,7 +2499,7 @@ DictForNRCmd( Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "dict", "for", NULL); return TCL_ERROR; } - searchPtr = TclStackAlloc(interp, sizeof(Tcl_DictSearch)); + searchPtr = (Tcl_DictSearch *)TclStackAlloc(interp, sizeof(Tcl_DictSearch)); if (Tcl_DictObjFirst(interp, objv[2], searchPtr, &keyObj, &valueObj, &done) != TCL_OK) { TclStackFree(interp, searchPtr); @@ -2693,7 +2693,7 @@ DictMapNRCmd( Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "dict", "map", NULL); return TCL_ERROR; } - storagePtr = TclStackAlloc(interp, sizeof(DictMapStorage)); + storagePtr = (DictMapStorage *)TclStackAlloc(interp, sizeof(DictMapStorage)); if (Tcl_DictObjFirst(interp, objv[2], &storagePtr->search, &keyObj, &valueObj, &done) != TCL_OK) { TclStackFree(interp, storagePtr); diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 734f114..eedecf2 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -55,7 +55,7 @@ typedef struct { typedef struct ExitHandler { Tcl_ExitProc *proc; /* Function to call when process exits. */ - ClientData clientData; /* One word of information to pass to proc. */ + void *clientData; /* One word of information to pass to proc. */ struct ExitHandler *nextPtr;/* Next in list of all exit handlers for this * application, or NULL for end of list. */ } ExitHandler; @@ -103,19 +103,19 @@ static Tcl_ThreadDataKey dataKey; #if TCL_THREADS typedef struct { Tcl_ThreadCreateProc *proc; /* Main() function of the thread */ - ClientData clientData; /* The one argument to Main() */ + void *clientData; /* The one argument to Main() */ } ThreadClientData; -static Tcl_ThreadCreateType NewThreadProc(ClientData clientData); +static Tcl_ThreadCreateType NewThreadProc(void *clientData); #endif /* TCL_THREADS */ /* * Prototypes for functions referenced only in this file: */ -static void BgErrorDeleteProc(ClientData clientData, +static void BgErrorDeleteProc(void *clientData, Tcl_Interp *interp); -static void HandleBgErrors(ClientData clientData); -static char * VwaitVarProc(ClientData clientData, +static void HandleBgErrors(void *clientData); +static char * VwaitVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static void InvokeExitHandlers(void); @@ -163,7 +163,7 @@ Tcl_BackgroundException( return; } - errPtr = ckalloc(sizeof(BgError)); + errPtr = (BgError*)ckalloc(sizeof(BgError)); errPtr->errorMsg = Tcl_GetObjResult(interp); Tcl_IncrRefCount(errPtr->errorMsg); errPtr->returnOpts = Tcl_GetReturnOptions(interp, code); @@ -171,7 +171,7 @@ Tcl_BackgroundException( errPtr->nextPtr = NULL; (void) TclGetBgErrorHandler(interp); - assocPtr = Tcl_GetAssocData(interp, "tclBgError", NULL); + assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL); if (assocPtr->firstBgPtr == NULL) { assocPtr->firstBgPtr = errPtr; Tcl_DoWhenIdle(HandleBgErrors, assocPtr); @@ -201,9 +201,9 @@ Tcl_BackgroundException( static void HandleBgErrors( - ClientData clientData) /* Pointer to ErrAssocData structure. */ + void *clientData) /* Pointer to ErrAssocData structure. */ { - ErrAssocData *assocPtr = clientData; + ErrAssocData *assocPtr = (ErrAssocData *)clientData; Tcl_Interp *interp = assocPtr->interp; BgError *errPtr; @@ -230,7 +230,7 @@ HandleBgErrors( errPtr = assocPtr->firstBgPtr; Tcl_ListObjGetElements(NULL, copyObj, &prefixObjc, &prefixObjv); - tempObjv = ckalloc((prefixObjc+2) * sizeof(Tcl_Obj *)); + tempObjv = (Tcl_Obj**)ckalloc((prefixObjc+2) * sizeof(Tcl_Obj *)); memcpy(tempObjv, prefixObjv, prefixObjc*sizeof(Tcl_Obj *)); tempObjv[prefixObjc] = errPtr->errorMsg; tempObjv[prefixObjc+1] = errPtr->returnOpts; @@ -311,7 +311,7 @@ HandleBgErrors( int TclDefaultBgErrorHandlerObjCmd( - ClientData dummy, /* Not used. */ + void *dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -518,7 +518,7 @@ TclSetBgErrorHandler( Tcl_Interp *interp, Tcl_Obj *cmdPrefix) { - ErrAssocData *assocPtr = Tcl_GetAssocData(interp, "tclBgError", NULL); + ErrAssocData *assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL); if (cmdPrefix == NULL) { Tcl_Panic("TclSetBgErrorHandler: NULL cmdPrefix argument"); @@ -528,7 +528,7 @@ TclSetBgErrorHandler( * First access: initialize. */ - assocPtr = ckalloc(sizeof(ErrAssocData)); + assocPtr = (ErrAssocData*)ckalloc(sizeof(ErrAssocData)); assocPtr->interp = interp; assocPtr->cmdPrefix = NULL; assocPtr->firstBgPtr = NULL; @@ -563,14 +563,14 @@ Tcl_Obj * TclGetBgErrorHandler( Tcl_Interp *interp) { - ErrAssocData *assocPtr = Tcl_GetAssocData(interp, "tclBgError", NULL); + ErrAssocData *assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL); if (assocPtr == NULL) { Tcl_Obj *bgerrorObj; TclNewLiteralStringObj(bgerrorObj, "::tcl::Bgerror"); TclSetBgErrorHandler(interp, bgerrorObj); - assocPtr = Tcl_GetAssocData(interp, "tclBgError", NULL); + assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL); } return assocPtr->cmdPrefix; } @@ -596,10 +596,10 @@ TclGetBgErrorHandler( static void BgErrorDeleteProc( - ClientData clientData, /* Pointer to ErrAssocData structure. */ + void *clientData, /* Pointer to ErrAssocData structure. */ Tcl_Interp *interp) /* Interpreter being deleted. */ { - ErrAssocData *assocPtr = clientData; + ErrAssocData *assocPtr = (ErrAssocData *)clientData; BgError *errPtr; while (assocPtr->firstBgPtr != NULL) { @@ -635,9 +635,9 @@ BgErrorDeleteProc( void Tcl_CreateExitHandler( Tcl_ExitProc *proc, /* Function to invoke. */ - ClientData clientData) /* Arbitrary value to pass to proc. */ + void *clientData) /* Arbitrary value to pass to proc. */ { - ExitHandler *exitPtr = ckalloc(sizeof(ExitHandler)); + ExitHandler *exitPtr = (ExitHandler*)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; @@ -668,9 +668,9 @@ Tcl_CreateExitHandler( void TclCreateLateExitHandler( Tcl_ExitProc *proc, /* Function to invoke. */ - ClientData clientData) /* Arbitrary value to pass to proc. */ + void *clientData) /* Arbitrary value to pass to proc. */ { - ExitHandler *exitPtr = ckalloc(sizeof(ExitHandler)); + ExitHandler *exitPtr = (ExitHandler*)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; @@ -701,7 +701,7 @@ TclCreateLateExitHandler( void Tcl_DeleteExitHandler( Tcl_ExitProc *proc, /* Function that was previously registered. */ - ClientData clientData) /* Arbitrary value to pass to proc. */ + void *clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr, *prevPtr; @@ -744,7 +744,7 @@ Tcl_DeleteExitHandler( void TclDeleteLateExitHandler( Tcl_ExitProc *proc, /* Function that was previously registered. */ - ClientData clientData) /* Arbitrary value to pass to proc. */ + void *clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr, *prevPtr; @@ -787,12 +787,12 @@ TclDeleteLateExitHandler( void Tcl_CreateThreadExitHandler( Tcl_ExitProc *proc, /* Function to invoke. */ - ClientData clientData) /* Arbitrary value to pass to proc. */ + void *clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - exitPtr = ckalloc(sizeof(ExitHandler)); + exitPtr = (ExitHandler*)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; exitPtr->nextPtr = tsdPtr->firstExitPtr; @@ -820,7 +820,7 @@ Tcl_CreateThreadExitHandler( void Tcl_DeleteThreadExitHandler( Tcl_ExitProc *proc, /* Function that was previously registered. */ - ClientData clientData) /* Arbitrary value to pass to proc. */ + void *clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr, *prevPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -1296,7 +1296,7 @@ FinalizeThread( * initialized already. */ - tsdPtr = TclThreadDataKeyGet(&dataKey); + tsdPtr = (ThreadSpecificData*)TclThreadDataKeyGet(&dataKey); if (tsdPtr != NULL) { tsdPtr->inExit = 1; @@ -1371,7 +1371,7 @@ TclInExit(void) int TclInThreadExit(void) { - ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey); + ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey); if (tsdPtr == NULL) { return 0; @@ -1399,7 +1399,7 @@ TclInThreadExit(void) /* ARGSUSED */ int Tcl_VwaitObjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1463,13 +1463,13 @@ Tcl_VwaitObjCmd( /* ARGSUSED */ static char * VwaitVarProc( - ClientData clientData, /* Pointer to integer to set to 1. */ + void *clientData, /* Pointer to integer to set to 1. */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - int *donePtr = clientData; + int *donePtr = (int *)clientData; *donePtr = 1; Tcl_UntraceVar(interp, name1, TCL_TRACE_WRITES|TCL_TRACE_UNSETS, @@ -1497,7 +1497,7 @@ VwaitVarProc( /* ARGSUSED */ int Tcl_UpdateObjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1565,10 +1565,10 @@ Tcl_UpdateObjCmd( static Tcl_ThreadCreateType NewThreadProc( - ClientData clientData) + void *clientData) { - ThreadClientData *cdPtr = clientData; - ClientData threadClientData; + ThreadClientData *cdPtr = (ThreadClientData *)clientData; + void *threadClientData; Tcl_ThreadCreateProc *threadProc; threadProc = cdPtr->proc; @@ -1604,13 +1604,13 @@ int Tcl_CreateThread( Tcl_ThreadId *idPtr, /* Return, the ID of the thread */ Tcl_ThreadCreateProc *proc, /* Main() function of the thread */ - ClientData clientData, /* The one argument to Main() */ + void *clientData, /* The one argument to Main() */ int stackSize, /* Size of stack for the new thread */ int flags) /* Flags controlling behaviour of the new * thread. */ { #if TCL_THREADS - ThreadClientData *cdPtr = ckalloc(sizeof(ThreadClientData)); + ThreadClientData *cdPtr = (ThreadClientData *)ckalloc(sizeof(ThreadClientData)); int result; cdPtr->proc = proc; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 520c2ee..f47f8ea 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1695,7 +1695,7 @@ TclCompileObj( eclPtr = Tcl_GetHashValue(hePtr); redo = 0; - ctxCopyPtr = TclStackAlloc(interp, sizeof(CmdFrame)); + ctxCopyPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame)); *ctxCopyPtr = *invoker; if (invoker->type == TCL_LOCATION_BC) { diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 98ee37c..3ed16a4 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -1449,7 +1449,7 @@ Tcl_GlobObjCmd( if (length <= 0) { goto skipTypes; } - globTypes = TclStackAlloc(interp, sizeof(Tcl_GlobTypeData)); + globTypes = (Tcl_GlobTypeData *)TclStackAlloc(interp, sizeof(Tcl_GlobTypeData)); globTypes->type = 0; globTypes->perm = 0; globTypes->macType = NULL; diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 271fc57..5bf5949 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -952,7 +952,7 @@ Tcl_ExecObjCmd( */ argc = objc - skip; - argv = TclStackAlloc(interp, (argc + 1) * sizeof(char *)); + argv = (const char **)TclStackAlloc(interp, (argc + 1) * sizeof(char *)); /* * Copy the string conversions of each (post option) object into the diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index 919db92..c7114ae 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -126,7 +126,7 @@ Tcl_GetIndexFromObj( const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &indexType); if (irPtr) { - IndexRep *indexRep = irPtr->twoPtrValue.ptr1; + IndexRep *indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1; /* * Here's hoping we don't get hit by unfortunate packing constraints @@ -200,7 +200,7 @@ GetIndexFromObjList( * Build a string table from the list. */ - tablePtr = ckalloc((objc + 1) * sizeof(char *)); + tablePtr = (const char **)ckalloc((objc + 1) * sizeof(char *)); for (t = 0; t < objc; t++) { if (objv[t] == objPtr) { /* @@ -284,7 +284,7 @@ Tcl_GetIndexFromObjStruct( if (!(flags & INDEX_TEMP_TABLE)) { irPtr = TclFetchIntRep(objPtr, &indexType); if (irPtr) { - indexRep = irPtr->twoPtrValue.ptr1; + indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1; if (indexRep->tablePtr==tablePtr && indexRep->offset==offset) { *indexPtr = indexRep->index; return TCL_OK; @@ -308,7 +308,7 @@ Tcl_GetIndexFromObjStruct( * - Several abbreviations (never allowed, but overridden by exact match) */ - for (entryPtr = tablePtr, idx = 0; *entryPtr != NULL; + for (entryPtr = (const char* const*)tablePtr, idx = 0; *entryPtr != NULL; entryPtr = NEXT_ENTRY(entryPtr, offset), idx++) { for (p1 = key, p2 = *entryPtr; *p1 == *p2; p1++, p2++) { if (*p1 == '\0') { @@ -352,7 +352,7 @@ Tcl_GetIndexFromObjStruct( } else { Tcl_ObjIntRep ir; - indexRep = ckalloc(sizeof(IndexRep)); + indexRep = (IndexRep*)ckalloc(sizeof(IndexRep)); ir.twoPtrValue.ptr1 = indexRep; Tcl_StoreIntRep(objPtr, &indexType, &ir); } @@ -978,7 +978,7 @@ Tcl_WrongNumArgs( len = TclScanElement(elementStr, elemLen, &flags); if (MAY_QUOTE_WORD && len != elemLen) { - char *quotedElementStr = TclStackAlloc(interp, len + 1); + char *quotedElementStr = (char *)TclStackAlloc(interp, len + 1); len = TclConvertElement(elementStr, elemLen, quotedElementStr, flags); @@ -1029,7 +1029,7 @@ Tcl_WrongNumArgs( len = TclScanElement(elementStr, elemLen, &flags); if (MAY_QUOTE_WORD && len != elemLen) { - char *quotedElementStr = TclStackAlloc(interp, len + 1); + char *quotedElementStr = (char *)TclStackAlloc(interp, len + 1); len = TclConvertElement(elementStr, elemLen, quotedElementStr, flags); @@ -1319,7 +1319,7 @@ Tcl_ParseArgsObjv( } leftovers[nrem] = NULL; *objcPtr = nrem++; - *remObjv = ckrealloc(leftovers, nrem * sizeof(Tcl_Obj *)); + *remObjv = (Tcl_Obj **)ckrealloc(leftovers, nrem * sizeof(Tcl_Obj *)); return TCL_OK; /* diff --git a/generic/tclInt.h b/generic/tclInt.h index 27d7e6d..972996a 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4350,7 +4350,7 @@ MODULE_SCOPE void TclpFreeAllocCache(void *); (objPtr) = TclThreadAllocObj(); \ } else { \ (objPtr) = cachePtr->firstObjPtr; \ - cachePtr->firstObjPtr = (objPtr)->internalRep.twoPtrValue.ptr1; \ + cachePtr->firstObjPtr = (Tcl_Obj *)(objPtr)->internalRep.twoPtrValue.ptr1; \ --cachePtr->numObjects; \ } \ } while (0) diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 92c6159..e76e41e 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -1188,7 +1188,7 @@ Tcl_CreateAlias( int i; int result; - objv = TclStackAlloc(slaveInterp, sizeof(Tcl_Obj *) * argc); + objv = (Tcl_Obj **)TclStackAlloc(slaveInterp, sizeof(Tcl_Obj *) * argc); for (i = 0; i < argc; i++) { objv[i] = Tcl_NewStringObj(argv[i], -1); Tcl_IncrRefCount(objv[i]); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index bbe357d..cde572f 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -1146,7 +1146,7 @@ TclTeardownNamespace( while (nsPtr->cmdTable.numEntries > 0) { int length = nsPtr->cmdTable.numEntries; - Command **cmds = TclStackAlloc((Tcl_Interp *) iPtr, + Command **cmds = (Command **)TclStackAlloc((Tcl_Interp *) iPtr, sizeof(Command *) * length); i = 0; @@ -1218,7 +1218,7 @@ TclTeardownNamespace( #ifndef BREAK_NAMESPACE_COMPAT while (nsPtr->childTable.numEntries > 0) { int length = nsPtr->childTable.numEntries; - Namespace **children = TclStackAlloc((Tcl_Interp *) iPtr, + Namespace **children = (Namespace **)TclStackAlloc((Tcl_Interp *) iPtr, sizeof(Namespace *) * length); i = 0; @@ -1239,7 +1239,7 @@ TclTeardownNamespace( if (nsPtr->childTablePtr != NULL) { while (nsPtr->childTablePtr->numEntries > 0) { int length = nsPtr->childTablePtr->numEntries; - Namespace **children = TclStackAlloc((Tcl_Interp *) iPtr, + Namespace **children = (Namespace **)TclStackAlloc((Tcl_Interp *) iPtr, sizeof(Namespace *) * length); i = 0; @@ -2764,7 +2764,7 @@ TclResetShadowedCmdRefs( int found, i; int trailFront = -1; int trailSize = 5; /* Formerly NUM_TRAIL_ELEMS. */ - Namespace **trailPtr = TclStackAlloc(interp, + Namespace **trailPtr = (Namespace **)TclStackAlloc(interp, trailSize * sizeof(Namespace *)); /* @@ -4063,7 +4063,7 @@ NamespacePathCmd( goto badNamespace; } if (nsObjc != 0) { - namespaceList = TclStackAlloc(interp, + namespaceList = (Tcl_Namespace **)TclStackAlloc(interp, sizeof(Tcl_Namespace *) * nsObjc); for (i=0 ; ifPtr->interp, sizeof(CallContext)); + contextPtr = (CallContext *)TclStackAlloc(oPtr->fPtr->interp, sizeof(CallContext)); contextPtr->oPtr = oPtr; /* @@ -1819,7 +1819,7 @@ TclOORenderCallChain( * method (or "object" if it is declared on the instance). */ - objv = TclStackAlloc(interp, callPtr->numChain * sizeof(Tcl_Obj *)); + objv = (Tcl_Obj **)TclStackAlloc(interp, callPtr->numChain * sizeof(Tcl_Obj *)); for (i = 0 ; i < callPtr->numChain ; i++) { struct MInvoke *miPtr = &callPtr->chain[i]; diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index 6a00018..9ffdc27 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -738,7 +738,7 @@ TclOOUnknownDefinition( * Got one match, and only one match! */ - Tcl_Obj **newObjv = + Tcl_Obj **newObjv = (Tcl_Obj **) TclStackAlloc(interp, sizeof(Tcl_Obj*) * (objc - 1)); int result; @@ -2461,7 +2461,7 @@ ClassMixinSet( return TCL_ERROR; } - mixins = TclStackAlloc(interp, sizeof(Class *) * mixinc); + mixins = (Class **)TclStackAlloc(interp, sizeof(Class *) * mixinc); for (i = 0; i < mixinc; i++) { mixins[i] = GetClassInOuterContext(interp, mixinv[i], @@ -2908,7 +2908,7 @@ ObjMixinSet( return TCL_ERROR; } - mixins = TclStackAlloc(interp, sizeof(Class *) * mixinc); + mixins = (Class **)TclStackAlloc(interp, sizeof(Class *) * mixinc); for (i = 0; i < mixinc; i++) { mixins[i] = GetClassInOuterContext(interp, mixinv[i], diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index 32dd3c7..ed06a5c 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -692,7 +692,7 @@ InvokeProcedureMethod( * Allocate the special frame data. */ - fdPtr = TclStackAlloc(interp, sizeof(PMFrameData)); + fdPtr = (PMFrameData *)TclStackAlloc(interp, sizeof(PMFrameData)); /* * Create a call frame for this method. @@ -1620,7 +1620,7 @@ InitEnsembleRewrite( * array of rewritten arguments. */ { unsigned len = rewriteLength + objc - toRewrite; - Tcl_Obj **argObjs = TclStackAlloc(interp, sizeof(Tcl_Obj *) * len); + Tcl_Obj **argObjs = (Tcl_Obj **)TclStackAlloc(interp, sizeof(Tcl_Obj *) * len); memcpy(argObjs, rewriteObjs, rewriteLength * sizeof(Tcl_Obj *)); memcpy(argObjs + rewriteLength, objv + toRewrite, diff --git a/generic/tclParse.c b/generic/tclParse.c index 164905a..e4614a3 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -1131,7 +1131,7 @@ ParseTokens( src++; numBytes--; - nestedPtr = TclStackAlloc(parsePtr->interp, sizeof(Tcl_Parse)); + nestedPtr = (Tcl_Parse *)TclStackAlloc(parsePtr->interp, sizeof(Tcl_Parse)); while (1) { const char *curEnd; @@ -1519,7 +1519,7 @@ Tcl_ParseVar( { register Tcl_Obj *objPtr; int code; - Tcl_Parse *parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse)); + Tcl_Parse *parsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse)); if (Tcl_ParseVarName(interp, start, -1, parsePtr, 0) != TCL_OK) { TclStackFree(interp, parsePtr); @@ -2000,7 +2000,7 @@ TclSubstParse( Tcl_Token *tokenPtr; const char *lastTerm = parsePtr->term; - Tcl_Parse *nestedPtr = + Tcl_Parse *nestedPtr = (Tcl_Parse *) TclStackAlloc(interp, sizeof(Tcl_Parse)); while (TCL_OK == diff --git a/generic/tclProc.c b/generic/tclProc.c index afa00ee..8235902 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -232,7 +232,7 @@ Tcl_ProcObjCmd( */ if (iPtr->cmdFramePtr) { - CmdFrame *contextPtr = TclStackAlloc(interp, sizeof(CmdFrame)); + CmdFrame *contextPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame)); *contextPtr = *iPtr->cmdFramePtr; if (contextPtr->type == TCL_LOCATION_BC) { @@ -1048,8 +1048,8 @@ ProcWrongNumArgs( */ numArgs = framePtr->procPtr->numArgs; - desiredObjs = TclStackAlloc(interp, - (int) sizeof(Tcl_Obj *) * (numArgs+1)); + desiredObjs = (Tcl_Obj **)TclStackAlloc(interp, + sizeof(Tcl_Obj *) * (numArgs+1)); if (framePtr->isProcCallFrame & FRAME_IS_LAMBDA) { desiredObjs[0] = Tcl_NewStringObj("lambdaExpr", -1); @@ -1400,7 +1400,7 @@ InitArgsAndLocals( * parameters. */ - varPtr = TclStackAlloc(interp, (int)(localCt * sizeof(Var))); + varPtr = (Var *)TclStackAlloc(interp, localCt * sizeof(Var)); framePtr->compiledLocals = varPtr; framePtr->numCompiledLocals = localCt; @@ -2475,7 +2475,7 @@ SetLambdaFromAny( */ if (iPtr->cmdFramePtr) { - CmdFrame *contextPtr = TclStackAlloc(interp, sizeof(CmdFrame)); + CmdFrame *contextPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame)); *contextPtr = *iPtr->cmdFramePtr; if (contextPtr->type == TCL_LOCATION_BC) { @@ -2663,7 +2663,7 @@ TclNRApplyObjCmd( return TCL_ERROR; } - extraPtr = TclStackAlloc(interp, sizeof(ApplyExtraData)); + extraPtr = (ApplyExtraData *)TclStackAlloc(interp, sizeof(ApplyExtraData)); memset(&extraPtr->cmd, 0, sizeof(Command)); procPtr->cmdPtr = &extraPtr->cmd; extraPtr->cmd.nsPtr = (Namespace *) nsPtr; diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index d3f7428..533a73d 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -122,7 +122,7 @@ const Tcl_ObjType tclRegexpType = { do { \ const Tcl_ObjIntRep *irPtr; \ irPtr = TclFetchIntRep((objPtr), &tclRegexpType); \ - (rePtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ + (rePtr) = irPtr ? (TclRegexp *)irPtr->twoPtrValue.ptr1 : NULL; \ } while (0) @@ -916,7 +916,7 @@ CompileRegexp( * This is a new expression, so compile it and add it to the cache. */ - regexpPtr = ckalloc(sizeof(TclRegexp)); + regexpPtr = (TclRegexp*)ckalloc(sizeof(TclRegexp)); regexpPtr->objPtr = NULL; regexpPtr->string = NULL; regexpPtr->details.rm_extend.rm_so = -1; @@ -971,7 +971,7 @@ CompileRegexp( */ regexpPtr->matches = - ckalloc(sizeof(regmatch_t) * (regexpPtr->re.re_nsub + 1)); + (regmatch_t*)ckalloc(sizeof(regmatch_t) * (regexpPtr->re.re_nsub + 1)); /* * Initialize the refcount to one initially, since it is in the cache. @@ -997,7 +997,7 @@ CompileRegexp( tsdPtr->patLengths[i+1] = tsdPtr->patLengths[i]; tsdPtr->regexps[i+1] = tsdPtr->regexps[i]; } - tsdPtr->patterns[0] = ckalloc(length + 1); + tsdPtr->patterns[0] = (char *)ckalloc(length + 1); memcpy(tsdPtr->patterns[0], string, length + 1); tsdPtr->patLengths[0] = length; tsdPtr->regexps[0] = regexpPtr; diff --git a/generic/tclScan.c b/generic/tclScan.c index 74ec2da..2986860 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -260,7 +260,7 @@ ValidateFormat( char *end; Tcl_UniChar ch = 0; int objIndex, xpgSize, nspace = numVars; - int *nassign = TclStackAlloc(interp, nspace * sizeof(int)); + int *nassign = (int *)TclStackAlloc(interp, nspace * sizeof(int)); char buf[TCL_UTF_MAX + 1] = ""; Tcl_Obj *errorMsg; /* Place to build an error messages. Note that * these are messy operations because we do diff --git a/generic/tclTest.c b/generic/tclTest.c index 4eb8519..166334a 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -41,7 +41,6 @@ /* * Declare external functions used in Windows tests. */ - DLLEXPORT int Tcltest_Init(Tcl_Interp *interp); DLLEXPORT int Tcltest_SafeInit(Tcl_Interp *interp); @@ -228,7 +227,7 @@ static int TestasyncCmd(void *dummy, static int TestbytestringObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestpurebytesobjObjCmd(ClientData clientData, +static int TestpurebytesobjObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int TeststringbytesObjCmd(void *clientData, @@ -851,8 +850,8 @@ TestasyncCmd( if (argc != 3) { goto wrongNumArgs; } - asyncPtr = ckalloc(sizeof(TestAsyncHandler)); - asyncPtr->command = ckalloc(strlen(argv[2]) + 1); + asyncPtr = (TestAsyncHandler *)ckalloc(sizeof(TestAsyncHandler)); + asyncPtr->command = (char *)ckalloc(strlen(argv[2]) + 1); strcpy(asyncPtr->command, argv[2]); Tcl_MutexLock(&asyncTestMutex); asyncPtr->id = nextId; @@ -1625,9 +1624,9 @@ TestdelCmd( return TCL_ERROR; } - dPtr = ckalloc(sizeof(DelCmd)); + dPtr = (DelCmd*)ckalloc(sizeof(DelCmd)); dPtr->interp = interp; - dPtr->deleteCmd = ckalloc(strlen(argv[3]) + 1); + dPtr->deleteCmd = (char *)ckalloc(strlen(argv[3]) + 1); strcpy(dPtr->deleteCmd, argv[3]); Tcl_CreateCommand(slave, argv[2], DelCmdProc, dPtr, @@ -1654,7 +1653,7 @@ static void DelDeleteProc( void *clientData) /* String command to evaluate. */ { - DelCmd *dPtr = clientData; + DelCmd *dPtr = (DelCmd *) clientData; Tcl_EvalEx(dPtr->interp, dPtr->deleteCmd, -1, 0); Tcl_ResetResult(dPtr->interp); @@ -1859,7 +1858,7 @@ TestdstringCmd( } else if (strcmp(argv[2], "staticlarge") == 0) { Tcl_AppendResult(interp, "first0 first1 first2 first3 first4 first5 first6 first7 first8 first9\nsecond0 second1 second2 second3 second4 second5 second6 second7 second8 second9\nthird0 third1 third2 third3 third4 third5 third6 third7 third8 third9\nfourth0 fourth1 fourth2 fourth3 fourth4 fourth5 fourth6 fourth7 fourth8 fourth9\nfifth0 fifth1 fifth2 fifth3 fifth4 fifth5 fifth6 fifth7 fifth8 fifth9\nsixth0 sixth1 sixth2 sixth3 sixth4 sixth5 sixth6 sixth7 sixth8 sixth9\nseventh0 seventh1 seventh2 seventh3 seventh4 seventh5 seventh6 seventh7 seventh8 seventh9\n", NULL); } else if (strcmp(argv[2], "free") == 0) { - char *s = ckalloc(100); + char *s = (char *)ckalloc(100); strcpy(s, "This is a malloc-ed string"); Tcl_SetResult(interp, s, TCL_DYNAMIC); } else if (strcmp(argv[2], "special") == 0) { @@ -1911,9 +1910,9 @@ TestdstringCmd( * Tcl_DStringGetResult handles freeProc's other than free. */ -static void SpecialFree(blockPtr) - char *blockPtr; /* Block to free. */ -{ +static void SpecialFree( + char *blockPtr /* Block to free. */ +) { ckfree(blockPtr - 16); } @@ -1965,15 +1964,15 @@ TestencodingObjCmd( if (objc != 5) { return TCL_ERROR; } - encodingPtr = ckalloc(sizeof(TclEncoding)); + encodingPtr = (TclEncoding*)ckalloc(sizeof(TclEncoding)); encodingPtr->interp = interp; string = Tcl_GetStringFromObj(objv[3], &length); - encodingPtr->toUtfCmd = ckalloc(length + 1); + encodingPtr->toUtfCmd = (char *)ckalloc(length + 1); memcpy(encodingPtr->toUtfCmd, string, length + 1); string = Tcl_GetStringFromObj(objv[4], &length); - encodingPtr->fromUtfCmd = ckalloc(length + 1); + encodingPtr->fromUtfCmd = (char *)ckalloc(length + 1); memcpy(encodingPtr->fromUtfCmd, string, length + 1); string = Tcl_GetStringFromObj(objv[2], &length); @@ -2071,7 +2070,7 @@ static void EncodingFreeProc( void *clientData) /* ClientData associated with type. */ { - TclEncoding *encodingPtr = clientData; + TclEncoding *encodingPtr = (TclEncoding *)clientData; ckfree(encodingPtr->toUtfCmd); ckfree(encodingPtr->fromUtfCmd); @@ -2230,7 +2229,7 @@ TesteventObjCmd( "position specifier", TCL_EXACT, &posIndex) != TCL_OK) { return TCL_ERROR; } - ev = ckalloc(sizeof(TestEvent)); + ev = (TestEvent *)ckalloc(sizeof(TestEvent)); ev->header.proc = TesteventProc; ev->header.nextPtr = NULL; ev->interp = interp; @@ -3088,7 +3087,7 @@ TestlinkCmd( if (strcmp(argv[5], "-") == 0) { stringVar = NULL; } else { - stringVar = ckalloc(strlen(argv[5]) + 1); + stringVar = (char *)ckalloc(strlen(argv[5]) + 1); strcpy(stringVar, argv[5]); } } @@ -3195,7 +3194,7 @@ TestlinkCmd( if (strcmp(argv[5], "-") == 0) { stringVar = NULL; } else { - stringVar = ckalloc(strlen(argv[5]) + 1); + stringVar = (char *)ckalloc(strlen(argv[5]) + 1); strcpy(stringVar, argv[5]); } Tcl_UpdateLinkedVar(interp, "string"); @@ -3304,7 +3303,7 @@ TestlinkCmd( static int TestlinkarrayCmd( - ClientData dummy, /* Not used. */ + void *dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -4253,7 +4252,7 @@ TestsetassocdataCmd( return TCL_ERROR; } - buf = ckalloc(strlen(argv[2]) + 1); + buf = (char *)ckalloc(strlen(argv[2]) + 1); strcpy(buf, argv[2]); /* @@ -4833,7 +4832,7 @@ GetTimesObjCmd( fprintf(stderr, "alloc & free 100000 6 word items\n"); Tcl_GetTime(&start); for (i = 0; i < 100000; i++) { - objPtr = ckalloc(sizeof(Tcl_Obj)); + objPtr = (Tcl_Obj *)ckalloc(sizeof(Tcl_Obj)); ckfree(objPtr); } Tcl_GetTime(&stop); @@ -4842,10 +4841,10 @@ GetTimesObjCmd( /* alloc 5000 times */ fprintf(stderr, "alloc 5000 6 word items\n"); - objv = ckalloc(5000 * sizeof(Tcl_Obj *)); + objv = (Tcl_Obj **)ckalloc(5000 * sizeof(Tcl_Obj *)); Tcl_GetTime(&start); for (i = 0; i < 5000; i++) { - objv[i] = ckalloc(sizeof(Tcl_Obj)); + objv[i] = (Tcl_Obj *)ckalloc(sizeof(Tcl_Obj)); } Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); @@ -5087,7 +5086,7 @@ TeststringbytesObjCmd( static int TestpurebytesobjObjCmd( - ClientData unused, /* Not used. */ + void *unused, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -5107,7 +5106,7 @@ TestpurebytesobjObjCmd( if (objc == 2) { const char *s = Tcl_GetString(objv[1]); objPtr->length = objv[1]->length; - objPtr->bytes = ckalloc(objPtr->length + 1); + objPtr->bytes = (char *)ckalloc(objPtr->length + 1); memcpy(objPtr->bytes, s, objPtr->length); objPtr->bytes[objPtr->length] = 0; } @@ -5300,7 +5299,7 @@ TestsaveresultCmd( Tcl_AppendResult(interp, "append result", NULL); break; case RESULT_FREE: { - char *buf = ckalloc(200); + char *buf = (char *)ckalloc(200); strcpy(buf, "free result"); Tcl_SetResult(interp, buf, TCL_DYNAMIC); @@ -5622,7 +5621,7 @@ TestChannelCmd( /* Remember the channel in the pool of detached channels */ - det = ckalloc(sizeof(TestChannel)); + det = (TestChannel *)ckalloc(sizeof(TestChannel)); det->chan = chan; det->nextPtr = firstDetached; firstDetached = det; @@ -5814,7 +5813,7 @@ TestChannelCmd( for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch); hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) { - Tcl_AppendElement(interp, Tcl_GetHashKey(hTblPtr, hPtr)); + Tcl_AppendElement(interp, (char *)Tcl_GetHashKey(hTblPtr, hPtr)); } return TCL_OK; } @@ -5855,7 +5854,7 @@ TestChannelCmd( chanPtr = (Channel *) Tcl_GetHashValue(hPtr); statePtr = chanPtr->state; if (statePtr->flags & TCL_READABLE) { - Tcl_AppendElement(interp, Tcl_GetHashKey(hTblPtr, hPtr)); + Tcl_AppendElement(interp, (char *)Tcl_GetHashKey(hTblPtr, hPtr)); } } return TCL_OK; @@ -5912,7 +5911,7 @@ TestChannelCmd( chanPtr = (Channel *) Tcl_GetHashValue(hPtr); statePtr = chanPtr->state; if (statePtr->flags & TCL_WRITABLE) { - Tcl_AppendElement(interp, Tcl_GetHashKey(hTblPtr, hPtr)); + Tcl_AppendElement(interp, (char *)Tcl_GetHashKey(hTblPtr, hPtr)); } } return TCL_OK; @@ -6020,7 +6019,7 @@ TestChannelEventCmd( return TCL_ERROR; } - esPtr = ckalloc(sizeof(EventScriptRecord)); + esPtr = (EventScriptRecord *)ckalloc(sizeof(EventScriptRecord)); esPtr->nextPtr = statePtr->scriptRecordPtr; statePtr->scriptRecordPtr = esPtr; @@ -6446,7 +6445,7 @@ TestReportFreeInternalRep( } } -static ClientData +static void * TestReportDupInternalRep( void *clientData) { @@ -7766,7 +7765,7 @@ InterpCompiledVarResolver( Tcl_ResolvedVarInfo **rPtr) { if (*name == 'T') { - MyResolvedVarInfo *resVarInfo = ckalloc(sizeof(MyResolvedVarInfo)); + MyResolvedVarInfo *resVarInfo = (MyResolvedVarInfo *)ckalloc(sizeof(MyResolvedVarInfo)); resVarInfo->vInfo.fetchProc = MyCompiledVarFetch; resVarInfo->vInfo.deleteProc = MyCompiledVarFree; diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index c9e4a6f..b427c9e 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -30,28 +30,28 @@ static int CheckIfVarUnset(Tcl_Interp *interp, Tcl_Obj **varPtr, int varIndex); static int GetVariableIndex(Tcl_Interp *interp, const char *string, int *indexPtr); static void SetVarToObj(Tcl_Obj **varPtr, int varIndex, Tcl_Obj *objPtr); -static int TestbignumobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TestbignumobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestbooleanobjCmd(ClientData dummy, +static int TestbooleanobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestdoubleobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TestdoubleobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestindexobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TestindexobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestintobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TestintobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestlistobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TestlistobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TestobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TeststringobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TeststringobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); #define VARPTR_KEY "TCLOBJTEST_VARPTR" #define NUMBER_OF_OBJECT_VARS 20 -static void VarPtrDeleteProc(ClientData clientData, Tcl_Interp *interp) +static void VarPtrDeleteProc(void *clientData, Tcl_Interp *interp) { register int i; Tcl_Obj **varPtr = (Tcl_Obj **) clientData; @@ -146,7 +146,7 @@ TclObjTest_Init( static int TestbignumobjCmd( - ClientData clientData, /* unused */ + void *clientData, /* unused */ Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Argument count */ Tcl_Obj *const objv[]) /* Argument vector */ @@ -345,7 +345,7 @@ TestbignumobjCmd( static int TestbooleanobjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -445,7 +445,7 @@ TestbooleanobjCmd( static int TestdoubleobjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -563,7 +563,7 @@ TestdoubleobjCmd( static int TestindexobjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -594,7 +594,7 @@ TestindexobjCmd( } Tcl_GetIndexFromObj(NULL, objv[1], tablePtr, "token", 0, &index); - indexRep = objv[1]->internalRep.twoPtrValue.ptr1; + indexRep = (struct IndexRep *)objv[1]->internalRep.twoPtrValue.ptr1; indexRep->index = index2; result = Tcl_GetIndexFromObj(NULL, objv[1], tablePtr, "token", 0, &index); @@ -616,7 +616,7 @@ TestindexobjCmd( return TCL_ERROR; } - argv = ckalloc((objc-3) * sizeof(char *)); + argv = (const char **)ckalloc((objc-3) * sizeof(char *)); for (i = 4; i < objc; i++) { argv[i-4] = Tcl_GetString(objv[i]); } @@ -652,7 +652,7 @@ TestindexobjCmd( static int TestintobjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -856,7 +856,7 @@ TestintobjCmd( static int TestlistobjCmd( - ClientData clientData, /* Not used */ + void *clientData, /* Not used */ Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ @@ -953,7 +953,7 @@ TestlistobjCmd( static int TestobjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1165,7 +1165,7 @@ TestobjCmd( static int TeststringobjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1283,7 +1283,7 @@ TeststringobjCmd( if (varPtr[varIndex] != NULL) { Tcl_ConvertToType(NULL, varPtr[varIndex], Tcl_GetObjType("string")); - strPtr = varPtr[varIndex]->internalRep.twoPtrValue.ptr1; + strPtr = (String *)varPtr[varIndex]->internalRep.twoPtrValue.ptr1; length = (int) strPtr->allocated; } else { length = -1; @@ -1337,7 +1337,7 @@ TeststringobjCmd( if (varPtr[varIndex] != NULL) { Tcl_ConvertToType(NULL, varPtr[varIndex], Tcl_GetObjType("string")); - strPtr = varPtr[varIndex]->internalRep.twoPtrValue.ptr1; + strPtr = (String *)varPtr[varIndex]->internalRep.twoPtrValue.ptr1; length = strPtr->maxChars; } else { length = -1; diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c index 913b253..59379de 100644 --- a/generic/tclTestProcBodyObj.c +++ b/generic/tclTestProcBodyObj.c @@ -45,13 +45,13 @@ typedef struct CmdTable { * Declarations for functions defined in this file. */ -static int ProcBodyTestProcObjCmd(ClientData dummy, +static int ProcBodyTestProcObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ProcBodyTestCheckObjCmd(ClientData dummy, +static int ProcBodyTestCheckObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int ProcBodyTestInitInternal(Tcl_Interp *interp, int isSafe); static int RegisterCommand(Tcl_Interp* interp, - const char *namespace, const CmdTable *cmdTablePtr); + const char *namesp, const CmdTable *cmdTablePtr); /* * List of commands to create when the package is loaded; must go after the @@ -139,7 +139,7 @@ static int RegisterCommand( Tcl_Interp* interp, /* the Tcl interpreter for which the operation * is performed */ - const char *namespace, /* the namespace in which the command is + const char *namesp, /* the namespace in which the command is * registered */ const CmdTable *cmdTablePtr)/* the command to register */ { @@ -147,13 +147,13 @@ RegisterCommand( if (cmdTablePtr->exportIt) { sprintf(buf, "namespace eval %s { namespace export %s }", - namespace, cmdTablePtr->cmdName); + namesp, cmdTablePtr->cmdName); if (Tcl_EvalEx(interp, buf, -1, 0) != TCL_OK) { return TCL_ERROR; } } - sprintf(buf, "%s::%s", namespace, cmdTablePtr->cmdName); + sprintf(buf, "%s::%s", namesp, cmdTablePtr->cmdName); Tcl_CreateObjCommand(interp, buf, cmdTablePtr->proc, 0, 0); return TCL_OK; } @@ -228,7 +228,7 @@ ProcBodyTestInitInternal( static int ProcBodyTestProcObjCmd( - ClientData dummy, /* context; not used */ + void *dummy, /* context; not used */ Tcl_Interp *interp, /* the current interpreter */ int objc, /* argument count */ Tcl_Obj *const objv[]) /* arguments */ @@ -327,7 +327,7 @@ ProcBodyTestProcObjCmd( static int ProcBodyTestCheckObjCmd( - ClientData dummy, /* context; not used */ + void *dummy, /* context; not used */ Tcl_Interp *interp, /* the current interpreter */ int objc, /* argument count */ Tcl_Obj *const objv[]) /* arguments */ diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index 3f1abc2..5849672 100644 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -162,7 +162,7 @@ static __thread Cache *tcachePtr; #else # define GETCACHE(cachePtr) \ do { \ - (cachePtr) = TclpGetAllocCache(); \ + (cachePtr) = (Cache*)TclpGetAllocCache(); \ if ((cachePtr) == NULL) { \ (cachePtr) = GetCache(); \ } \ @@ -209,9 +209,9 @@ GetCache(void) * Get this thread's cache, allocating if necessary. */ - cachePtr = TclpGetAllocCache(); + cachePtr = (Cache*)TclpGetAllocCache(); if (cachePtr == NULL) { - cachePtr = TclpSysAlloc(sizeof(Cache), 0); + cachePtr = (Cache*)TclpSysAlloc(sizeof(Cache), 0); if (cachePtr == NULL) { Tcl_Panic("alloc: could not allocate new cache"); } @@ -246,7 +246,7 @@ void TclFreeAllocCache( void *arg) { - Cache *cachePtr = arg; + Cache *cachePtr = (Cache*)arg; Cache **nextPtrPtr; register unsigned int bucket; @@ -337,7 +337,7 @@ TclpAlloc( #endif if (size > MAXALLOC) { bucket = NBUCKETS; - blockPtr = TclpSysAlloc(size, 0); + blockPtr = (Block *)TclpSysAlloc(size, 0); if (blockPtr != NULL) { cachePtr->totalAssigned += reqSize; } @@ -491,7 +491,7 @@ TclpRealloc( } else if (size > MAXALLOC) { cachePtr->totalAssigned -= blockPtr->blockReqSize; cachePtr->totalAssigned += reqSize; - blockPtr = TclpSysRealloc(blockPtr, size); + blockPtr = (Block*)TclpSysRealloc(blockPtr, size); if (blockPtr == NULL) { return NULL; } @@ -510,7 +510,7 @@ TclpRealloc( memcpy(newPtr, ptr, reqSize); TclpFree(ptr); } - return newPtr; + return (char *)newPtr; } /* @@ -563,7 +563,7 @@ TclThreadAllocObj(void) Tcl_Obj *newObjsPtr; cachePtr->numObjects = numMove = NOBJALLOC; - newObjsPtr = TclpSysAlloc(sizeof(Tcl_Obj) * numMove, 0); + newObjsPtr = (Tcl_Obj *)TclpSysAlloc(sizeof(Tcl_Obj) * numMove, 0); if (newObjsPtr == NULL) { Tcl_Panic("alloc: could not allocate %d new objects", numMove); } @@ -582,7 +582,7 @@ TclThreadAllocObj(void) */ objPtr = cachePtr->firstObjPtr; - cachePtr->firstObjPtr = objPtr->internalRep.twoPtrValue.ptr1; + cachePtr->firstObjPtr = (Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr1; cachePtr->numObjects--; return objPtr; } @@ -721,9 +721,9 @@ MoveObjs( */ while (--numMove) { - objPtr = objPtr->internalRep.twoPtrValue.ptr1; + objPtr = (Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr1; } - fromPtr->firstObjPtr = objPtr->internalRep.twoPtrValue.ptr1; + fromPtr->firstObjPtr = (Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr1; /* * Move all objects as a block - they are already linked to each other, we @@ -766,7 +766,7 @@ PutObjs( } else { do { lastPtr = firstPtr; - firstPtr = firstPtr->internalRep.twoPtrValue.ptr1; + firstPtr = (Tcl_Obj *)firstPtr->internalRep.twoPtrValue.ptr1; } while (--keep > 0); lastPtr->internalRep.twoPtrValue.ptr1 = NULL; } @@ -1032,7 +1032,7 @@ GetBlocks( if (blockPtr == NULL) { size = MAXALLOC; - blockPtr = TclpSysAlloc(size, 0); + blockPtr = (Block*)TclpSysAlloc(size, 0); if (blockPtr == NULL) { return 0; } @@ -1147,7 +1147,7 @@ TclFinalizeThreadAlloc(void) void TclFinalizeThreadAllocThread(void) { - Cache *cachePtr = TclpGetAllocCache(); + Cache *cachePtr = (Cache *)TclpGetAllocCache(); if (cachePtr != NULL) { TclpFreeAllocCache(cachePtr); } diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index e9b1107..48aa445 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -119,7 +119,7 @@ static char *errorProcString; TCL_DECLARE_MUTEX(threadMutex) -static int ThreadObjCmd(ClientData clientData, +static int ThreadObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int ThreadCreate(Tcl_Interp *interp, const char *script, @@ -130,15 +130,15 @@ static int ThreadSend(Tcl_Interp *interp, Tcl_ThreadId id, static int ThreadCancel(Tcl_Interp *interp, Tcl_ThreadId id, const char *result, int flags); -static Tcl_ThreadCreateType NewTestThread(ClientData clientData); +static Tcl_ThreadCreateType NewTestThread(void *clientData); static void ListRemove(ThreadSpecificData *tsdPtr); static void ListUpdateInner(ThreadSpecificData *tsdPtr); static int ThreadEventProc(Tcl_Event *evPtr, int mask); static void ThreadErrorProc(Tcl_Interp *interp); -static void ThreadFreeProc(ClientData clientData); +static void ThreadFreeProc(void *clientData); static int ThreadDeleteEvent(Tcl_Event *eventPtr, - ClientData clientData); -static void ThreadExitProc(ClientData clientData); + void *clientData); +static void ThreadExitProc(void *clientData); extern int Tcltest_Init(Tcl_Interp *interp); /* @@ -206,7 +206,7 @@ TclThread_Init( /* ARGSUSED */ static int ThreadObjCmd( - ClientData dummy, /* Not used. */ + void *dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -435,7 +435,7 @@ ThreadObjCmd( ckfree(errorProcString); } proc = Tcl_GetString(objv[2]); - errorProcString = ckalloc(strlen(proc) + 1); + errorProcString = (char *)ckalloc(strlen(proc) + 1); strcpy(errorProcString, proc); Tcl_MutexUnlock(&threadMutex); return TCL_OK; @@ -556,9 +556,9 @@ ThreadCreate( Tcl_ThreadCreateType NewTestThread( - ClientData clientData) + void *clientData) { - ThreadCtrl *ctrlPtr = clientData; + ThreadCtrl *ctrlPtr = (ThreadCtrl *)clientData; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); int result; char *threadEvalScript; @@ -595,7 +595,7 @@ NewTestThread( * eval'ing, for the case that we exit during evaluation */ - threadEvalScript = ckalloc(strlen(ctrlPtr->script) + 1); + threadEvalScript = (char *)ckalloc(strlen(ctrlPtr->script) + 1); strcpy(threadEvalScript, ctrlPtr->script); Tcl_CreateThreadExitHandler(ThreadExitProc, threadEvalScript); @@ -840,13 +840,13 @@ ThreadSend( * Create the event for its event queue. */ - threadEventPtr = ckalloc(sizeof(ThreadEvent)); - threadEventPtr->script = ckalloc(strlen(script) + 1); + threadEventPtr = (ThreadEvent*)ckalloc(sizeof(ThreadEvent)); + threadEventPtr->script = (char *)ckalloc(strlen(script) + 1); strcpy(threadEventPtr->script, script); if (!wait) { resultPtr = threadEventPtr->resultPtr = NULL; } else { - resultPtr = ckalloc(sizeof(ThreadEventResult)); + resultPtr = (ThreadEventResult *)ckalloc(sizeof(ThreadEventResult)); threadEventPtr->resultPtr = resultPtr; /* @@ -1042,14 +1042,14 @@ ThreadEventProc( if (resultPtr) { Tcl_MutexLock(&threadMutex); resultPtr->code = code; - resultPtr->result = ckalloc(strlen(result) + 1); + resultPtr->result = (char *)ckalloc(strlen(result) + 1); strcpy(resultPtr->result, result); if (errorCode != NULL) { - resultPtr->errorCode = ckalloc(strlen(errorCode) + 1); + resultPtr->errorCode = (char *)ckalloc(strlen(errorCode) + 1); strcpy(resultPtr->errorCode, errorCode); } if (errorInfo != NULL) { - resultPtr->errorInfo = ckalloc(strlen(errorInfo) + 1); + resultPtr->errorInfo = (char *)ckalloc(strlen(errorInfo) + 1); strcpy(resultPtr->errorInfo, errorInfo); } Tcl_ConditionNotify(&resultPtr->done); @@ -1073,7 +1073,7 @@ ThreadEventProc( * None. * * Side effects: - * Clears up mem specified in ClientData + * Clears up mem specified in clientData * *------------------------------------------------------------------------ */ @@ -1081,7 +1081,7 @@ ThreadEventProc( /* ARGSUSED */ static void ThreadFreeProc( - ClientData clientData) + void *clientData) { if (clientData) { ckfree(clientData); @@ -1109,7 +1109,7 @@ ThreadFreeProc( static int ThreadDeleteEvent( Tcl_Event *eventPtr, /* Really ThreadEvent */ - ClientData clientData) /* dummy */ + void *clientData) /* dummy */ { if (eventPtr->proc == ThreadEventProc) { ckfree(((ThreadEvent *) eventPtr)->script); @@ -1144,9 +1144,9 @@ ThreadDeleteEvent( /* ARGSUSED */ static void ThreadExitProc( - ClientData clientData) + void *clientData) { - char *threadEvalScript = clientData; + char *threadEvalScript = (char *)clientData; ThreadEventResult *resultPtr, *nextPtr; Tcl_ThreadId self = Tcl_GetCurrentThread(); ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -1199,7 +1199,7 @@ ThreadExitProc( const char *msg = "target thread died"; - resultPtr->result = ckalloc(strlen(msg) + 1); + resultPtr->result = (char *)ckalloc(strlen(msg) + 1); strcpy(resultPtr->result, msg); resultPtr->code = TCL_ERROR; Tcl_ConditionNotify(&resultPtr->done); diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 1a6d459..36983f2 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -1689,7 +1689,7 @@ CallTraceFunction( * Copy the command characters into a new string. */ - commandCopy = TclStackAlloc(interp, numChars + 1); + commandCopy = (char *)TclStackAlloc(interp, numChars + 1); memcpy(commandCopy, command, numChars); commandCopy[numChars] = '\0'; diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 4961ef5..c540c4e 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -238,7 +238,7 @@ PlatformEventsControl( newEvent.events |= EPOLLOUT; } if (isNew) { - newPedPtr = ckalloc(sizeof(*newPedPtr)); + newPedPtr = (struct PlatformEventData *)ckalloc(sizeof(struct PlatformEventData)); newPedPtr->filePtr = filePtr; newPedPtr->tsdPtr = tsdPtr; filePtr->pedPtr = newPedPtr; @@ -370,7 +370,7 @@ PlatformEventsInit(void) if (errno) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create mutex"); } - filePtr = ckalloc(sizeof(*filePtr)); + filePtr = (FileHandler *)ckalloc(sizeof(FileHandler)); #ifdef HAVE_EVENTFD tsdPtr->triggerEventFd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); if (tsdPtr->triggerEventFd <= 0) { @@ -391,7 +391,7 @@ PlatformEventsInit(void) PlatformEventsControl(filePtr, tsdPtr, EPOLL_CTL_ADD, 1); if (!tsdPtr->readyEvents) { tsdPtr->maxReadyEvents = 512; - tsdPtr->readyEvents = ckalloc( + tsdPtr->readyEvents = (struct epoll_event *)ckalloc( tsdPtr->maxReadyEvents * sizeof(tsdPtr->readyEvents[0])); } LIST_INIT(&tsdPtr->firstReadyFileHandlerPtr); @@ -550,7 +550,7 @@ Tcl_CreateFileHandler( } } if (filePtr == NULL) { - filePtr = ckalloc(sizeof(FileHandler)); + filePtr = (FileHandler *)ckalloc(sizeof(FileHandler)); filePtr->fd = fd; filePtr->readyMask = 0; filePtr->nextPtr = tsdPtr->firstFileHandlerPtr; @@ -733,7 +733,7 @@ Tcl_WaitForEvent( */ if (filePtr->readyMask == 0) { - FileHandlerEvent *fileEvPtr = + FileHandlerEvent *fileEvPtr = (FileHandlerEvent *) ckalloc(sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; @@ -810,7 +810,7 @@ Tcl_WaitForEvent( */ if (filePtr->readyMask == 0) { - FileHandlerEvent *fileEvPtr = + FileHandlerEvent *fileEvPtr = (FileHandlerEvent *) ckalloc(sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; diff --git a/unix/tclKqueueNotfy.c b/unix/tclKqueueNotfy.c index 99d794e..e2ff4f4 100644 --- a/unix/tclKqueueNotfy.c +++ b/unix/tclKqueueNotfy.c @@ -222,7 +222,7 @@ PlatformEventsControl( struct stat fdStat; if (isNew) { - newPedPtr = ckalloc(sizeof(*newPedPtr)); + newPedPtr = (struct PlatformEventData *)ckalloc(sizeof(struct PlatformEventData)); newPedPtr->filePtr = filePtr; newPedPtr->tsdPtr = tsdPtr; filePtr->pedPtr = newPedPtr; @@ -409,13 +409,13 @@ PlatformEventsInit(void) } else if (fcntl(tsdPtr->eventsFd, F_SETFD, FD_CLOEXEC) == -1) { Tcl_Panic("fcntl: %s", strerror(errno)); } - filePtr = ckalloc(sizeof(*filePtr)); + filePtr = (FileHandler *)ckalloc(sizeof(FileHandler)); filePtr->fd = tsdPtr->triggerPipe[0]; filePtr->mask = TCL_READABLE; PlatformEventsControl(filePtr, tsdPtr, EV_ADD, 1); if (!tsdPtr->readyEvents) { tsdPtr->maxReadyEvents = 512; - tsdPtr->readyEvents = ckalloc( + tsdPtr->readyEvents = (struct kevent *)ckalloc( tsdPtr->maxReadyEvents * sizeof(tsdPtr->readyEvents[0])); } LIST_INIT(&tsdPtr->firstReadyFileHandlerPtr); @@ -580,7 +580,7 @@ Tcl_CreateFileHandler( } } if (filePtr == NULL) { - filePtr = ckalloc(sizeof(FileHandler)); + filePtr = (FileHandler *)ckalloc(sizeof(FileHandler)); filePtr->fd = fd; filePtr->readyMask = 0; filePtr->nextPtr = tsdPtr->firstFileHandlerPtr; @@ -768,7 +768,7 @@ Tcl_WaitForEvent( */ if (filePtr->readyMask == 0) { - FileHandlerEvent *fileEvPtr = + FileHandlerEvent *fileEvPtr = (FileHandlerEvent *) ckalloc(sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; @@ -828,7 +828,7 @@ Tcl_WaitForEvent( */ if (filePtr->readyMask == 0) { - FileHandlerEvent *fileEvPtr = + FileHandlerEvent *fileEvPtr = (FileHandlerEvent *) ckalloc(sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index aec071c..6339044 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -131,7 +131,7 @@ TclpDlopen( } return TCL_ERROR; } - newHandle = ckalloc(sizeof(*newHandle)); + newHandle = (Tcl_LoadHandle)ckalloc(sizeof(*newHandle)); newHandle->clientData = handle; newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c index e998bf9..9ae8d85 100644 --- a/unix/tclLoadDyld.c +++ b/unix/tclLoadDyld.c @@ -258,7 +258,7 @@ TclpDlopen( module = NSLinkModule(dyldObjFileImage, nativePath, nsflags); NSDestroyObjectFileImage(dyldObjFileImage); if (module) { - modulePtr = ckalloc(sizeof(Tcl_DyldModuleHandle)); + modulePtr = (Tcl_DyldModuleHandle *)ckalloc(sizeof(Tcl_DyldModuleHandle)); modulePtr->module = module; modulePtr->nextPtr = NULL; } else { @@ -278,13 +278,13 @@ TclpDlopen( || dyldLibHeader || modulePtr #endif /* TCL_DYLD_USE_NSMODULE */ ) { - dyldLoadHandle = ckalloc(sizeof(Tcl_DyldLoadHandle)); + dyldLoadHandle = (Tcl_DyldModuleHandle *)ckalloc(sizeof(Tcl_DyldLoadHandle)); dyldLoadHandle->dlHandle = dlHandle; #if TCL_DYLD_USE_NSMODULE || defined(TCL_LOAD_FROM_MEMORY) dyldLoadHandle->dyldLibHeader = dyldLibHeader; dyldLoadHandle->modulePtr = modulePtr; #endif /* TCL_DYLD_USE_NSMODULE || TCL_LOAD_FROM_MEMORY */ - newHandle = ckalloc(sizeof(*newHandle)); + newHandle = (Tcl_DyldModuleHandle *)ckalloc(sizeof(*newHandle)); newHandle->clientData = dyldLoadHandle; newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; @@ -381,7 +381,7 @@ FindSymbol( modulePtr = modulePtr->nextPtr; } if (modulePtr == NULL) { - modulePtr = ckalloc(sizeof(Tcl_DyldModuleHandle)); + modulePtr = (Tcl_DyldModuleHandle *)ckalloc(sizeof(Tcl_DyldModuleHandle)); modulePtr->module = module; modulePtr->nextPtr = dyldLoadHandle->modulePtr; dyldLoadHandle->modulePtr = modulePtr; @@ -693,14 +693,14 @@ TclpLoadMemory( * Stash the module reference within the load handle we create and return. */ - modulePtr = ckalloc(sizeof(Tcl_DyldModuleHandle)); + modulePtr = (Tcl_DyldModuleHandle *)ckalloc(sizeof(Tcl_DyldModuleHandle)); modulePtr->module = module; modulePtr->nextPtr = NULL; - dyldLoadHandle = ckalloc(sizeof(Tcl_DyldLoadHandle)); + dyldLoadHandle = (Tcl_DyldModuleHandle *)ckalloc(sizeof(Tcl_DyldLoadHandle)); dyldLoadHandle->dlHandle = NULL; dyldLoadHandle->dyldLibHeader = NULL; dyldLoadHandle->modulePtr = modulePtr; - newHandle = ckalloc(sizeof(*newHandle)); + newHandle = (Tcl_LoadHandle)ckalloc(sizeof(*newHandle)); newHandle->clientData = dyldLoadHandle; newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; diff --git a/unix/tclLoadNext.c b/unix/tclLoadNext.c index eb0affa..8c62784 100644 --- a/unix/tclLoadNext.c +++ b/unix/tclLoadNext.c @@ -101,7 +101,7 @@ TclpDlopen( } NXCloseMemory(errorStream, NX_FREEBUFFER); - newHandle = ckalloc(sizeof(Tcl_LoadHandle)); + newHandle = (Tcl_LoadHandle) ckalloc(sizeof(*newHandle)); newHandle->clientData = INT2PTR(1); newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; diff --git a/unix/tclLoadOSF.c b/unix/tclLoadOSF.c index 377ed28..bbcaa66 100644 --- a/unix/tclLoadOSF.c +++ b/unix/tclLoadOSF.c @@ -128,7 +128,7 @@ TclpDlopen( } else { pkg++; } - newHandle = ckalloc(sizeof(*newHandle)); + newHandle = (Tcl_LoadHandle)ckalloc(sizeof(*newHandle)); newHandle->clientData = pkg; newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; diff --git a/unix/tclLoadShl.c b/unix/tclLoadShl.c index 4be3d7b..a92ddf5 100644 --- a/unix/tclLoadShl.c +++ b/unix/tclLoadShl.c @@ -97,7 +97,7 @@ TclpDlopen( fileName, Tcl_PosixError(interp))); return TCL_ERROR; } - newHandle = ckalloc(sizeof(*newHandle)); + newHandle = (Tcl_LoadHandle)ckalloc(sizeof(*newHandle)); newHandle->clientData = handle; newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = *unloadProcPtr = &UnloadFile; diff --git a/unix/tclSelectNotfy.c b/unix/tclSelectNotfy.c index a0dea57..38d6afd 100644 --- a/unix/tclSelectNotfy.c +++ b/unix/tclSelectNotfy.c @@ -464,7 +464,7 @@ Tcl_CreateFileHandler( } } if (filePtr == NULL) { - filePtr = ckalloc(sizeof(FileHandler)); + filePtr = (FileHandler *)ckalloc(sizeof(FileHandler)); filePtr->fd = fd; filePtr->readyMask = 0; filePtr->nextPtr = tsdPtr->firstFileHandlerPtr; diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index be49c95..2c12bac 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -119,27 +119,27 @@ typedef struct { * Static routines for this file: */ -static int FileBlockModeProc(ClientData instanceData, int mode); -static int FileCloseProc(ClientData instanceData, +static int FileBlockModeProc(void *instanceData, int mode); +static int FileCloseProc(void *instanceData, Tcl_Interp *interp); -static int FileGetHandleProc(ClientData instanceData, - int direction, ClientData *handlePtr); -static int FileInputProc(ClientData instanceData, char *buf, +static int FileGetHandleProc(void *instanceData, + int direction, void **handlePtr); +static int FileInputProc(void *instanceData, char *buf, int toRead, int *errorCode); -static int FileOutputProc(ClientData instanceData, +static int FileOutputProc(void *instanceData, const char *buf, int toWrite, int *errorCode); -static int FileSeekProc(ClientData instanceData, long offset, +static int FileSeekProc(void *instanceData, long offset, int mode, int *errorCode); -static int FileTruncateProc(ClientData instanceData, +static int FileTruncateProc(void *instanceData, Tcl_WideInt length); -static Tcl_WideInt FileWideSeekProc(ClientData instanceData, +static Tcl_WideInt FileWideSeekProc(void *instanceData, Tcl_WideInt offset, int mode, int *errorCode); -static void FileWatchProc(ClientData instanceData, int mask); +static void FileWatchProc(void *instanceData, int mask); #ifdef SUPPORTS_TTY -static int TtyCloseProc(ClientData instanceData, +static int TtyCloseProc(void *instanceData, Tcl_Interp *interp); static void TtyGetAttributes(int fd, TtyAttrs *ttyPtr); -static int TtyGetOptionProc(ClientData instanceData, +static int TtyGetOptionProc(void *instanceData, Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr); static int TtyGetBaud(speed_t speed); @@ -149,7 +149,7 @@ static void TtyModemStatusStr(int status, Tcl_DString *dsPtr); static int TtyParseMode(Tcl_Interp *interp, const char *mode, TtyAttrs *ttyPtr); static void TtySetAttributes(int fd, TtyAttrs *ttyPtr); -static int TtySetOptionProc(ClientData instanceData, +static int TtySetOptionProc(void *instanceData, Tcl_Interp *interp, const char *optionName, const char *value); #endif /* SUPPORTS_TTY */ @@ -225,11 +225,11 @@ static const Tcl_ChannelType ttyChannelType = { /* ARGSUSED */ static int FileBlockModeProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ int mode) /* The mode to set. Can be TCL_MODE_BLOCKING * or TCL_MODE_NONBLOCKING. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; if (TclUnixSetBlockingMode(fsPtr->fd, mode) < 0) { return errno; @@ -258,13 +258,13 @@ FileBlockModeProc( static int FileInputProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ char *buf, /* Where to store data read. */ int toRead, /* How much space is available in the * buffer? */ int *errorCodePtr) /* Where to store error code. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; int bytesRead; /* How many bytes were actually read from the * input device? */ @@ -305,12 +305,12 @@ FileInputProc( static int FileOutputProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; int written; *errorCodePtr = 0; @@ -352,10 +352,10 @@ FileOutputProc( static int FileCloseProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ Tcl_Interp *interp) /* For error reporting - unused. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; int errorCode = 0; Tcl_DeleteFileHandler(fsPtr->fd); @@ -377,10 +377,10 @@ FileCloseProc( #ifdef SUPPORTS_TTY static int TtyCloseProc( - ClientData instanceData, + void *instanceData, Tcl_Interp *interp) { - TtyState *ttyPtr = instanceData; + TtyState *ttyPtr = (TtyState*)instanceData; /* * If we've been asked by the user to drain or flush, do so now. @@ -435,13 +435,13 @@ TtyCloseProc( static int FileSeekProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ long offset, /* Offset to seek to. */ int mode, /* Relative to where should we seek? Can be * one of SEEK_START, SEEK_SET or SEEK_END. */ int *errorCodePtr) /* To store error code. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; Tcl_WideInt oldLoc, newLoc; /* @@ -496,13 +496,13 @@ FileSeekProc( static Tcl_WideInt FileWideSeekProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ Tcl_WideInt offset, /* Offset to seek to. */ int mode, /* Relative to where should we seek? Can be * one of SEEK_START, SEEK_CUR or SEEK_END. */ int *errorCodePtr) /* To store error code. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; Tcl_WideInt newLoc; newLoc = TclOSseek(fsPtr->fd, (Tcl_SeekOffset) offset, mode); @@ -530,12 +530,12 @@ FileWideSeekProc( static void FileWatchProc( - ClientData instanceData, /* The file state. */ + void *instanceData, /* The file state. */ int mask) /* Events of interest; an OR-ed combination of * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; /* * Make sure we only register for events that are valid on this file. Note @@ -572,11 +572,11 @@ FileWatchProc( static int FileGetHandleProc( - ClientData instanceData, /* The file state. */ + void *instanceData, /* The file state. */ int direction, /* TCL_READABLE or TCL_WRITABLE */ - ClientData *handlePtr) /* Where to store the handle. */ + void **handlePtr) /* Where to store the handle. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; if (direction & fsPtr->validMask) { *handlePtr = INT2PTR(fsPtr->fd); @@ -639,12 +639,12 @@ TtyModemStatusStr( static int TtySetOptionProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ const char *optionName, /* Which option to set? */ const char *value) /* New value for option. */ { - TtyState *fsPtr = instanceData; + TtyState *fsPtr = (TtyState *)instanceData; unsigned int len, vlen; TtyAttrs tty; int argc; @@ -978,12 +978,12 @@ TtySetOptionProc( static int TtyGetOptionProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ const char *optionName, /* Option to get. */ Tcl_DString *dsPtr) /* Where to store value(s). */ { - TtyState *fsPtr = instanceData; + TtyState *fsPtr = (TtyState *)instanceData; unsigned int len; char buf[3*TCL_INTEGER_SPACE + 16]; int valid = 0; /* Flag if valid option parsed. */ @@ -1652,7 +1652,7 @@ TclpOpenFileChannel( return NULL; } - native = Tcl_FSGetNativePath(pathPtr); + native = (const char *)Tcl_FSGetNativePath(pathPtr); if (native == NULL) { if (interp != (Tcl_Interp *) NULL) { Tcl_AppendResult(interp, "couldn't open \"", @@ -1712,7 +1712,7 @@ TclpOpenFileChannel( sprintf(channelName, "file%d", fd); } - fsPtr = ckalloc(sizeof(TtyState)); + fsPtr = (TtyState *)ckalloc(sizeof(TtyState)); fsPtr->fileState.validMask = channelPermissions | TCL_EXCEPTION; fsPtr->fileState.fd = fd; #ifdef SUPPORTS_TTY @@ -1763,7 +1763,7 @@ TclpOpenFileChannel( Tcl_Channel Tcl_MakeFileChannel( - ClientData handle, /* OS level handle. */ + void *handle, /* OS level handle. */ int mode) /* ORed combination of TCL_READABLE and * TCL_WRITABLE to indicate file mode. */ { @@ -1790,13 +1790,13 @@ Tcl_MakeFileChannel( && (sockaddrLen > 0) && (sockaddr.sa_family == AF_INET || sockaddr.sa_family == AF_INET6)) { - return TclpMakeTcpClientChannelMode(INT2PTR(fd), mode); + return (Tcl_Channel)TclpMakeTcpClientChannelMode(INT2PTR(fd), mode); } else { channelTypePtr = &fileChannelType; sprintf(channelName, "file%d", fd); } - fsPtr = ckalloc(sizeof(TtyState)); + fsPtr = (TtyState *)ckalloc(sizeof(TtyState)); fsPtr->fileState.fd = fd; fsPtr->fileState.validMask = mode | TCL_EXCEPTION; fsPtr->fileState.channel = Tcl_CreateChannel(channelTypePtr, channelName, @@ -1932,12 +1932,12 @@ Tcl_GetOpenFile( * "forWriting". Ignored, we always check that * the channel is open for the requested * mode. */ - ClientData *filePtr) /* Store pointer to FILE structure here. */ + void **filePtr) /* Store pointer to FILE structure here. */ { Tcl_Channel chan; int chanMode, fd; const Tcl_ChannelType *chanTypePtr; - ClientData data; + void *data; FILE *f; chan = Tcl_GetChannel(interp, chanID, &chanMode); @@ -2022,10 +2022,10 @@ Tcl_GetOpenFile( static int FileTruncateProc( - ClientData instanceData, + void *instanceData, Tcl_WideInt length) { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; int result; #ifdef HAVE_TYPE_OFF64_T diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index aa25c6b..7da0f45 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -201,7 +201,7 @@ TclpGetPwNam( if (tsdPtr->pbuflen < 1) { tsdPtr->pbuflen = 1024; } - tsdPtr->pbuf = ckalloc(tsdPtr->pbuflen); + tsdPtr->pbuf = (char *)ckalloc(tsdPtr->pbuflen); Tcl_CreateThreadExitHandler(FreePwBuf, NULL); } while (1) { @@ -214,7 +214,7 @@ TclpGetPwNam( return NULL; } tsdPtr->pbuflen *= 2; - tsdPtr->pbuf = ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen); + tsdPtr->pbuf = (char *)ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen); } return (pwPtr != NULL ? &tsdPtr->pwd : NULL); @@ -281,7 +281,7 @@ TclpGetPwUid( if (tsdPtr->pbuflen < 1) { tsdPtr->pbuflen = 1024; } - tsdPtr->pbuf = ckalloc(tsdPtr->pbuflen); + tsdPtr->pbuf = (char *)ckalloc(tsdPtr->pbuflen); Tcl_CreateThreadExitHandler(FreePwBuf, NULL); } while (1) { @@ -294,7 +294,7 @@ TclpGetPwUid( return NULL; } tsdPtr->pbuflen *= 2; - tsdPtr->pbuf = ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen); + tsdPtr->pbuf = (char *)ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen); } return (pwPtr != NULL ? &tsdPtr->pwd : NULL); @@ -384,7 +384,7 @@ TclpGetGrNam( if (tsdPtr->gbuflen < 1) { tsdPtr->gbuflen = 1024; } - tsdPtr->gbuf = ckalloc(tsdPtr->gbuflen); + tsdPtr->gbuf = (char*)ckalloc(tsdPtr->gbuflen); Tcl_CreateThreadExitHandler(FreeGrBuf, NULL); } while (1) { @@ -397,7 +397,7 @@ TclpGetGrNam( return NULL; } tsdPtr->gbuflen *= 2; - tsdPtr->gbuf = ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen); + tsdPtr->gbuf = (char *)ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen); } return (grPtr != NULL ? &tsdPtr->grp : NULL); @@ -464,7 +464,7 @@ TclpGetGrGid( if (tsdPtr->gbuflen < 1) { tsdPtr->gbuflen = 1024; } - tsdPtr->gbuf = ckalloc(tsdPtr->gbuflen); + tsdPtr->gbuf = (char*)ckalloc(tsdPtr->gbuflen); Tcl_CreateThreadExitHandler(FreeGrBuf, NULL); } while (1) { @@ -477,7 +477,7 @@ TclpGetGrGid( return NULL; } tsdPtr->gbuflen *= 2; - tsdPtr->gbuf = ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen); + tsdPtr->gbuf = (char *)ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen); } return (grPtr != NULL ? &tsdPtr->grp : NULL); @@ -887,7 +887,7 @@ CopyArray( int buflen) /* Size of buffer. */ { int i, j, len = 0; - char *p, **new; + char *p, **pp; if (src == NULL) { return 0; @@ -903,7 +903,7 @@ CopyArray( return -1; } - new = (char **) buf; + pp = (char **) buf; p = buf + len; for (j = 0; j < i; j++) { @@ -914,10 +914,10 @@ CopyArray( return -1; } memcpy(p, src[j], sz); - new[j] = p; + pp[j] = p; p = buf + len; } - new[j] = NULL; + pp[j] = NULL; return len; } diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 3e1a5c2..17822f5 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -331,8 +331,8 @@ TclpObjRenameFile( Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr) { - return DoRenameFile(Tcl_FSGetNativePath(srcPathPtr), - Tcl_FSGetNativePath(destPathPtr)); + return DoRenameFile((const char *)Tcl_FSGetNativePath(srcPathPtr), + (const char *)Tcl_FSGetNativePath(destPathPtr)); } static int @@ -447,14 +447,14 @@ TclpObjCopyFile( Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr) { - const char *src = Tcl_FSGetNativePath(srcPathPtr); + const char *src = (const char *)Tcl_FSGetNativePath(srcPathPtr); Tcl_StatBuf srcStatBuf; if (TclOSlstat(src, &srcStatBuf) != 0) { /* INTL: Native. */ return TCL_ERROR; } - return DoCopyFile(src, Tcl_FSGetNativePath(destPathPtr), &srcStatBuf); + return DoCopyFile(src, (const char *)Tcl_FSGetNativePath(destPathPtr), &srcStatBuf); } static int @@ -610,7 +610,7 @@ TclUnixCopyFile( if (blockSize <= 0) { blockSize = DEFAULT_COPY_BLOCK_SIZE; } - buffer = ckalloc(blockSize); + buffer = (char *)ckalloc(blockSize); while (1) { nread = (size_t) read(srcFd, buffer, blockSize); if ((nread == (size_t) -1) || (nread == 0)) { @@ -709,7 +709,7 @@ int TclpObjCreateDirectory( Tcl_Obj *pathPtr) { - return DoCreateDirectory(Tcl_FSGetNativePath(pathPtr)); + return DoCreateDirectory((const char *)Tcl_FSGetNativePath(pathPtr)); } static int @@ -1528,7 +1528,7 @@ SetGroupAttribute( gid = groupPtr->gr_gid; } - native = Tcl_FSGetNativePath(fileName); + native = (const char *)Tcl_FSGetNativePath(fileName); result = chown(native, (uid_t) -1, (gid_t) gid); /* INTL: Native. */ if (result != 0) { @@ -1594,7 +1594,7 @@ SetOwnerAttribute( uid = pwPtr->pw_uid; } - native = Tcl_FSGetNativePath(fileName); + native = (const char *)Tcl_FSGetNativePath(fileName); result = chown(native, (uid_t) uid, (gid_t) -1); /* INTL: Native. */ if (result != 0) { @@ -1688,7 +1688,7 @@ SetPermissionsAttribute( } } - native = Tcl_FSGetNativePath(fileName); + native = (const char *)Tcl_FSGetNativePath(fileName); result = chmod(native, newMode); /* INTL: Native. */ if (result != 0) { if (interp != NULL) { @@ -2173,7 +2173,7 @@ TclUnixOpenTemporaryFile( Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj) { - Tcl_DString template, tmp; + Tcl_DString templ, tmp; const char *string; int fd; @@ -2183,46 +2183,46 @@ TclUnixOpenTemporaryFile( if (dirObj) { string = TclGetString(dirObj); - Tcl_UtfToExternalDString(NULL, string, dirObj->length, &template); + Tcl_UtfToExternalDString(NULL, string, dirObj->length, &templ); } else { - Tcl_DStringInit(&template); - Tcl_DStringAppend(&template, DefaultTempDir(), -1); /* INTL: native */ + Tcl_DStringInit(&templ); + Tcl_DStringAppend(&templ, DefaultTempDir(), -1); /* INTL: native */ } - TclDStringAppendLiteral(&template, "/"); + TclDStringAppendLiteral(&templ, "/"); if (basenameObj) { string = TclGetString(basenameObj); Tcl_UtfToExternalDString(NULL, string, basenameObj->length, &tmp); - TclDStringAppendDString(&template, &tmp); + TclDStringAppendDString(&templ, &tmp); Tcl_DStringFree(&tmp); } else { - TclDStringAppendLiteral(&template, "tcl"); + TclDStringAppendLiteral(&templ, "tcl"); } - TclDStringAppendLiteral(&template, "_XXXXXX"); + TclDStringAppendLiteral(&templ, "_XXXXXX"); #ifdef HAVE_MKSTEMPS if (extensionObj) { string = TclGetString(extensionObj); Tcl_UtfToExternalDString(NULL, string, extensionObj->length, &tmp); - TclDStringAppendDString(&template, &tmp); - fd = mkstemps(Tcl_DStringValue(&template), Tcl_DStringLength(&tmp)); + TclDStringAppendDString(&templ, &tmp); + fd = mkstemps(Tcl_DStringValue(&templ), Tcl_DStringLength(&tmp)); Tcl_DStringFree(&tmp); } else #endif { - fd = mkstemp(Tcl_DStringValue(&template)); + fd = mkstemp(Tcl_DStringValue(&templ)); } if (fd == -1) { - Tcl_DStringFree(&template); + Tcl_DStringFree(&templ); return -1; } if (resultingNameObj) { - Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&template), - Tcl_DStringLength(&template), &tmp); + Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&templ), + Tcl_DStringLength(&templ), &tmp); Tcl_SetStringObj(resultingNameObj, Tcl_DStringValue(&tmp), Tcl_DStringLength(&tmp)); Tcl_DStringFree(&tmp); @@ -2233,10 +2233,10 @@ TclUnixOpenTemporaryFile( * this! */ - unlink(Tcl_DStringValue(&template)); + unlink(Tcl_DStringValue(&templ)); errno = 0; } - Tcl_DStringFree(&template); + Tcl_DStringFree(&templ); return fd; } @@ -2296,7 +2296,7 @@ TclpCreateTemporaryDirectory( Tcl_Obj *dirObj, Tcl_Obj *basenameObj) { - Tcl_DString template, tmp; + Tcl_DString templ, tmp; const char *string; #define DEFAULT_TEMP_DIR_PREFIX "tcl" @@ -2308,37 +2308,37 @@ TclpCreateTemporaryDirectory( if (dirObj) { string = TclGetString(dirObj); - Tcl_UtfToExternalDString(NULL, string, dirObj->length, &template); + Tcl_UtfToExternalDString(NULL, string, dirObj->length, &templ); } else { - Tcl_DStringInit(&template); - Tcl_DStringAppend(&template, DefaultTempDir(), -1); /* INTL: native */ + Tcl_DStringInit(&templ); + Tcl_DStringAppend(&templ, DefaultTempDir(), -1); /* INTL: native */ } - if (Tcl_DStringValue(&template)[Tcl_DStringLength(&template) - 1] != '/') { - TclDStringAppendLiteral(&template, "/"); + if (Tcl_DStringValue(&templ)[Tcl_DStringLength(&templ) - 1] != '/') { + TclDStringAppendLiteral(&templ, "/"); } if (basenameObj) { string = TclGetString(basenameObj); if (basenameObj->length) { Tcl_UtfToExternalDString(NULL, string, basenameObj->length, &tmp); - TclDStringAppendDString(&template, &tmp); + TclDStringAppendDString(&templ, &tmp); Tcl_DStringFree(&tmp); } else { - TclDStringAppendLiteral(&template, DEFAULT_TEMP_DIR_PREFIX); + TclDStringAppendLiteral(&templ, DEFAULT_TEMP_DIR_PREFIX); } } else { - TclDStringAppendLiteral(&template, DEFAULT_TEMP_DIR_PREFIX); + TclDStringAppendLiteral(&templ, DEFAULT_TEMP_DIR_PREFIX); } - TclDStringAppendLiteral(&template, "_XXXXXX"); + TclDStringAppendLiteral(&templ, "_XXXXXX"); /* * Make the temporary directory. */ - if (mkdtemp(Tcl_DStringValue(&template)) == NULL) { - Tcl_DStringFree(&template); + if (mkdtemp(Tcl_DStringValue(&templ)) == NULL) { + Tcl_DStringFree(&templ); return NULL; } @@ -2346,9 +2346,9 @@ TclpCreateTemporaryDirectory( * The template has been updated. Tell the caller what it was. */ - Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&template), - Tcl_DStringLength(&template), &tmp); - Tcl_DStringFree(&template); + Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&templ), + Tcl_DStringLength(&templ), &tmp); + Tcl_DStringFree(&templ); return TclDStringToObj(&tmp); } @@ -2370,11 +2370,11 @@ winPathFromObj( Tcl_Obj *fileName) { int size; - const char *native = Tcl_FSGetNativePath(fileName); + const char *native = (const char *)Tcl_FSGetNativePath(fileName); WCHAR *winPath; size = cygwin_conv_path(1, native, NULL, 0); - winPath = ckalloc(size); + winPath = (WCHAR *)ckalloc(size); cygwin_conv_path(1, native, winPath, size); return winPath; diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index bf033d2..2f6baf6 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -249,9 +249,9 @@ TclpMatchInDirectory( Tcl_Obj *tailPtr; const char *nativeTail; - native = Tcl_FSGetNativePath(pathPtr); + native = (const char *)Tcl_FSGetNativePath(pathPtr); tailPtr = TclPathPart(interp, pathPtr, TCL_PATH_TAIL); - nativeTail = Tcl_FSGetNativePath(tailPtr); + nativeTail = (const char *)Tcl_FSGetNativePath(tailPtr); matchResult = NativeMatchType(interp, native, nativeTail, types); if (matchResult == 1) { Tcl_ListObjAppendElement(interp, resultPtr, pathPtr); @@ -622,7 +622,7 @@ TclpObjAccess( Tcl_Obj *pathPtr, /* Path of file to access */ int mode) /* Permission setting. */ { - const char *path = Tcl_FSGetNativePath(pathPtr); + const char *path = (const char *)Tcl_FSGetNativePath(pathPtr); if (path == NULL) { return -1; @@ -650,7 +650,7 @@ int TclpObjChdir( Tcl_Obj *pathPtr) /* Path to new working directory */ { - const char *path = Tcl_FSGetNativePath(pathPtr); + const char *path = (const char *)Tcl_FSGetNativePath(pathPtr); if (path == NULL) { return -1; @@ -679,7 +679,7 @@ TclpObjLstat( Tcl_Obj *pathPtr, /* Path of file to stat */ Tcl_StatBuf *bufPtr) /* Filled with results of stat call. */ { - return TclOSlstat(Tcl_FSGetNativePath(pathPtr), bufPtr); + return TclOSlstat((const char *)Tcl_FSGetNativePath(pathPtr), bufPtr); } /* @@ -720,7 +720,7 @@ TclpGetNativeCwd( #endif /* USEGETWD */ if ((clientData == NULL) || strcmp(buffer, (const char *) clientData)) { - char *newCd = ckalloc(strlen(buffer) + 1); + char *newCd = (char*)ckalloc(strlen(buffer) + 1); strcpy(newCd, buffer); return newCd; @@ -847,7 +847,7 @@ TclpObjStat( Tcl_Obj *pathPtr, /* Path of file to stat */ Tcl_StatBuf *bufPtr) /* Filled with results of stat call. */ { - const char *path = Tcl_FSGetNativePath(pathPtr); + const char *path = (const char *)Tcl_FSGetNativePath(pathPtr); if (path == NULL) { return -1; @@ -864,7 +864,7 @@ TclpObjLink( int linkAction) { if (toPtr != NULL) { - const char *src = Tcl_FSGetNativePath(pathPtr); + const char *src = (const char *)Tcl_FSGetNativePath(pathPtr); const char *target = NULL; if (src == NULL) { @@ -910,7 +910,7 @@ TclpObjLink( Tcl_DecrRefCount(absPtr); Tcl_DecrRefCount(dirPtr); } else { - target = Tcl_FSGetNativePath(toPtr); + target = (const char*)Tcl_FSGetNativePath(toPtr); if (target == NULL) { return NULL; } @@ -982,7 +982,7 @@ TclpObjLink( } Tcl_DecrRefCount(transPtr); - length = readlink(Tcl_FSGetNativePath(pathPtr), link, sizeof(link)); + length = readlink((const char *)Tcl_FSGetNativePath(pathPtr), link, sizeof(link)); if (length < 0) { return NULL; } @@ -1116,7 +1116,7 @@ TclNativeCreateNativeRep( return NULL; } Tcl_DecrRefCount(validPathPtr); - nativePathPtr = ckalloc(len); + nativePathPtr = (char *)ckalloc(len); memcpy(nativePathPtr, Tcl_DStringValue(&ds), len); Tcl_DStringFree(&ds); @@ -1157,7 +1157,7 @@ TclNativeDupInternalRep( len = (strlen((const char*) clientData) + 1) * sizeof(char); - copy = ckalloc(len); + copy = (char *)ckalloc(len); memcpy(copy, clientData, len); return copy; } @@ -1183,7 +1183,7 @@ TclpUtime( Tcl_Obj *pathPtr, /* File to modify */ struct utimbuf *tval) /* New modification date structure */ { - return utime(Tcl_FSGetNativePath(pathPtr), tval); + return utime((const char *)Tcl_FSGetNativePath(pathPtr), tval); } #ifdef __CYGWIN__ @@ -1194,7 +1194,7 @@ TclOSstat( void *cygstat) { struct stat buf; - Tcl_StatBuf *statBuf = cygstat; + Tcl_StatBuf *statBuf = (Tcl_StatBuf *)cygstat; int result = stat(name, &buf); statBuf->st_mode = buf.st_mode; @@ -1217,7 +1217,7 @@ TclOSlstat( void *cygstat) { struct stat buf; - Tcl_StatBuf *statBuf = cygstat; + Tcl_StatBuf *statBuf = (Tcl_StatBuf *)cygstat; int result = lstat(name, &buf); statBuf->st_mode = buf.st_mode; diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index b6b66da..7406991 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -539,7 +539,7 @@ TclpInitLibraryPath( *encodingPtr = Tcl_GetEncoding(NULL, NULL); str = TclGetString(pathPtr); *lengthPtr = pathPtr->length; - *valuePtr = ckalloc(*lengthPtr + 1); + *valuePtr = (char *)ckalloc(*lengthPtr + 1); memcpy(*valuePtr, str, *lengthPtr + 1); Tcl_DecrRefCount(pathPtr); } diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index 93faec8..bb01597 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -48,16 +48,16 @@ typedef struct { * Declarations for local functions defined in this file: */ -static int PipeBlockModeProc(ClientData instanceData, int mode); -static int PipeClose2Proc(ClientData instanceData, +static int PipeBlockModeProc(void *instanceData, int mode); +static int PipeClose2Proc(void *instanceData, Tcl_Interp *interp, int flags); -static int PipeGetHandleProc(ClientData instanceData, - int direction, ClientData *handlePtr); -static int PipeInputProc(ClientData instanceData, char *buf, +static int PipeGetHandleProc(void *instanceData, + int direction, void **handlePtr); +static int PipeInputProc(void *instanceData, char *buf, int toRead, int *errorCode); -static int PipeOutputProc(ClientData instanceData, +static int PipeOutputProc(void *instanceData, const char *buf, int toWrite, int *errorCode); -static void PipeWatchProc(ClientData instanceData, int mask); +static void PipeWatchProc(void *instanceData, int mask); static void RestoreSignals(void); static int SetupStdFile(TclFile file, int type); @@ -107,7 +107,7 @@ TclpMakeFile( Tcl_Channel channel, /* Channel to get file from. */ int direction) /* Either TCL_READABLE or TCL_WRITABLE. */ { - ClientData data; + void *data; if (Tcl_GetChannelHandle(channel, direction, &data) != TCL_OK) { return NULL; @@ -432,8 +432,8 @@ TclpCreateProcess( * deallocated later */ - dsArray = TclStackAlloc(interp, argc * sizeof(Tcl_DString)); - newArgv = TclStackAlloc(interp, (argc+1) * sizeof(char *)); + dsArray = (Tcl_DString *)TclStackAlloc(interp, argc * sizeof(Tcl_DString)); + newArgv = (char **)TclStackAlloc(interp, (argc+1) * sizeof(char *)); newArgv[argc] = NULL; for (i = 0; i < argc; i++) { newArgv[i] = Tcl_UtfToExternalDString(NULL, argv[i], -1, &dsArray[i]); @@ -744,7 +744,7 @@ TclpCreateCommandChannel( { char channelName[16 + TCL_INTEGER_SPACE]; int channelId; - PipeState *statePtr = ckalloc(sizeof(PipeState)); + PipeState *statePtr = (PipeState *)ckalloc(sizeof(PipeState)); int mode; statePtr->inFile = readFile; @@ -869,7 +869,7 @@ TclGetAndDetachPids( return; } - pipePtr = Tcl_GetChannelInstanceData(chan); + pipePtr = (PipeState *)Tcl_GetChannelInstanceData(chan); TclNewObj(pidsObj); for (i = 0; i < pipePtr->numPids; i++) { Tcl_ListObjAppendElement(NULL, pidsObj, Tcl_NewWideIntObj( @@ -903,12 +903,12 @@ TclGetAndDetachPids( /* ARGSUSED */ static int PipeBlockModeProc( - ClientData instanceData, /* Pipe state. */ + void *instanceData, /* Pipe state. */ int mode) /* The mode to set. Can be one of * TCL_MODE_BLOCKING or * TCL_MODE_NONBLOCKING. */ { - PipeState *psPtr = instanceData; + PipeState *psPtr = (PipeState *)instanceData; if (psPtr->inFile && TclUnixSetBlockingMode(GetFd(psPtr->inFile), mode) < 0) { @@ -943,11 +943,11 @@ PipeBlockModeProc( static int PipeClose2Proc( - ClientData instanceData, /* The pipe to close. */ + void *instanceData, /* The pipe to close. */ Tcl_Interp *interp, /* For error reporting. */ int flags) /* Flags that indicate which side to close. */ { - PipeState *pipePtr = instanceData; + PipeState *pipePtr = (PipeState *)instanceData; Tcl_Channel errChan; int errorCode, result; @@ -1038,13 +1038,13 @@ PipeClose2Proc( static int PipeInputProc( - ClientData instanceData, /* Pipe state. */ + void *instanceData, /* Pipe state. */ char *buf, /* Where to store data read. */ int toRead, /* How much space is available in the * buffer? */ int *errorCodePtr) /* Where to store error code. */ { - PipeState *psPtr = instanceData; + PipeState *psPtr = (PipeState *)instanceData; int bytesRead; /* How many bytes were actually read from the * input device? */ @@ -1089,12 +1089,12 @@ PipeInputProc( static int PipeOutputProc( - ClientData instanceData, /* Pipe state. */ + void *instanceData, /* Pipe state. */ const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ { - PipeState *psPtr = instanceData; + PipeState *psPtr = (PipeState *)instanceData; int written; *errorCodePtr = 0; @@ -1134,12 +1134,12 @@ PipeOutputProc( static void PipeWatchProc( - ClientData instanceData, /* The pipe state. */ + void *instanceData, /* The pipe state. */ int mask) /* Events of interest; an OR-ed combination of * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ { - PipeState *psPtr = instanceData; + PipeState *psPtr = (PipeState *)instanceData; int newmask; if (psPtr->inFile) { @@ -1182,11 +1182,11 @@ PipeWatchProc( static int PipeGetHandleProc( - ClientData instanceData, /* The pipe state. */ + void *instanceData, /* The pipe state. */ int direction, /* TCL_READABLE or TCL_WRITABLE */ - ClientData *handlePtr) /* Where to store the handle. */ + void **handlePtr) /* Where to store the handle. */ { - PipeState *psPtr = instanceData; + PipeState *psPtr = (PipeState *)instanceData; if (direction == TCL_READABLE && psPtr->inFile) { *handlePtr = INT2PTR(GetFd(psPtr->inFile)); @@ -1252,7 +1252,7 @@ Tcl_WaitPid( /* ARGSUSED */ int Tcl_PidObjCmd( - ClientData dummy, /* Not used. */ + void *dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ @@ -1286,7 +1286,7 @@ Tcl_PidObjCmd( * Extract the process IDs from the pipe structure. */ - pipePtr = Tcl_GetChannelInstanceData(chan); + pipePtr = (PipeState *)Tcl_GetChannelInstanceData(chan); resultPtr = Tcl_NewObj(); for (i = 0; i < pipePtr->numPids; i++) { Tcl_ListObjAppendElement(NULL, resultPtr, diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 62e4756..c061a78 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -66,7 +66,7 @@ struct TcpState { Tcl_TcpAcceptProc *acceptProc; /* Proc to call on accept. */ - ClientData acceptProcData; /* The data for the accept proc. */ + void *acceptProcData; /* The data for the accept proc. */ /* * Only needed for client sockets @@ -130,24 +130,24 @@ struct TcpState { */ static int TcpConnect(Tcl_Interp *interp, TcpState *state); -static void TcpAccept(ClientData data, int mask); -static int TcpBlockModeProc(ClientData data, int mode); -static int TcpCloseProc(ClientData instanceData, +static void TcpAccept(void *data, int mask); +static int TcpBlockModeProc(void *data, int mode); +static int TcpCloseProc(void *instanceData, Tcl_Interp *interp); -static int TcpClose2Proc(ClientData instanceData, +static int TcpClose2Proc(void *instanceData, Tcl_Interp *interp, int flags); -static int TcpGetHandleProc(ClientData instanceData, - int direction, ClientData *handlePtr); -static int TcpGetOptionProc(ClientData instanceData, +static int TcpGetHandleProc(void *instanceData, + int direction, void **handlePtr); +static int TcpGetOptionProc(void *instanceData, Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr); -static int TcpInputProc(ClientData instanceData, char *buf, +static int TcpInputProc(void *instanceData, char *buf, int toRead, int *errorCode); -static int TcpOutputProc(ClientData instanceData, +static int TcpOutputProc(void *instanceData, const char *buf, int toWrite, int *errorCode); -static void TcpWatchProc(ClientData instanceData, int mask); +static void TcpWatchProc(void *instanceData, int mask); static int WaitForConnect(TcpState *statePtr, int *errorCodePtr); -static void WrapNotify(ClientData clientData, int mask); +static void WrapNotify(void *clientData, int mask); /* * This structure describes the channel type structure for TCP socket @@ -239,7 +239,7 @@ InitializeHostName( char *dot = strchr(u.nodename, '.'); if (dot != NULL) { - char *node = ckalloc(dot - u.nodename + 1); + char *node = (char *)ckalloc(dot - u.nodename + 1); memcpy(node, u.nodename, dot - u.nodename); node[dot - u.nodename] = '\0'; @@ -283,11 +283,11 @@ InitializeHostName( *encodingPtr = Tcl_GetEncoding(NULL, NULL); if (native) { *lengthPtr = strlen(native); - *valuePtr = ckalloc(*lengthPtr + 1); + *valuePtr = (char *)ckalloc(*lengthPtr + 1); memcpy(*valuePtr, native, *lengthPtr + 1); } else { *lengthPtr = 0; - *valuePtr = ckalloc(1); + *valuePtr = (char *)ckalloc(1); *valuePtr[0] = '\0'; } } @@ -381,12 +381,12 @@ TclpFinalizeSockets(void) /* ARGSUSED */ static int TcpBlockModeProc( - ClientData instanceData, /* Socket state. */ + void *instanceData, /* Socket state. */ int mode) /* The mode to set. Can be one of * TCL_MODE_BLOCKING or * TCL_MODE_NONBLOCKING. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; if (mode == TCL_MODE_BLOCKING) { CLEAR_BITS(statePtr->flags, TCP_NONBLOCKING); @@ -527,13 +527,13 @@ WaitForConnect( /* ARGSUSED */ static int TcpInputProc( - ClientData instanceData, /* Socket state. */ + void *instanceData, /* Socket state. */ char *buf, /* Where to store data read. */ int bufSize, /* How much space is available in the * buffer? */ int *errorCodePtr) /* Where to store error code. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; int bytesRead; *errorCodePtr = 0; @@ -578,12 +578,12 @@ TcpInputProc( static int TcpOutputProc( - ClientData instanceData, /* Socket state. */ + void *instanceData, /* Socket state. */ const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; int written; *errorCodePtr = 0; @@ -620,10 +620,10 @@ TcpOutputProc( /* ARGSUSED */ static int TcpCloseProc( - ClientData instanceData, /* The socket to close. */ + void *instanceData, /* The socket to close. */ Tcl_Interp *interp) /* For error reporting - unused. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; int errorCode = 0; TcpFdList *fds; @@ -681,11 +681,11 @@ TcpCloseProc( static int TcpClose2Proc( - ClientData instanceData, /* The socket to close. */ + void *instanceData, /* The socket to close. */ Tcl_Interp *interp, /* For error reporting. */ int flags) /* Flags that indicate which side to close. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; int errorCode = 0; int sd; @@ -842,7 +842,7 @@ TcpHostPortList( static int TcpGetOptionProc( - ClientData instanceData, /* Socket state. */ + void *instanceData, /* Socket state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ const char *optionName, /* Name of the option to retrieve the value * for, or NULL to get all options and their @@ -850,7 +850,7 @@ TcpGetOptionProc( Tcl_DString *dsPtr) /* Where to store the computed value; * initialized by caller. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; size_t len = 0; WaitForConnect(statePtr, NULL); @@ -1008,7 +1008,7 @@ TcpGetOptionProc( static void WrapNotify( - ClientData clientData, + void *clientData, int mask) { TcpState *statePtr = (TcpState *) clientData; @@ -1037,12 +1037,12 @@ WrapNotify( static void TcpWatchProc( - ClientData instanceData, /* The socket state. */ + void *instanceData, /* The socket state. */ int mask) /* Events of interest; an OR-ed combination of * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; if (statePtr->acceptProc != NULL) { /* @@ -1111,11 +1111,11 @@ TcpWatchProc( /* ARGSUSED */ static int TcpGetHandleProc( - ClientData instanceData, /* The socket state. */ + void *instanceData, /* The socket state. */ int direction, /* Not used. */ - ClientData *handlePtr) /* Where to store the handle. */ + void **handlePtr) /* Where to store the handle. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; *handlePtr = INT2PTR(statePtr->fds.fd); return TCL_OK; @@ -1135,12 +1135,12 @@ TcpGetHandleProc( static void TcpAsyncCallback( - ClientData clientData, /* The socket state. */ + void *clientData, /* The socket state. */ int mask) /* Events of interest; an OR-ed combination of * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ { - TcpConnect(NULL, clientData); + TcpConnect(NULL, (TcpState *)clientData); } /* @@ -1182,6 +1182,7 @@ TcpConnect( int async_callback = GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING); int ret = -1, error = EHOSTUNREACH; int async = GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT); + static const int reuseaddr = 1; if (async_callback) { goto reenter; @@ -1192,7 +1193,6 @@ TcpConnect( for (statePtr->myaddr = statePtr->myaddrlist; statePtr->myaddr != NULL; statePtr->myaddr = statePtr->myaddr->ai_next) { - int reuseaddr = 1; /* * No need to try combinations of local and remote addresses of @@ -1399,7 +1399,7 @@ Tcl_OpenTcpClient( * Allocate a new TcpState for this socket. */ - statePtr = ckalloc(sizeof(TcpState)); + statePtr = (TcpState *)ckalloc(sizeof(TcpState)); memset(statePtr, 0, sizeof(TcpState)); statePtr->flags = async ? TCP_ASYNC_CONNECT : 0; statePtr->cachedBlocking = TCL_MODE_BLOCKING; @@ -1446,7 +1446,7 @@ Tcl_OpenTcpClient( Tcl_Channel Tcl_MakeTcpClientChannel( - ClientData sock) /* The socket to wrap up into a channel. */ + void *sock) /* The socket to wrap up into a channel. */ { return (Tcl_Channel) TclpMakeTcpClientChannelMode(sock, TCL_READABLE | TCL_WRITABLE); @@ -1478,7 +1478,7 @@ TclpMakeTcpClientChannelMode( TcpState *statePtr; char channelName[SOCK_CHAN_LENGTH]; - statePtr = ckalloc(sizeof(TcpState)); + statePtr = (TcpState *)ckalloc(sizeof(TcpState)); memset(statePtr, 0, sizeof(TcpState)); statePtr->fds.fd = PTR2INT(sock); statePtr->flags = 0; @@ -1521,7 +1521,7 @@ Tcl_OpenTcpServerEx( Tcl_TcpAcceptProc *acceptProc, /* Callback for accepting connections from new * clients. */ - ClientData acceptProcData) /* Data for the callback. */ + void *acceptProcData) /* Data for the callback. */ { int status = 0, sock = -1, optvalue, port, chosenport; struct addrinfo *addrlist = NULL, *addrPtr; /* socket address */ @@ -1701,14 +1701,14 @@ Tcl_OpenTcpServerEx( * Allocate a new TcpState for this socket. */ - statePtr = ckalloc(sizeof(TcpState)); + statePtr = (TcpState *)ckalloc(sizeof(TcpState)); memset(statePtr, 0, sizeof(TcpState)); statePtr->acceptProc = acceptProc; statePtr->acceptProcData = acceptProcData; sprintf(channelName, SOCK_TEMPLATE, (long) statePtr); newfds = &statePtr->fds; } else { - newfds = ckalloc(sizeof(TcpFdList)); + newfds = (TcpFdList *)ckalloc(sizeof(TcpFdList)); memset(newfds, (int) 0, sizeof(TcpFdList)); fds->next = newfds; } @@ -1769,10 +1769,10 @@ Tcl_OpenTcpServerEx( /* ARGSUSED */ static void TcpAccept( - ClientData data, /* Callback token. */ + void *data, /* Callback token. */ int mask) /* Not used. */ { - TcpFdList *fds = data; /* Client data of server socket. */ + TcpFdList *fds = (TcpFdList *)data; /* Client data of server socket. */ int newsock; /* The new client socket */ TcpState *newSockState; /* State for new socket. */ address addr; /* The remote address */ @@ -1793,7 +1793,7 @@ TcpAccept( (void) fcntl(newsock, F_SETFD, FD_CLOEXEC); - newSockState = ckalloc(sizeof(TcpState)); + newSockState = (TcpState *)ckalloc(sizeof(TcpState)); memset(newSockState, 0, sizeof(TcpState)); newSockState->flags = 0; newSockState->fds.fd = newsock; diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index e59a0e3..eb91ba1 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -331,7 +331,7 @@ TestFileHandlerProc( int mask) /* Indicates which events happened: * TCL_READABLE or TCL_WRITABLE. */ { - Pipe *pipePtr = clientData; + Pipe *pipePtr = (Pipe *)clientData; if (mask & TCL_READABLE) { pipePtr->readCount++; diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 60340b0..30e19ca 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -577,7 +577,7 @@ Tcl_MutexLock( * Double inside master lock check to avoid a race condition. */ - pmutexPtr = ckalloc(sizeof(PMutex)); + pmutexPtr = (PMutex *)ckalloc(sizeof(PMutex)); PMutexInit(pmutexPtr); *mutexPtr = (Tcl_Mutex) pmutexPtr; TclRememberMutex(mutexPtr); @@ -687,7 +687,7 @@ Tcl_ConditionWait( */ if (*condPtr == NULL) { - pcondPtr = ckalloc(sizeof(pthread_cond_t)); + pcondPtr = (pthread_cond_t *)ckalloc(sizeof(pthread_cond_t)); pthread_cond_init(pcondPtr, NULL); *condPtr = (Tcl_Condition) pcondPtr; TclRememberCondition(condPtr); @@ -846,7 +846,7 @@ TclpNewAllocMutex(void) AllocMutex *lockPtr; register PMutex *plockPtr; - lockPtr = malloc(sizeof(AllocMutex)); + lockPtr = (AllocMutex *)malloc(sizeof(AllocMutex)); if (lockPtr == NULL) { Tcl_Panic("could not allocate lock"); } @@ -917,7 +917,7 @@ TclpThreadCreateKey(void) { pthread_key_t *ptkeyPtr; - ptkeyPtr = TclpSysAlloc(sizeof(pthread_key_t), 0); + ptkeyPtr = (pthread_key_t *)TclpSysAlloc(sizeof(pthread_key_t), 0); if (NULL == ptkeyPtr) { Tcl_Panic("unable to allocate thread key!"); } @@ -933,7 +933,7 @@ void TclpThreadDeleteKey( void *keyPtr) { - pthread_key_t *ptkeyPtr = keyPtr; + pthread_key_t *ptkeyPtr = (pthread_key_t *)keyPtr; if (pthread_key_delete(*ptkeyPtr)) { Tcl_Panic("unable to delete key!"); @@ -947,7 +947,7 @@ TclpThreadSetMasterTSD( void *tsdKeyPtr, void *ptr) { - pthread_key_t *ptkeyPtr = tsdKeyPtr; + pthread_key_t *ptkeyPtr = (pthread_key_t *)tsdKeyPtr; if (pthread_setspecific(*ptkeyPtr, ptr)) { Tcl_Panic("unable to set master TSD value"); @@ -958,7 +958,7 @@ void * TclpThreadGetMasterTSD( void *tsdKeyPtr) { - pthread_key_t *ptkeyPtr = tsdKeyPtr; + pthread_key_t *ptkeyPtr = (pthread_key_t*)tsdKeyPtr; return pthread_getspecific(*ptkeyPtr); } diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 1d8b351..0bdadc7 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -59,7 +59,7 @@ static void NativeGetTime(Tcl_Time *timebuf, Tcl_GetTimeProc *tclGetTimeProcPtr = NativeGetTime; Tcl_ScaleTimeProc *tclScaleTimeProcPtr = NativeScaleTime; -ClientData tclTimeClientData = NULL; +void *tclTimeClientData = NULL; /* *---------------------------------------------------------------------- @@ -579,7 +579,7 @@ SetTZIfNecessary(void) } else { ckfree(lastTZ); } - lastTZ = ckalloc(strlen(newTZ) + 1); + lastTZ = (char *)ckalloc(strlen(newTZ) + 1); strcpy(lastTZ, newTZ); } Tcl_MutexUnlock(&tmMutex); diff --git a/unix/tclXtNotify.c b/unix/tclXtNotify.c index 26db9f2..490b739 100644 --- a/unix/tclXtNotify.c +++ b/unix/tclXtNotify.c @@ -359,7 +359,7 @@ CreateFileHandler( } } if (filePtr == NULL) { - filePtr = ckalloc(sizeof(FileHandler)); + filePtr = (FileHandler *)ckalloc(sizeof(FileHandler)); filePtr->fd = fd; filePtr->read = 0; filePtr->write = 0; @@ -525,7 +525,7 @@ FileProc( */ filePtr->readyMask |= mask; - fileEvPtr = ckalloc(sizeof(FileHandlerEvent)); + fileEvPtr = (FileHandlerEvent *)ckalloc(sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; fileEvPtr->fd = filePtr->fd; Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL); diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 27ddfc8..06e7878 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -1472,7 +1472,7 @@ DdeObjCmd( if (length == 0) { serviceName = NULL; } else if ((index != DDE_SERVERNAME) && (index != DDE_EVAL)) { - ddeService = DdeCreateStringHandle(ddeInstance, (void *) serviceName, + ddeService = DdeCreateStringHandle(ddeInstance, serviceName, CP_WINUNICODE); } @@ -1485,7 +1485,7 @@ DdeObjCmd( if (length == 0) { topicName = NULL; } else { - ddeTopic = DdeCreateStringHandle(ddeInstance, (void *) topicName, + ddeTopic = DdeCreateStringHandle(ddeInstance, topicName, CP_WINUNICODE); } } @@ -1592,7 +1592,7 @@ DdeObjCmd( result = TCL_ERROR; } else { Tcl_Obj *returnObjPtr; - ddeItem = DdeCreateStringHandle(ddeInstance, (void *) itemString, + ddeItem = DdeCreateStringHandle(ddeInstance, itemString, CP_WINUNICODE); if (ddeItem != NULL) { ddeData = DdeClientTransaction(NULL, 0, hConv, ddeItem, @@ -1669,7 +1669,7 @@ DdeObjCmd( SetDdeError(interp); result = TCL_ERROR; } else { - ddeItem = DdeCreateStringHandle(ddeInstance, (void *) itemString, + ddeItem = DdeCreateStringHandle(ddeInstance, itemString, CP_WINUNICODE); if (ddeItem != NULL) { ddeData = DdeClientTransaction(dataString, (DWORD) length, diff --git a/win/tclWinReg.c b/win/tclWinReg.c index f93a553..5f131d3 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -215,7 +215,7 @@ Registry_Unload( * Delete the originally registered command. */ - cmd = Tcl_GetAssocData(interp, REGISTRY_ASSOC_KEY, NULL); + cmd = (Tcl_Command)Tcl_GetAssocData(interp, REGISTRY_ASSOC_KEY, NULL); if (cmd != NULL) { Tcl_DeleteCommandFromToken(interp, cmd); } @@ -244,7 +244,7 @@ static void DeleteCmd( ClientData clientData) { - Tcl_Interp *interp = clientData; + Tcl_Interp *interp = (Tcl_Interp *)clientData; Tcl_SetAssocData(interp, REGISTRY_ASSOC_KEY, NULL, NULL); } @@ -1168,7 +1168,7 @@ RecursiveDeleteKey( HKEY hKey; REGSAM saveMode = mode; static int checkExProc = 0; - static FARPROC regDeleteKeyExProc = NULL; + static LSTATUS (* regDeleteKeyExProc) (HKEY, LPCWSTR, REGSAM, DWORD) = (LSTATUS (*) (HKEY, LPCWSTR, REGSAM, DWORD)) NULL; /* * Do not allow NULL or empty key name. @@ -1208,7 +1208,7 @@ RecursiveDeleteKey( checkExProc = 1; handle = GetModuleHandle(TEXT("ADVAPI32")); - regDeleteKeyExProc = (FARPROC) + regDeleteKeyExProc = (LSTATUS (*) (HKEY, LPCWSTR, REGSAM, DWORD)) GetProcAddress(handle, "RegDeleteKeyExW"); } if (mode && regDeleteKeyExProc) { diff --git a/win/tclWinTest.c b/win/tclWinTest.c index 40be3d5..1cff8e9 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -465,7 +465,7 @@ TestplatformChmod( goto done; } - secDesc = ckalloc(secDescLen); + secDesc = (BYTE *)ckalloc(secDescLen); if (!GetFileSecurityA(nativePath, infoBits, (PSECURITY_DESCRIPTOR) secDesc, secDescLen, &secDescLen2) || (secDescLen < secDescLen2)) { @@ -477,7 +477,7 @@ TestplatformChmod( * Get the World SID. */ - userSid = ckalloc(GetSidLengthRequired((UCHAR) 1)); + userSid = (SID *)ckalloc(GetSidLengthRequired((UCHAR) 1)); InitializeSid(userSid, &userSidAuthority, (BYTE) 1); *(GetSidSubAuthority(userSid, 0)) = SECURITY_WORLD_RID; @@ -503,7 +503,7 @@ TestplatformChmod( newAclSize = ACLSize.AclBytesInUse + sizeof(ACCESS_DENIED_ACE) + GetLengthSid(userSid) - sizeof(DWORD); - newAcl = ckalloc(newAclSize); + newAcl = (PACL) ckalloc(newAclSize); /* * Initialize the new ACL. -- cgit v0.12 From 8c60b1157a27a535111861c5a83b64d502ec1948 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 3 Sep 2019 20:32:33 +0000 Subject: Mark more unused parameters --- generic/tclEvent.c | 7 ++++--- generic/tclObj.c | 17 ++++++++++++++++- generic/tclPathObj.c | 9 ++++++--- generic/tclPkg.c | 18 +++++++++++++++--- generic/tclScan.c | 1 + generic/tclStringObj.c | 7 ++++++- generic/tclTestProcBodyObj.c | 2 ++ generic/tclThreadTest.c | 6 +++++- generic/tclTrace.c | 2 ++ generic/tclUtil.c | 6 +++--- generic/tclVar.c | 8 +++++++- generic/tclZlib.c | 3 ++- macosx/tclMacOSXBundle.c | 3 ++- macosx/tclMacOSXNotify.c | 6 +++++- unix/tclLoadDyld.c | 6 +++++- unix/tclUnixInit.c | 4 ++++ unix/tclUnixSock.c | 11 +++++++++-- unix/tclUnixTest.c | 37 ++++++++++++++++++++++++++++--------- unix/tclUnixTime.c | 5 ++++- 19 files changed, 126 insertions(+), 32 deletions(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 7c499b5..91bc995 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1467,17 +1467,18 @@ Tcl_VwaitObjCmd( static char * VwaitVarProc( void *clientData, /* Pointer to integer to set to 1. */ - Tcl_Interp *interp, /* Interpreter containing variable. */ + Tcl_Interp *dummy, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { int *donePtr = (int *)clientData; + (void)dummy; (void)flags; + (void)name1; + (void)name2; *donePtr = 1; - Tcl_UntraceVar(interp, name1, TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - VwaitVarProc, clientData); return NULL; } diff --git a/generic/tclObj.c b/generic/tclObj.c index cbba762..edbf50b 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -786,8 +786,9 @@ TclContinuationsGet( static void TclThreadFinalizeContLines( - ClientData clientData) + ClientData dummy) { + (void)dummy; /* * Release the hashtable tracking invisible continuation lines. */ @@ -1024,6 +1025,8 @@ TclDbDumpActiveObjects( } } } +#else + (void)outFile; #endif } @@ -1200,6 +1203,9 @@ Tcl_DbNewObj( int line) /* Line number in the source file; used for * debugging. */ { + (void)file; + (void)line; + return Tcl_NewObj(); } #endif /* TCL_MEM_DEBUG */ @@ -2038,6 +2044,9 @@ Tcl_DbNewBooleanObj( int line) /* Line number in the source file; used for * debugging. */ { + (void)file; + (void)line; + return Tcl_NewBooleanObj(boolValue); } #endif /* TCL_MEM_DEBUG */ @@ -2425,6 +2434,9 @@ Tcl_DbNewDoubleObj( int line) /* Line number in the source file; used for * debugging. */ { + (void)file; + (void)line; + return Tcl_NewDoubleObj(dblValue); } #endif /* TCL_MEM_DEBUG */ @@ -2909,6 +2921,9 @@ Tcl_DbNewLongObj( int line) /* Line number in the source file; used for * debugging. */ { + (void)file; + (void)line; + return Tcl_NewWideIntObj(longValue); } #endif /* TCL_MEM_DEBUG */ diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 9e62c7c..41fb0c6 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -1402,13 +1402,14 @@ AppendPath( Tcl_Obj * TclFSMakePathRelative( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ + Tcl_Interp *dummy, /* Used for error reporting if not NULL. */ Tcl_Obj *pathPtr, /* The path we have. */ Tcl_Obj *cwdPtr) /* Make it relative to this. */ { int cwdLen, len; const char *tempStr; Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType); + (void)dummy; if (irPtr) { FsPath *fsPathPtr = PATHOBJ(pathPtr); @@ -1473,10 +1474,11 @@ TclFSMakePathRelative( static int MakePathFromNormalized( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ + Tcl_Interp *dummy, /* Not used. */ Tcl_Obj *pathPtr) /* The object to convert. */ { FsPath *fsPathPtr; + (void)dummy; if (TclHasIntRep(pathPtr, &fsPathType)) { return TCL_OK; @@ -2548,8 +2550,9 @@ UpdateStringOfFsPath( int TclNativePathInFilesystem( Tcl_Obj *pathPtr, - ClientData *clientDataPtr) + ClientData *dummy) { + (void)dummy; /* * A special case is required to handle the empty path "". This is a valid * path (i.e. the user should be able to do 'file exists ""' without diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 98c9cf3..0a32f48 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -226,11 +226,12 @@ Tcl_PkgProvideEx( static void PkgFilesCleanupProc( ClientData clientData, - Tcl_Interp *interp) + Tcl_Interp *dummy) { PkgFiles *pkgFiles = (PkgFiles *) clientData; Tcl_HashSearch search; Tcl_HashEntry *entry; + (void)dummy; while (pkgFiles->names) { PkgName *name = pkgFiles->names; @@ -466,6 +467,7 @@ PkgRequireCore( Tcl_Obj **reqv = (Tcl_Obj **)data[2]; int code = CheckAllRequirements(interp, reqc, reqv); Require *reqPtr; + (void)result; if (code != TCL_OK) { return code; @@ -498,6 +500,7 @@ PkgRequireCoreStep1( int reqc = PTR2INT(data[1]); Tcl_Obj **const reqv = (Tcl_Obj **)data[2]; const char *name = reqPtr->name /* Name of desired package. */; + (void)result; /* * If we've got the package in the DB already, go on to actually loading @@ -592,6 +595,7 @@ PkgRequireCoreFinal( char *pkgVersionI; void *clientDataPtr = reqPtr->clientDataPtr; const char *name = reqPtr->name; /* Name of desired package. */ + (void)result; if (reqPtr->pkgPtr->version == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -635,9 +639,11 @@ PkgRequireCoreFinal( static int PkgRequireCoreCleanup( ClientData data[], - Tcl_Interp *interp, + Tcl_Interp *dummy, int result) { + (void)dummy; + ckfree(data[0]); return result; } @@ -658,6 +664,7 @@ SelectPackage( const char *name = reqPtr->name; Package *pkgPtr = reqPtr->pkgPtr; Interp *iPtr = (Interp *) interp; + (void)result; /* * Check whether we're already attempting to load some version of this @@ -1057,6 +1064,8 @@ Tcl_PackageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)dummy; + return Tcl_NRCallObjProc(interp, TclNRPackageObjCmd, NULL, objc, objv); } @@ -1089,6 +1098,7 @@ TclNRPackageObjCmd( const char *argv2, *argv3, *argv4; char *iva = NULL, *ivb = NULL; Tcl_Obj *objvListPtr, **newObjvPtr; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1536,9 +1546,11 @@ TclNRPackageObjCmd( static int TclNRPackageObjCmdCleanup( ClientData data[], - Tcl_Interp *interp, + Tcl_Interp *dummy, int result) { + (void)dummy; + TclDecrRefCount((Tcl_Obj *) data[0]); TclDecrRefCount((Tcl_Obj *) data[1]); return result; diff --git a/generic/tclScan.c b/generic/tclScan.c index b6d4132..78fd3be 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -584,6 +584,7 @@ Tcl_ScanObjCmd( char buf[513]; /* Temporary buffer to hold scanned number * strings before they are passed to * strtoul. */ + (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index c4f4f87..5bdf496 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -347,6 +347,9 @@ Tcl_DbNewStringObj( int line) /* Line number in the source file; used for * debugging. */ { + (void)file; + (void)line; + return Tcl_NewStringObj(bytes, length); } #endif /* TCL_MEM_DEBUG */ @@ -4166,9 +4169,11 @@ DupStringInternalRep( static int SetStringFromAny( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ + Tcl_Interp *dummy, /* Not used. */ Tcl_Obj *objPtr) /* The object to convert. */ { + (void)dummy; + if (!TclHasIntRep(objPtr, &tclStringType)) { String *stringPtr = stringAlloc(0); diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c index 59379de..b6ac741 100644 --- a/generic/tclTestProcBodyObj.c +++ b/generic/tclTestProcBodyObj.c @@ -240,6 +240,7 @@ ProcBodyTestProcObjCmd( Tcl_Obj *bodyObjPtr; Tcl_Obj *myobjv[5]; int result; + (void)dummy; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "newName argsList bodyName"); @@ -333,6 +334,7 @@ ProcBodyTestCheckObjCmd( Tcl_Obj *const objv[]) /* arguments */ { const char *version; + (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index 48aa445..7fc748e 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -223,6 +223,7 @@ ThreadObjCmd( THREAD_ID, THREAD_JOIN, THREAD_NAMES, THREAD_SEND, THREAD_WAIT, THREAD_ERRORPROC }; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1018,6 +1019,7 @@ ThreadEventProc( Tcl_Interp *interp = tsdPtr->interp; int code; const char *result, *errorCode, *errorInfo; + (void)mask; if (interp == NULL) { code = TCL_ERROR; @@ -1109,8 +1111,10 @@ ThreadFreeProc( static int ThreadDeleteEvent( Tcl_Event *eventPtr, /* Really ThreadEvent */ - void *clientData) /* dummy */ + void *dummy) /* dummy */ { + (void)dummy; + if (eventPtr->proc == ThreadEventProc) { ckfree(((ThreadEvent *) eventPtr)->script); return 1; diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 3dac23f..4725e97 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -210,6 +210,7 @@ Tcl_TraceObjCmd( TRACE_OLD_VARIABLE, TRACE_OLD_VDELETE, TRACE_OLD_VINFO #endif }; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1050,6 +1051,7 @@ Tcl_CommandTraceInfo( { Command *cmdPtr; CommandTrace *tracePtr; + (void)flags; cmdPtr = (Command *) Tcl_FindCommand(interp, cmdName, NULL, TCL_LEAVE_ERR_MSG); diff --git a/generic/tclUtil.c b/generic/tclUtil.c index f1133e3..b4f0e79 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2479,6 +2479,7 @@ TclByteArrayMatch( { const unsigned char *stringEnd, *patternEnd; unsigned char p; + (void)flags; stringEnd = string + strLen; patternEnd = pattern + ptnLen; @@ -3263,9 +3264,7 @@ Tcl_DStringEndSublist( void Tcl_PrintDouble( - Tcl_Interp *interp, /* Interpreter whose tcl_precision variable - * used to be used to control printing. It's - * ignored now. */ + Tcl_Interp *dummy, /* Not used. */ double value, /* Value to print as string. */ char *dst) /* Where to store converted value; must have * at least TCL_DOUBLE_SPACE characters. */ @@ -3276,6 +3275,7 @@ Tcl_PrintDouble( char *digits; char *end; int *precisionPtr = (int *)Tcl_GetThreadData(&precisionKey, sizeof(int)); + (void)dummy; /* * Handle NaN. diff --git a/generic/tclVar.c b/generic/tclVar.c index 6526e25..bcb12ca 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -1534,6 +1534,7 @@ Tcl_SetObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *varValueObj; + (void)dummy; if (objc == 2) { varValueObj = Tcl_ObjGetVar2(interp, objv[1], NULL,TCL_LEAVE_ERR_MSG); @@ -2830,6 +2831,7 @@ Tcl_UnsetObjCmd( { int i, flags = TCL_LEAVE_ERR_MSG; const char *name; + (void)dummy; if (objc == 1) { /* @@ -2900,6 +2902,7 @@ Tcl_AppendObjCmd( Tcl_Obj *varValuePtr = NULL; /* Initialized to avoid compiler warning. */ int i; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "varName ?value ...?"); @@ -2966,6 +2969,7 @@ Tcl_LappendObjCmd( int numElems, createdNewObj; Var *varPtr, *arrayPtr; int result; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "varName ?value ...?"); @@ -3182,6 +3186,7 @@ ArrayForNRCmd( ArraySearch *searchPtr = NULL; Var *varPtr; int isArray, numVars; + (void)dummy; /* * array for {k v} a body @@ -3404,7 +3409,7 @@ ArrayPopulateSearch( static int ArrayStartSearchCmd( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -3412,6 +3417,7 @@ ArrayStartSearchCmd( Var *varPtr; int isArray; ArraySearch *searchPtr; + (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName"); diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 09195a2..71f0ad5 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -1920,7 +1920,7 @@ Tcl_ZlibAdler32( static int ZlibCmd( - void *notUsed, + void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1939,6 +1939,7 @@ ZlibCmd( CMD_ADLER, CMD_COMPRESS, CMD_CRC, CMD_DECOMPRESS, CMD_DEFLATE, CMD_GUNZIP, CMD_GZIP, CMD_INFLATE, CMD_PUSH, CMD_STREAM }; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "command arg ?...?"); diff --git a/macosx/tclMacOSXBundle.c b/macosx/tclMacOSXBundle.c index 915f290..81d8d04 100644 --- a/macosx/tclMacOSXBundle.c +++ b/macosx/tclMacOSXBundle.c @@ -197,7 +197,7 @@ Tcl_MacOSXOpenBundleResources( int Tcl_MacOSXOpenVersionedBundleResources( - Tcl_Interp *interp, + Tcl_Interp *dummy, const char *bundleName, const char *bundleVersion, int hasResourceFile, @@ -208,6 +208,7 @@ Tcl_MacOSXOpenVersionedBundleResources( CFBundleRef bundleRef, versionedBundleRef = NULL; CFStringRef bundleNameRef; CFURLRef libURL; + (void)dummy; libraryPath[0] = '\0'; diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c index 945ea4b..1523400 100644 --- a/macosx/tclMacOSXNotify.c +++ b/macosx/tclMacOSXNotify.c @@ -945,6 +945,8 @@ TimerWakeUp( CFRunLoopTimerRef timer, void *info) { + (void)timer; + (void)info; } /* @@ -1453,6 +1455,7 @@ UpdateWaitingListAndServiceEvents( void *info) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *)info; + (void)observer; if (tsdPtr->sleeping) { return; @@ -1827,13 +1830,14 @@ TclUnixWaitForFile( static TCL_NORETURN void NotifierThreadProc( - ClientData clientData) /* Not used. */ + ClientData dummy) /* Not used. */ { ThreadSpecificData *tsdPtr; fd_set readableMask, writableMask, exceptionalMask; int i, numFdBits = 0, polling; struct timeval poll = {0., 0.}, *timePtr; char buf[2]; + (void)dummy; /* * Look for file events and report them to interested threads. diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c index 14e05b2..9d4e99c 100644 --- a/unix/tclLoadDyld.c +++ b/unix/tclLoadDyld.c @@ -491,6 +491,9 @@ TclGuessPackageName( Tcl_DString *bufPtr) /* Initialized empty dstring. Append package * name to this if possible. */ { + (void)fileName; + (void)bufPtr; + return 0; } @@ -513,10 +516,11 @@ TclGuessPackageName( #ifdef TCL_LOAD_FROM_MEMORY MODULE_SCOPE void * TclpLoadMemoryGetBuffer( - Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Interp *dummy, /* Used for error reporting. */ int size) /* Size of desired buffer. */ { void *buffer = NULL; + (void)dummy; /* * NSCreateObjectFileImageFromMemory is available but always fails diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 341a70b..a3a64a9 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -1062,6 +1062,10 @@ MacOSXGetLibraryPath( foundInFramework = Tcl_MacOSXOpenVersionedBundleResources(interp, "com.tcltk.tcllibrary", TCL_FRAMEWORK_VERSION, 0, maxPathLen, tclLibPath); +#else + (void)interp; + (void)maxPathLen; + (void)tclLibPath; #endif return foundInFramework; diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index c061a78..993ee95 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -334,8 +334,10 @@ Tcl_GetHostName(void) int TclpHasSockets( - Tcl_Interp *interp) /* Not used. */ + Tcl_Interp *dummy) /* Not used. */ { + (void)dummy; + return TCL_OK; } @@ -621,11 +623,12 @@ TcpOutputProc( static int TcpCloseProc( void *instanceData, /* The socket to close. */ - Tcl_Interp *interp) /* For error reporting - unused. */ + Tcl_Interp *dummy) /* For error reporting - unused. */ { TcpState *statePtr = (TcpState *)instanceData; int errorCode = 0; TcpFdList *fds; + (void)dummy; /* * Delete a file handler that may be active for this socket if this is a @@ -1116,6 +1119,7 @@ TcpGetHandleProc( void **handlePtr) /* Where to store the handle. */ { TcpState *statePtr = (TcpState *)instanceData; + (void)direction; *handlePtr = INT2PTR(statePtr->fds.fd); return TCL_OK; @@ -1140,6 +1144,8 @@ TcpAsyncCallback( * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ { + (void)mask; + TcpConnect(NULL, (TcpState *)clientData); } @@ -1779,6 +1785,7 @@ TcpAccept( socklen_t len; /* For accept interface */ char channelName[SOCK_CHAN_LENGTH]; char host[NI_MAXHOST], port[NI_MAXSERV]; + (void)mask; len = sizeof(addr); newsock = accept(fds->fd, &addr.sa, &len); diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index eb91ba1..7b0719e 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -138,7 +138,7 @@ TclplatformtestInit( static int TestfilehandlerCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -148,6 +148,7 @@ TestfilehandlerCmd( static int initialized = 0; char buffer[4000]; TclFile file; + (void)dummy; /* * NOTE: When we make this code work on Windows also, the following @@ -360,7 +361,7 @@ TestFileHandlerProc( static int TestfilewaitCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -369,6 +370,7 @@ TestfilewaitCmd( Tcl_Channel channel; int fd; ClientData data; + (void)dummy; if (argc != 4) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], @@ -429,12 +431,13 @@ TestfilewaitCmd( static int TestfindexecutableCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { Tcl_Obj *saveName; + (void)dummy; if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], @@ -472,12 +475,13 @@ TestfindexecutableCmd( static int TestgetopenfileCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { ClientData filePtr; + (void)dummy; if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -515,11 +519,13 @@ TestgetopenfileCmd( static int TestsetencpathObjCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ { + (void)dummy; + if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "defaultDir"); return TCL_ERROR; @@ -548,12 +554,13 @@ TestsetencpathObjCmd( static int TestforkObjCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ { pid_t pid; + (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); @@ -593,11 +600,13 @@ TestforkObjCmd( static int TestgetencpathObjCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ { + (void)dummy; + if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; @@ -627,7 +636,7 @@ TestgetencpathObjCmd( static int TestalarmCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -635,6 +644,7 @@ TestalarmCmd( #ifdef SA_RESTART unsigned int sec; struct sigaction action; + (void)dummy; if (argc > 1) { Tcl_GetInt(interp, argv[1], (int *)&sec); @@ -658,6 +668,8 @@ TestalarmCmd( (void) alarm(sec); return TCL_OK; #else + (void)dummy; + Tcl_AppendResult(interp, "warning: sigaction SA_RESTART not support on this platform", NULL); @@ -685,6 +697,8 @@ static void AlarmHandler( int signum) { + (void)signum; + gotsig = "1"; } @@ -706,11 +720,15 @@ AlarmHandler( static int TestgotsigCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { + (void)dummy; + (void)argc; + (void)argv; + Tcl_AppendResult(interp, gotsig, NULL); gotsig = "0"; return TCL_OK; @@ -743,6 +761,7 @@ TestchmodCmd( Tcl_Obj *const *objv) /* Argument strings. */ { int i, mode; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "mode file ?file ...?"); diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index fb0b5e1..fb649d2 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -511,6 +511,8 @@ NativeScaleTime( Tcl_Time *timePtr, ClientData clientData) { + (void)timePtr; + (void)clientData; /* Native scale is 1:1. Nothing is done */ } @@ -534,9 +536,10 @@ NativeScaleTime( static void NativeGetTime( Tcl_Time *timePtr, - ClientData clientData) + ClientData dummy) { struct timeval tv; + (void)dummy; (void) gettimeofday(&tv, NULL); timePtr->sec = tv.tv_sec; -- cgit v0.12 From 650605595407701981f6662028e353accea5d38c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Sep 2019 20:51:06 +0000 Subject: (experiment) Allow C++ symbols to be found in loaded extensions --- unix/tclLoadDl.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index 412c73f..73a44f2 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -188,6 +188,23 @@ FindSymbol( proc = dlsym(handle, native); /* INTL: Native. */ Tcl_DStringFree(&newName); } +#ifdef __cplusplus + if (proc == NULL) { + char buf[32]; + sprintf(buf, "%d", Tcl_DStringLength(&ds)); + Tcl_DStringInit(&newName); + TclDStringAppendLiteral(&newName, "__Z"); + Tcl_DStringAppend(&newName, buf, -1); + Tcl_DStringAppend(&newName, Tcl_DStringValue(&ds), -1); + TclDStringAppendLiteral(&newName, "P10Tcl_Interp"); + native = Tcl_DStringValue(&newName); + proc = dlsym(handle, native + 1); /* INTL: Native. */ + if (proc == NULL) { + proc = dlsym(handle, native); /* INTL: Native. */ + } + Tcl_DStringFree(&newName); + } +#endif Tcl_DStringFree(&ds); if (proc == NULL) { const char *errorStr = dlerror(); -- cgit v0.12 From ed985943f3df9f3ed7b6cc8130c0e67cece08dfd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Sep 2019 21:19:59 +0000 Subject: Handle "Unload" as well --- unix/tclLoadDl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index 73a44f2..0fef500 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -202,6 +202,14 @@ FindSymbol( if (proc == NULL) { proc = dlsym(handle, native); /* INTL: Native. */ } + if (proc == NULL) { + TclDStringAppendLiteral(&newName, "i"); + native = Tcl_DStringValue(&newName); + proc = dlsym(handle, native + 1); /* INTL: Native. */ + } + if (proc == NULL) { + proc = dlsym(handle, native); /* INTL: Native. */ + } Tcl_DStringFree(&newName); } #endif -- cgit v0.12 From 2cd19c4e6bde78b2754deda187fec816a7c8283f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Sep 2019 22:08:23 +0000 Subject: Bring back Tcl_UntraceVar --- generic/tclEvent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 91bc995..d5a3776 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1475,10 +1475,10 @@ VwaitVarProc( int *donePtr = (int *)clientData; (void)dummy; (void)flags; - (void)name1; - (void)name2; *donePtr = 1; + Tcl_UntraceVar2(interp, name1, name2, TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + VwaitVarProc, clientData); return NULL; } -- cgit v0.12 From 2d7fb3bc20951567f5cd26584fb146ea5c271cc2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Sep 2019 22:11:48 +0000 Subject: interp is not dummy any-more --- generic/tclEvent.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index d5a3776..56d5ce5 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1467,13 +1467,12 @@ Tcl_VwaitObjCmd( static char * VwaitVarProc( void *clientData, /* Pointer to integer to set to 1. */ - Tcl_Interp *dummy, /* Interpreter containing variable. */ + Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { int *donePtr = (int *)clientData; - (void)dummy; (void)flags; *donePtr = 1; -- cgit v0.12 From 0ff016021c022c1f60500a200461fee9721b97e1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 18 Sep 2019 09:33:43 +0000 Subject: Make less dependent on UNICODE definition --- generic/tclTest.c | 3 +-- generic/tclTestObj.c | 2 +- win/tclWinDde.c | 76 +++++++++++++++++++++++++++------------------------- win/tclWinReg.c | 43 +++++++++++++++-------------- 4 files changed, 64 insertions(+), 60 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index 008a521..91ceaa6 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -3523,8 +3523,6 @@ TestlocaleCmd( { int index; const char *locale; - (void)dummy; - static const char *const optionStrings[] = { "ctype", "numeric", "time", "collate", "monetary", "all", NULL @@ -3533,6 +3531,7 @@ TestlocaleCmd( LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_ALL }; + (void)dummy; /* * LC_CTYPE, etc. correspond to the indices for the strings. diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index 6dce6a3..a54a06f 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -574,7 +574,6 @@ TestindexobjCmd( int allowAbbrev, index, index2, setError, i, result; const char **argv; static const char *const tablePtr[] = {"a", "b", "check", NULL}; - (void)dummy; /* * Keep this structure declaration in sync with tclIndexObj.c @@ -585,6 +584,7 @@ TestindexobjCmd( int index; /* Selected index into table. */ }; struct IndexRep *indexRep; + (void)dummy; if ((objc == 3) && (strcmp(Tcl_GetString(objv[1]), "check") == 0)) { diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 3fe855f..1eded82 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -11,8 +11,6 @@ */ #undef STATIC_BUILD -#undef TCL_UTF_MAX -#define TCL_UTF_MAX 3 #ifndef USE_TCL_STUBS # define USE_TCL_STUBS #endif @@ -83,8 +81,8 @@ static int ddeIsServer = 0; #define TCL_DDE_VERSION "1.4.1" #define TCL_DDE_PACKAGE_NAME "dde" -#define TCL_DDE_SERVICE_NAME TEXT("TclEval") -#define TCL_DDE_EXECUTE_RESULT TEXT("$TCLEVAL$EXECUTE$RESULT") +#define TCL_DDE_SERVICE_NAME L"TclEval" +#define TCL_DDE_EXECUTE_RESULT L"$TCLEVAL$EXECUTE$RESULT" #define DDE_FLAG_ASYNC 1 #define DDE_FLAG_BINARY 2 @@ -120,8 +118,13 @@ static int DdeObjCmd(void *clientData, Tcl_Obj *const objv[]); #if (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7) +# if TCL_UTF_MAX > 3 +# define Tcl_WCharToUtfDString(a,b,c) Tcl_WinTCharToUtf(a,(b)*sizeof(WCHAR),c) +# define Tcl_UtfToWCharDString(a,b,c) Tcl_WinUtfToTChar(a,b,c) +# else # define Tcl_WCharToUtfDString Tcl_UniCharToUtfDString # define Tcl_UtfToWCharDString Tcl_UtfToUniCharDString +# endif #endif static unsigned char * @@ -261,7 +264,7 @@ Initialize(void) if ((ddeServiceGlobal == 0) && (nameFound != 0)) { ddeIsServer = 1; Tcl_CreateExitHandler(DdeExitProc, NULL); - ddeServiceGlobal = DdeCreateStringHandle(ddeInstance, + ddeServiceGlobal = DdeCreateStringHandleW(ddeInstance, TCL_DDE_SERVICE_NAME, CP_WINUNICODE); DdeNameService(ddeInstance, ddeServiceGlobal, 0L, DNS_REGISTER); } else { @@ -347,7 +350,7 @@ DdeSetServerName( * current interp, but it doesn't have a name. */ - return TEXT(""); + return L""; } /* @@ -369,7 +372,7 @@ DdeSetServerName( } if (r != TCL_OK) { Tcl_DStringInit(&dString); - OutputDebugString(Tcl_UtfToWCharDString(Tcl_GetString(Tcl_GetObjResult(interp)), -1, &dString)); + OutputDebugStringW(Tcl_UtfToWCharDString(Tcl_GetString(Tcl_GetObjResult(interp)), -1, &dString)); Tcl_DStringFree(&dString); return NULL; } @@ -388,13 +391,13 @@ DdeSetServerName( if (suffix > 1) { if (suffix == 2) { Tcl_DStringAppend(&dString, (char *)name, wcslen(name) * sizeof(WCHAR)); - Tcl_DStringAppend(&dString, (char *)TEXT(" #"), 2 * sizeof(WCHAR)); + Tcl_DStringAppend(&dString, (char *)L" #", 2 * sizeof(WCHAR)); offset = Tcl_DStringLength(&dString); Tcl_DStringSetLength(&dString, offset + sizeof(WCHAR) * TCL_INTEGER_SPACE); actualName = (WCHAR *) Tcl_DStringValue(&dString); } _snwprintf((WCHAR *) (Tcl_DStringValue(&dString) + offset), - TCL_INTEGER_SPACE, TEXT("%d"), suffix); + TCL_INTEGER_SPACE, L"%d", suffix); } /* @@ -503,8 +506,7 @@ DdeGetRegistrationPtr( static void DeleteProc( - void *clientData) /* The interp we are deleting passed as - * ClientData. */ + void *clientData) /* The interp we are deleting. */ { RegisteredInterp *riPtr = (RegisteredInterp *) clientData; RegisteredInterp *searchPtr, *prevPtr; @@ -663,11 +665,11 @@ DdeServerProc( * sure we have a valid topic. */ - len = DdeQueryString(ddeInstance, ddeTopic, NULL, 0, CP_WINUNICODE); + len = DdeQueryStringW(ddeInstance, ddeTopic, NULL, 0, CP_WINUNICODE); Tcl_DStringInit(&dString); Tcl_DStringSetLength(&dString, (len + 1) * sizeof(WCHAR) - 1); utilString = (WCHAR *) Tcl_DStringValue(&dString); - DdeQueryString(ddeInstance, ddeTopic, utilString, (DWORD) len + 1, + DdeQueryStringW(ddeInstance, ddeTopic, utilString, (DWORD) len + 1, CP_WINUNICODE); for (riPtr = tsdPtr->interpListPtr; riPtr != NULL; @@ -688,11 +690,11 @@ DdeServerProc( * result to return in an XTYP_REQUEST. */ - len = DdeQueryString(ddeInstance, ddeTopic, NULL, 0, CP_WINUNICODE); + len = DdeQueryStringW(ddeInstance, ddeTopic, NULL, 0, CP_WINUNICODE); Tcl_DStringInit(&dString); Tcl_DStringSetLength(&dString, (len + 1) * sizeof(WCHAR) - 1); utilString = (WCHAR *) Tcl_DStringValue(&dString); - DdeQueryString(ddeInstance, ddeTopic, utilString, (DWORD) len + 1, + DdeQueryStringW(ddeInstance, ddeTopic, utilString, (DWORD) len + 1, CP_WINUNICODE); for (riPtr = tsdPtr->interpListPtr; riPtr != NULL; riPtr = riPtr->nextPtr) { @@ -756,12 +758,12 @@ DdeServerProc( Tcl_DString dsBuf; char *returnString; - len = DdeQueryString(ddeInstance, ddeItem, NULL, 0, CP_WINUNICODE); + len = DdeQueryStringW(ddeInstance, ddeItem, NULL, 0, CP_WINUNICODE); Tcl_DStringInit(&dString); Tcl_DStringInit(&dsBuf); Tcl_DStringSetLength(&dString, (len + 1) * sizeof(WCHAR) - 1); utilString = (WCHAR *) Tcl_DStringValue(&dString); - DdeQueryString(ddeInstance, ddeItem, utilString, (DWORD) len + 1, + DdeQueryStringW(ddeInstance, ddeItem, utilString, (DWORD) len + 1, CP_WINUNICODE); if (_wcsicmp(utilString, TCL_DDE_EXECUTE_RESULT) == 0) { returnString = @@ -836,10 +838,10 @@ DdeServerProc( Tcl_DStringInit(&dString); Tcl_DStringInit(&ds2); - len = DdeQueryString(ddeInstance, ddeItem, NULL, 0, CP_WINUNICODE); + len = DdeQueryStringW(ddeInstance, ddeItem, NULL, 0, CP_WINUNICODE); Tcl_DStringSetLength(&dString, (len + 1) * sizeof(WCHAR) - 1); utilString = (WCHAR *) Tcl_DStringValue(&dString); - DdeQueryString(ddeInstance, ddeItem, utilString, (DWORD) len + 1, + DdeQueryStringW(ddeInstance, ddeItem, utilString, (DWORD) len + 1, CP_WINUNICODE); Tcl_DStringInit(&ds); Tcl_WCharToUtfDString(utilString, wcslen(utilString), &ds); @@ -954,9 +956,9 @@ DdeServerProc( len = dlen; for (i = 0, riPtr = tsdPtr->interpListPtr; i < numItems; i++, riPtr = riPtr->nextPtr) { - returnPtr[i].hszSvc = DdeCreateStringHandle(ddeInstance, + returnPtr[i].hszSvc = DdeCreateStringHandleW(ddeInstance, TCL_DDE_SERVICE_NAME, CP_WINUNICODE); - returnPtr[i].hszTopic = DdeCreateStringHandle(ddeInstance, + returnPtr[i].hszTopic = DdeCreateStringHandleW(ddeInstance, riPtr->name, CP_WINUNICODE); } returnPtr[i].hszSvc = NULL; @@ -1022,8 +1024,8 @@ MakeDdeConnection( HSZ ddeTopic, ddeService; HCONV ddeConv; - ddeService = DdeCreateStringHandle(ddeInstance, TCL_DDE_SERVICE_NAME, CP_WINUNICODE); - ddeTopic = DdeCreateStringHandle(ddeInstance, name, CP_WINUNICODE); + ddeService = DdeCreateStringHandleW(ddeInstance, TCL_DDE_SERVICE_NAME, CP_WINUNICODE); + ddeTopic = DdeCreateStringHandleW(ddeInstance, name, CP_WINUNICODE); ddeConv = DdeConnect(ddeInstance, ddeService, ddeTopic, NULL); DdeFreeStringHandle(ddeInstance, ddeService); @@ -1071,9 +1073,9 @@ static int DdeCreateClient( DdeEnumServices *es) { - WNDCLASSEX wc; - static const WCHAR *szDdeClientClassName = TEXT("TclEval client class"); - static const WCHAR *szDdeClientWindowName = TEXT("TclEval client window"); + WNDCLASSEXW wc; + static const WCHAR *szDdeClientClassName = L"TclEval client class"; + static const WCHAR *szDdeClientWindowName = L"TclEval client window"; memset(&wc, 0, sizeof(wc)); wc.cbSize = sizeof(wc); @@ -1085,8 +1087,8 @@ DdeCreateClient( * Register and create the callback window. */ - RegisterClassEx(&wc); - es->hwnd = CreateWindowEx(0, szDdeClientClassName, szDdeClientWindowName, + RegisterClassExW(&wc); + es->hwnd = CreateWindowExW(0, szDdeClientClassName, szDdeClientWindowName, WS_POPUP, 0, 0, 0, 0, NULL, NULL, NULL, (LPVOID)es); return TCL_OK; } @@ -1142,12 +1144,12 @@ DdeServicesOnAck( Tcl_Obj *matchPtr = Tcl_NewListObj(0, NULL); Tcl_Obj *resultPtr = Tcl_GetObjResult(es->interp); - GlobalGetAtomName(service, sz, 255); + GlobalGetAtomNameW(service, sz, 255); Tcl_DStringInit(&dString); Tcl_WCharToUtfDString(sz, wcslen(sz), &dString); Tcl_ListObjAppendElement(NULL, matchPtr, Tcl_NewStringObj(Tcl_DStringValue(&dString), -1)); Tcl_DStringFree(&dString); - GlobalGetAtomName(topic, sz, 255); + GlobalGetAtomNameW(topic, sz, 255); Tcl_DStringInit(&dString); Tcl_WCharToUtfDString(sz, wcslen(sz), &dString); Tcl_ListObjAppendElement(NULL, matchPtr, Tcl_NewStringObj(Tcl_DStringValue(&dString), -1)); @@ -1206,8 +1208,8 @@ DdeGetServicesList( es.interp = interp; es.result = TCL_OK; es.service = (serviceName == NULL) - ? (ATOM)0 : GlobalAddAtom(serviceName); - es.topic = (topicName == NULL) ? (ATOM)0 : GlobalAddAtom(topicName); + ? (ATOM)0 : GlobalAddAtomW(serviceName); + es.topic = (topicName == NULL) ? (ATOM)0 : GlobalAddAtomW(topicName); Tcl_ResetResult(interp); /* our list is to be appended to result. */ DdeCreateClient(&es); @@ -1500,7 +1502,7 @@ DdeObjCmd( if (length == 0) { serviceName = NULL; } else if ((index != DDE_SERVERNAME) && (index != DDE_EVAL)) { - ddeService = DdeCreateStringHandle(ddeInstance, serviceName, + ddeService = DdeCreateStringHandleW(ddeInstance, serviceName, CP_WINUNICODE); } @@ -1514,7 +1516,7 @@ DdeObjCmd( if (length == 0) { topicName = NULL; } else { - ddeTopic = DdeCreateStringHandle(ddeInstance, topicName, + ddeTopic = DdeCreateStringHandleW(ddeInstance, topicName, CP_WINUNICODE); } } @@ -1624,7 +1626,7 @@ DdeObjCmd( result = TCL_ERROR; } else { Tcl_Obj *returnObjPtr; - ddeItem = DdeCreateStringHandle(ddeInstance, itemString, + ddeItem = DdeCreateStringHandleW(ddeInstance, itemString, CP_WINUNICODE); if (ddeItem != NULL) { ddeData = DdeClientTransaction(NULL, 0, hConv, ddeItem, @@ -1704,7 +1706,7 @@ DdeObjCmd( SetDdeError(interp); result = TCL_ERROR; } else { - ddeItem = DdeCreateStringHandle(ddeInstance, itemString, + ddeItem = DdeCreateStringHandleW(ddeInstance, itemString, CP_WINUNICODE); if (ddeItem != NULL) { ddeData = DdeClientTransaction(dataString, (DWORD) length, @@ -1873,7 +1875,7 @@ DdeObjCmd( 0xFFFFFFFF, hConv, 0, CF_UNICODETEXT, XTYP_EXECUTE, 30000, NULL); if (ddeData != 0) { - ddeCookie = DdeCreateStringHandle(ddeInstance, + ddeCookie = DdeCreateStringHandleW(ddeInstance, TCL_DDE_EXECUTE_RESULT, CP_WINUNICODE); ddeData = DdeClientTransaction(NULL, 0, hConv, ddeCookie, CF_UNICODETEXT, XTYP_REQUEST, 30000, NULL); diff --git a/win/tclWinReg.c b/win/tclWinReg.c index f89d120..b715209 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -13,8 +13,6 @@ */ #undef STATIC_BUILD -#undef TCL_UTF_MAX -#define TCL_UTF_MAX 3 #ifndef USE_TCL_STUBS # define USE_TCL_STUBS #endif @@ -127,8 +125,13 @@ static int SetValue(Tcl_Interp *interp, Tcl_Obj *keyNameObj, Tcl_Obj *typeObj, REGSAM mode); #if (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7) +# if TCL_UTF_MAX > 3 +# define Tcl_WCharToUtfDString(a,b,c) Tcl_WinTCharToUtf(a,(b)*sizeof(WCHAR),c) +# define Tcl_UtfToWCharDString(a,b,c) Tcl_WinUtfToTChar(a,b,c) +# else # define Tcl_WCharToUtfDString Tcl_UniCharToUtfDString # define Tcl_UtfToWCharDString Tcl_UtfToUniCharDString +# endif #endif static unsigned char * @@ -542,7 +545,7 @@ DeleteValue( valueName = Tcl_GetString(valueNameObj); Tcl_DStringInit(&ds); Tcl_UtfToWCharDString(valueName, valueNameObj->length, &ds); - result = RegDeleteValue(key, (const WCHAR *)Tcl_DStringValue(&ds)); + result = RegDeleteValueW(key, (const WCHAR *)Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); if (result != ERROR_SUCCESS) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -616,7 +619,7 @@ GetKeyNames( resultPtr = Tcl_NewObj(); for (index = 0;; ++index) { bufSize = MAX_KEY_LENGTH; - result = RegEnumKeyEx(key, index, buffer, &bufSize, + result = RegEnumKeyExW(key, index, buffer, &bufSize, NULL, NULL, NULL, NULL); if (result != ERROR_SUCCESS) { if (result == ERROR_NO_MORE_ITEMS) { @@ -699,7 +702,7 @@ GetType( valueName = Tcl_GetString(valueNameObj); Tcl_DStringInit(&ds); nativeValue = Tcl_UtfToWCharDString(valueName, valueNameObj->length, &ds); - result = RegQueryValueEx(key, nativeValue, NULL, &type, + result = RegQueryValueExW(key, nativeValue, NULL, &type, NULL, NULL); Tcl_DStringFree(&ds); RegCloseKey(key); @@ -782,7 +785,7 @@ GetValue( Tcl_DStringInit(&buf); nativeValue = Tcl_UtfToWCharDString(valueName, valueNameObj->length, &buf); - result = RegQueryValueEx(key, nativeValue, NULL, &type, + result = RegQueryValueExW(key, nativeValue, NULL, &type, (BYTE *) Tcl_DStringValue(&data), &length); while (result == ERROR_MORE_DATA) { /* @@ -793,7 +796,7 @@ GetValue( length = Tcl_DStringLength(&data) * (2 / sizeof(WCHAR)); Tcl_DStringSetLength(&data, (int) length * sizeof(WCHAR)); - result = RegQueryValueEx(key, nativeValue, + result = RegQueryValueExW(key, nativeValue, NULL, &type, (BYTE *) Tcl_DStringValue(&data), &length); } Tcl_DStringFree(&buf); @@ -919,7 +922,7 @@ GetValueNames( */ size = MAX_KEY_LENGTH; - while (RegEnumValue(key,index, (WCHAR *)Tcl_DStringValue(&buffer), + while (RegEnumValueW(key,index, (WCHAR *)Tcl_DStringValue(&buffer), &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { Tcl_DStringInit(&ds); @@ -1031,7 +1034,7 @@ OpenSubKey( if (hostName) { Tcl_DStringInit(&buf); hostName = (char *) Tcl_UtfToWCharDString(hostName, -1, &buf); - result = RegConnectRegistry((WCHAR *)hostName, rootKey, + result = RegConnectRegistryW((WCHAR *)hostName, rootKey, &rootKey); Tcl_DStringFree(&buf); if (result != ERROR_SUCCESS) { @@ -1051,7 +1054,7 @@ OpenSubKey( if (flags & REG_CREATE) { DWORD create; - result = RegCreateKeyEx(rootKey, (WCHAR *)keyName, 0, NULL, + result = RegCreateKeyExW(rootKey, (WCHAR *)keyName, 0, NULL, REG_OPTION_NON_VOLATILE, mode, NULL, keyPtr, &create); } else if (rootKey == HKEY_PERFORMANCE_DATA) { /* @@ -1062,7 +1065,7 @@ OpenSubKey( *keyPtr = HKEY_PERFORMANCE_DATA; result = ERROR_SUCCESS; } else { - result = RegOpenKeyEx(rootKey, (WCHAR *)keyName, 0, mode, + result = RegOpenKeyExW(rootKey, (WCHAR *)keyName, 0, mode, keyPtr); } if (keyName) { @@ -1202,7 +1205,7 @@ RecursiveDeleteKey( } mode |= KEY_ENUMERATE_SUB_KEYS | DELETE | KEY_QUERY_VALUE; - result = RegOpenKeyEx(startKey, keyName, 0, mode, &hKey); + result = RegOpenKeyExW(startKey, keyName, 0, mode, &hKey); if (result != ERROR_SUCCESS) { return result; } @@ -1217,7 +1220,7 @@ RecursiveDeleteKey( */ size = MAX_KEY_LENGTH; - result = RegEnumKeyEx(hKey, 0, (WCHAR *)Tcl_DStringValue(&subkey), + result = RegEnumKeyExW(hKey, 0, (WCHAR *)Tcl_DStringValue(&subkey), &size, NULL, NULL, NULL, NULL); if (result == ERROR_NO_MORE_ITEMS) { /* @@ -1230,14 +1233,14 @@ RecursiveDeleteKey( HMODULE handle; checkExProc = 1; - handle = GetModuleHandle(TEXT("ADVAPI32")); + handle = GetModuleHandleW(L"ADVAPI32"); regDeleteKeyExProc = (LSTATUS (*) (HKEY, LPCWSTR, REGSAM, DWORD)) GetProcAddress(handle, "RegDeleteKeyExW"); } if (mode && regDeleteKeyExProc) { result = regDeleteKeyExProc(startKey, keyName, mode, 0); } else { - result = RegDeleteKey(startKey, keyName); + result = RegDeleteKeyW(startKey, keyName); } break; } else if (result == ERROR_SUCCESS) { @@ -1311,7 +1314,7 @@ SetValue( } value = ConvertDWORD((DWORD) type, (DWORD) value); - result = RegSetValueEx(key, (WCHAR *) valueName, 0, + result = RegSetValueExW(key, (WCHAR *) valueName, 0, (DWORD) type, (BYTE *) &value, sizeof(DWORD)); } else if (type == REG_MULTI_SZ) { Tcl_DString data, buf; @@ -1346,7 +1349,7 @@ SetValue( Tcl_DStringInit(&buf); Tcl_UtfToWCharDString(Tcl_DStringValue(&data), Tcl_DStringLength(&data)+1, &buf); - result = RegSetValueEx(key, (WCHAR *) valueName, 0, + result = RegSetValueExW(key, (WCHAR *) valueName, 0, (DWORD) type, (BYTE *) Tcl_DStringValue(&buf), (DWORD) Tcl_DStringLength(&buf)); Tcl_DStringFree(&data); @@ -1364,7 +1367,7 @@ SetValue( Tcl_DStringSetLength(&buf, Tcl_DStringLength(&buf)+1); - result = RegSetValueEx(key, (WCHAR *) valueName, 0, + result = RegSetValueExW(key, (WCHAR *) valueName, 0, (DWORD) type, (BYTE *) data, (DWORD) Tcl_DStringLength(&buf) + 1); Tcl_DStringFree(&buf); } else { @@ -1376,7 +1379,7 @@ SetValue( */ data = (BYTE *) getByteArrayFromObj(dataObj, &bytelength); - result = RegSetValueEx(key, (WCHAR *) valueName, 0, + result = RegSetValueExW(key, (WCHAR *) valueName, 0, (DWORD) type, data, (DWORD) bytelength); } @@ -1490,7 +1493,7 @@ AppendSystemError( if (Tcl_IsShared(resultPtr)) { resultPtr = Tcl_DuplicateObj(resultPtr); } - length = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM + length = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *) tMsgPtrPtr, 0, NULL); -- cgit v0.12 From 865ea5e678412f23106c8374c3113169e35439f9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 20 Sep 2019 13:53:39 +0000 Subject: More Win32 API impovals. --- generic/tclZipfs.c | 7 ++++++- win/tclWinConsole.c | 4 ++-- win/tclWinDde.c | 16 ++++++++-------- win/tclWinFile.c | 2 +- win/tclWinPipe.c | 2 +- win/tclWinReg.c | 2 +- win/tclWinSock.c | 16 ++++++++-------- 7 files changed, 27 insertions(+), 22 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index e0d08a7..2467588 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -1161,7 +1161,7 @@ ZipFSOpenArchive( ZIPFS_POSIX_ERROR(interp, "invalid file size"); goto error; } - zf->mountHandle = CreateFileMapping((HANDLE) handle, 0, PAGE_READONLY, + zf->mountHandle = CreateFileMappingW((HANDLE) handle, 0, PAGE_READONLY, 0, zf->length, 0); if (zf->mountHandle == INVALID_HANDLE_VALUE) { ZIPFS_POSIX_ERROR(interp, "file mapping failed"); @@ -4926,7 +4926,12 @@ TclZipfs_AppHook( { char *archive; +#ifdef _WIN32 + (void)argvPtr; + Tcl_FindExecutable(NULL); +#else Tcl_FindExecutable((*argvPtr)[0]); +#endif archive = (char *) Tcl_GetNameOfExecutable(); TclZipfs_Init(NULL); diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index e7b87a7..dbec52b 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -229,7 +229,7 @@ ReadConsoleBytes( * will run and take whatever action it deems appropriate. */ do { - result = ReadConsole(hConsole, lpBuffer, nbytes / sizeof(WCHAR), &ntchars, + result = ReadConsoleW(hConsole, lpBuffer, nbytes / sizeof(WCHAR), &ntchars, NULL); } while (result && ntchars == 0 && GetLastError() == ERROR_OPERATION_ABORTED); if (nbytesread != NULL) { @@ -248,7 +248,7 @@ WriteConsoleBytes( DWORD ntchars; BOOL result; - result = WriteConsole(hConsole, lpBuffer, nbytes / sizeof(WCHAR), &ntchars, + result = WriteConsoleW(hConsole, lpBuffer, nbytes / sizeof(WCHAR), &ntchars, NULL); if (nbyteswritten != NULL) { *nbyteswritten = ntchars * sizeof(WCHAR); diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 1eded82..6fa9cc2 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -251,7 +251,7 @@ Initialize(void) if (ddeInstance == 0) { Tcl_MutexLock(&ddeMutex); if (ddeInstance == 0) { - if (DdeInitialize(&ddeInstance, (PFNCALLBACK) DdeServerProc, + if (DdeInitializeW(&ddeInstance, (PFNCALLBACK) DdeServerProc, CBF_SKIP_REGISTRATIONS | CBF_SKIP_UNREGISTRATIONS | CBF_FAIL_POKES, 0) != DMLERR_NO_ERROR) { ddeInstance = 0; @@ -1107,16 +1107,16 @@ DdeClientWindowProc( (DdeEnumServices *) lpcs->lpCreateParams; #ifdef _WIN64 - SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) es); + SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) es); #else - SetWindowLong(hwnd, GWL_USERDATA, (LONG) es); + SetWindowLongW(hwnd, GWL_USERDATA, (LONG) es); #endif return (LRESULT) 0L; } case WM_DDE_ACK: return DdeServicesOnAck(hwnd, wParam, lParam); default: - return DefWindowProc(hwnd, uMsg, wParam, lParam); + return DefWindowProcW(hwnd, uMsg, wParam, lParam); } } @@ -1134,9 +1134,9 @@ DdeServicesOnAck( Tcl_DString dString; #ifdef _WIN64 - es = (DdeEnumServices *) GetWindowLongPtr(hwnd, GWLP_USERDATA); + es = (DdeEnumServices *) GetWindowLongPtrW(hwnd, GWLP_USERDATA); #else - es = (DdeEnumServices *) GetWindowLong(hwnd, GWL_USERDATA); + es = (DdeEnumServices *) GetWindowLongW(hwnd, GWL_USERDATA); #endif if (((es->service == (ATOM)0) || (es->service == service)) @@ -1179,7 +1179,7 @@ DdeServicesOnAck( * Tell the server we are no longer interested. */ - PostMessage(hwndRemote, WM_DDE_TERMINATE, (WPARAM)hwnd, 0L); + PostMessageW(hwndRemote, WM_DDE_TERMINATE, (WPARAM)hwnd, 0L); return 0L; } @@ -1191,7 +1191,7 @@ DdeEnumWindowsCallback( DWORD_PTR dwResult = 0; DdeEnumServices *es = (DdeEnumServices *) lParam; - SendMessageTimeout(hwndTarget, WM_DDE_INITIATE, (WPARAM)es->hwnd, + SendMessageTimeoutW(hwndTarget, WM_DDE_INITIATE, (WPARAM)es->hwnd, MAKELONG(es->service, es->topic), SMTO_ABORTIFHUNG, 1000, &dwResult); return TRUE; diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 3259ff7..0682d74 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -2207,7 +2207,7 @@ NativeDev( p = strchr(p + 1, '\\'); if (p == NULL) { /* - * Add terminating backslash to fullpath or GetVolumeInformation() + * Add terminating backslash to fullpath or GetVolumeInformationW() * won't work. */ diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index ed4bc22..26f0b3e 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1207,7 +1207,7 @@ HasConsole(void) { HANDLE handle; - handle = CreateFileA("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, + handle = CreateFileW(L"CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (handle != INVALID_HANDLE_VALUE) { diff --git a/win/tclWinReg.c b/win/tclWinReg.c index b715209..068e5d7 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -1449,7 +1449,7 @@ BroadcastValue( * Use the ignore the result. */ - result = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, + result = SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, (WPARAM) 0, (LPARAM) wstr, SMTO_ABORTIFHUNG, (UINT) timeout, &sendResult); Tcl_DStringFree(&ds); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 7a5c282..bb6c690 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -310,7 +310,7 @@ static ProcessGlobalValue hostName = */ #define SendSelectMessage(tsdPtr, message, payload) \ - SendMessage((tsdPtr)->hwnd, SOCKET_SELECT, \ + SendMessageW((tsdPtr)->hwnd, SOCKET_SELECT, \ (WPARAM) (message), (LPARAM) (payload)) @@ -501,7 +501,7 @@ TclpFinalizeSockets(void) if (tsdPtr->socketThread != NULL) { if (tsdPtr->hwnd != NULL) { - PostMessage(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0); + PostMessageW(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0); /* * Wait for the thread to exit. This ensures that we are @@ -2534,11 +2534,11 @@ InitSockets(void) tsdPtr->socketList = NULL; tsdPtr->hwnd = NULL; tsdPtr->threadId = Tcl_GetCurrentThread(); - tsdPtr->readyEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + tsdPtr->readyEvent = CreateEventW(NULL, FALSE, FALSE, NULL); if (tsdPtr->readyEvent == NULL) { goto initFailure; } - tsdPtr->socketListLock = CreateEvent(NULL, FALSE, TRUE, NULL); + tsdPtr->socketListLock = CreateEventW(NULL, FALSE, TRUE, NULL); if (tsdPtr->socketListLock == NULL) { goto initFailure; } @@ -3205,7 +3205,7 @@ SocketThread( /* * Process all messages on the socket window until WM_QUIT. This threads * exits only when instructed to do so by the call to - * PostMessage(SOCKET_TERMINATE) in TclpFinalizeSockets(). + * PostMessageW(SOCKET_TERMINATE) in TclpFinalizeSockets(). */ while (GetMessageW(&msg, NULL, 0, 0) > 0) { @@ -3256,7 +3256,7 @@ SocketProc( #ifdef _WIN64 GetWindowLongPtrW(hwnd, GWLP_USERDATA); #else - GetWindowLong(hwnd, GWL_USERDATA); + GetWindowLongW(hwnd, GWL_USERDATA); #endif switch (message) { @@ -3271,10 +3271,10 @@ SocketProc( */ #ifdef _WIN64 - SetWindowLongPtr(hwnd, GWLP_USERDATA, + SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) ((LPCREATESTRUCT)lParam)->lpCreateParams); #else - SetWindowLong(hwnd, GWL_USERDATA, + SetWindowLongW(hwnd, GWL_USERDATA, (LONG) ((LPCREATESTRUCT)lParam)->lpCreateParams); #endif break; -- cgit v0.12 From 9348f2301275b473b59425310f3ac4beb7e545c0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 6 Nov 2019 12:34:27 +0000 Subject: Fix tclScan.c, not generating a string representation any more with unsigned wideints --- generic/tcl.h | 2 +- generic/tclScan.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 5822d86..6453ed7 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -361,7 +361,7 @@ typedef long LONG; */ #if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG) -# if defined(_MSC_VER) || (defined(_WIN32) && !defined(__cplusplus)) +# if defined(_MSC_VER) || defined(_WIN32) # define TCL_WIDE_INT_TYPE __int64 # define TCL_LL_MODIFIER "I64" # if defined(_WIN64) diff --git a/generic/tclScan.c b/generic/tclScan.c index 67138e6..24b4374 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -934,8 +934,9 @@ Tcl_ScanObjCmd( } } if ((flags & SCAN_UNSIGNED) && (wideValue < 0)) { - sprintf(buf, "%" TCL_LL_MODIFIER "u", wideValue); - Tcl_SetStringObj(objPtr, buf, -1); + mp_int big; + TclBNInitBignumFromWideUInt(&big, (Tcl_WideUInt)wideValue); + Tcl_SetBignumObj(objPtr, &big); } else { TclSetIntObj(objPtr, wideValue); } -- cgit v0.12 From 368faf4c43d67c935838001b500d1d8f8eea8f22 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 12 Dec 2019 13:11:09 +0000 Subject: Update win/tcl.m4, for use with C++ --- win/configure | 15 ++++++++++++--- win/tcl.m4 | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/win/configure b/win/configure index 71bbdeb..5a7fbea 100755 --- a/win/configure +++ b/win/configure @@ -3973,14 +3973,14 @@ $as_echo "$ac_cv_cross" >&6; } if test "$ac_cv_cross" = "yes"; then case "$do64bit" in amd64|x64|yes) - CC="x86_64-w64-mingw32-gcc" + CC="x86_64-w64-mingw32-${CC}" LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; *) - CC="i686-w64-mingw32-gcc" + CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" AR="i686-w64-mingw32-ar" RANLIB="i686-w64-mingw32-ranlib" @@ -4214,10 +4214,19 @@ $as_echo "using shared flags" >&6; } CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith -Wunused-parameter" + CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wpointer-arith -Wunused-parameter" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= + case "${CC}" in + *++) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" + ;; + *) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement" + ;; + esac + # Specify the CC output file names based on the target name CC_OBJNAME="-o \$@" CC_EXENAME="-o \$@" diff --git a/win/tcl.m4 b/win/tcl.m4 index 37f3bab..59dd673 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -541,14 +541,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ if test "$ac_cv_cross" = "yes"; then case "$do64bit" in amd64|x64|yes) - CC="x86_64-w64-mingw32-gcc" + CC="x86_64-w64-mingw32-${CC}" LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; *) - CC="i686-w64-mingw32-gcc" + CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" AR="i686-w64-mingw32-ar" RANLIB="i686-w64-mingw32-ranlib" @@ -685,10 +685,19 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith -Wunused-parameter" + CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wpointer-arith -Wunused-parameter" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= + case "${CC}" in + *++) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" + ;; + *) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement" + ;; + esac + # Specify the CC output file names based on the target name CC_OBJNAME="-o \[$]@" CC_EXENAME="-o \[$]@" -- cgit v0.12 From bb09dba8c07eb42beccc0249f53dc2ca25bb01ed Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 20 Dec 2019 16:11:54 +0000 Subject: Fix 2 unused arguments with USE_DTRACE --- generic/tclBasic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index f58cec0..2169b9d 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -8828,10 +8828,12 @@ DTraceObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)dummy; + (void)interp; + if (TCL_DTRACE_TCL_PROBE_ENABLED()) { char *a[10]; int i = 0; - (void)dummy; while (i++ < 10) { a[i-1] = i < objc ? TclGetString(objv[i]) : NULL; -- cgit v0.12 From f85de8a933413038cc1f868fb450de8daa02e676 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 29 Jan 2020 15:52:02 +0000 Subject: Deprecate channel types 1-4 --- generic/tcl.decls | 2 +- generic/tcl.h | 10 +++++ generic/tclDecls.h | 10 ++++- generic/tclIO.c | 119 ++++++++++++++++++++++++++++---------------------- generic/tclIOGT.c | 55 ++++++++++++++--------- generic/tclIORChan.c | 2 + generic/tclIORTrans.c | 39 ++++++++++++----- generic/tclStubInit.c | 1 + 8 files changed, 151 insertions(+), 87 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index c9488bc..8a88a04 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -1431,7 +1431,7 @@ declare 404 { Tcl_DriverOutputProc *Tcl_ChannelOutputProc( const Tcl_ChannelType *chanTypePtr) } -declare 405 { +declare 405 {deprecated {Use Tcl_ChannelWideSeekProc}} { Tcl_DriverSeekProc *Tcl_ChannelSeekProc( const Tcl_ChannelType *chanTypePtr) } diff --git a/generic/tcl.h b/generic/tcl.h index 85e52f4..2639d84 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -1400,10 +1400,12 @@ typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, ClientData clientData); * Channel version tag. This was introduced in 8.3.2/8.4. */ +#ifndef TCL_NO_DEPRECATED #define TCL_CHANNEL_VERSION_1 ((Tcl_ChannelTypeVersion) 0x1) #define TCL_CHANNEL_VERSION_2 ((Tcl_ChannelTypeVersion) 0x2) #define TCL_CHANNEL_VERSION_3 ((Tcl_ChannelTypeVersion) 0x3) #define TCL_CHANNEL_VERSION_4 ((Tcl_ChannelTypeVersion) 0x4) +#endif #define TCL_CHANNEL_VERSION_5 ((Tcl_ChannelTypeVersion) 0x5) /* @@ -1426,8 +1428,12 @@ typedef int (Tcl_DriverInputProc) (ClientData instanceData, char *buf, int toRead, int *errorCodePtr); typedef int (Tcl_DriverOutputProc) (ClientData instanceData, const char *buf, int toWrite, int *errorCodePtr); +#ifndef TCL_NO_DEPRECATED typedef int (Tcl_DriverSeekProc) (ClientData instanceData, long offset, int mode, int *errorCodePtr); +#else +#define Tcl_DriverSeekProc Tcl_DriverWideSeekProc +#endif typedef int (Tcl_DriverSetOptionProc) (ClientData instanceData, Tcl_Interp *interp, const char *optionName, const char *value); @@ -1478,9 +1484,13 @@ typedef struct Tcl_ChannelType { /* Function to call for input on channel. */ Tcl_DriverOutputProc *outputProc; /* Function to call for output on channel. */ +#ifdef TCL_NO_DEPRECATED + void *notUsed; +#else Tcl_DriverSeekProc *seekProc; /* Function to call to seek on the channel. * May be NULL. */ +#endif Tcl_DriverSetOptionProc *setOptionProc; /* Set an option on a channel. */ Tcl_DriverGetOptionProc *getOptionProc; diff --git a/generic/tclDecls.h b/generic/tclDecls.h index c487521..f832f78 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1218,7 +1218,8 @@ EXTERN Tcl_DriverInputProc * Tcl_ChannelInputProc( EXTERN Tcl_DriverOutputProc * Tcl_ChannelOutputProc( const Tcl_ChannelType *chanTypePtr); /* 405 */ -EXTERN Tcl_DriverSeekProc * Tcl_ChannelSeekProc( +TCL_DEPRECATED("Use Tcl_ChannelWideSeekProc") +Tcl_DriverSeekProc * Tcl_ChannelSeekProc( const Tcl_ChannelType *chanTypePtr); /* 406 */ EXTERN Tcl_DriverSetOptionProc * Tcl_ChannelSetOptionProc( @@ -2359,7 +2360,7 @@ typedef struct TclStubs { Tcl_DriverClose2Proc * (*tcl_ChannelClose2Proc) (const Tcl_ChannelType *chanTypePtr); /* 402 */ Tcl_DriverInputProc * (*tcl_ChannelInputProc) (const Tcl_ChannelType *chanTypePtr); /* 403 */ Tcl_DriverOutputProc * (*tcl_ChannelOutputProc) (const Tcl_ChannelType *chanTypePtr); /* 404 */ - Tcl_DriverSeekProc * (*tcl_ChannelSeekProc) (const Tcl_ChannelType *chanTypePtr); /* 405 */ + TCL_DEPRECATED_API("Use Tcl_ChannelWideSeekProc") Tcl_DriverSeekProc * (*tcl_ChannelSeekProc) (const Tcl_ChannelType *chanTypePtr); /* 405 */ Tcl_DriverSetOptionProc * (*tcl_ChannelSetOptionProc) (const Tcl_ChannelType *chanTypePtr); /* 406 */ Tcl_DriverGetOptionProc * (*tcl_ChannelGetOptionProc) (const Tcl_ChannelType *chanTypePtr); /* 407 */ Tcl_DriverWatchProc * (*tcl_ChannelWatchProc) (const Tcl_ChannelType *chanTypePtr); /* 408 */ @@ -4171,4 +4172,9 @@ extern const TclStubs *tclStubsPtr; #define Tcl_GlobalEvalObj(interp, objPtr) \ Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL) +#ifdef TCL_NO_DEPRECATED +#undef Tcl_ChannelSeekProc +#define Tcl_ChannelSeekProc Tcl_ChannelWideSeekProc +#endif + #endif /* _TCLDECLS */ diff --git a/generic/tclIO.c b/generic/tclIO.c index 643b8f1..ad78287 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -492,18 +492,19 @@ ChanSeek( * type and non-NULL. */ - if (HaveVersion(chanPtr->typePtr, TCL_CHANNEL_VERSION_3) && - chanPtr->typePtr->wideSeekProc != NULL) { - return chanPtr->typePtr->wideSeekProc(chanPtr->instanceData, +#ifndef TCL_NO_DEPRECATED + if (!HaveVersion(chanPtr->typePtr, TCL_CHANNEL_VERSION_3) || + chanPtr->typePtr->wideSeekProc == NULL) { + if (offsetLONG_MAX) { + *errnoPtr = EOVERFLOW; + return -1; + } + return chanPtr->typePtr->seekProc(chanPtr->instanceData, offset, mode, errnoPtr); } +#endif - if (offsetLONG_MAX) { - *errnoPtr = EOVERFLOW; - return -1; - } - - return chanPtr->typePtr->seekProc(chanPtr->instanceData, + return chanPtr->typePtr->wideSeekProc(chanPtr->instanceData, offset, mode, errnoPtr); } @@ -1640,9 +1641,6 @@ Tcl_CreateChannel( if (NULL == typePtr->watchProc) { Tcl_Panic("channel type %s must define watchProc", typePtr->typeName); } - if ((NULL!=typePtr->wideSeekProc) && (NULL == typePtr->seekProc)) { - Tcl_Panic("channel type %s must define seekProc if defining wideSeekProc", typePtr->typeName); - } /* * JH: We could subsequently memset these to 0 to avoid the numerous @@ -4215,12 +4213,15 @@ WillWrite( { int inputBuffered; - if ((chanPtr->typePtr->seekProc != NULL) && - ((inputBuffered = Tcl_InputBuffered((Tcl_Channel) chanPtr)) > 0)){ - int ignore; + if (((chanPtr->typePtr->wideSeekProc != NULL) +#ifndef TCL_NO_DEPRECATED + || (chanPtr->typePtr->seekProc != NULL) +#endif + ) && ((inputBuffered = Tcl_InputBuffered((Tcl_Channel) chanPtr)) > 0)){ + int ignore; - DiscardInputQueued(chanPtr->state, 0); - ChanSeek(chanPtr, -inputBuffered, SEEK_CUR, &ignore); + DiscardInputQueued(chanPtr->state, 0); + ChanSeek(chanPtr, -inputBuffered, SEEK_CUR, &ignore); } } @@ -4237,8 +4238,11 @@ WillRead( Tcl_SetErrno(EINVAL); return -1; } - if ((chanPtr->typePtr->seekProc != NULL) - && (Tcl_OutputBuffered((Tcl_Channel) chanPtr) > 0)) { + if (((chanPtr->typePtr->wideSeekProc != NULL) +#ifndef TCL_NO_DEPRECATED + || (chanPtr->typePtr->seekProc != NULL) +#endif + ) && (Tcl_OutputBuffered((Tcl_Channel) chanPtr) > 0)) { /* * CAVEAT - The assumption here is that FlushChannel() will push out * the bytes of any writes that are in progress. Since this is a @@ -6997,7 +7001,11 @@ Tcl_Seek( * defined. This means that the channel does not support seeking. */ - if (chanPtr->typePtr->seekProc == NULL) { + if ((chanPtr->typePtr->wideSeekProc == NULL) +#ifndef TCL_NO_DEPRECATED + && (chanPtr->typePtr->seekProc == NULL) +#endif + ) { Tcl_SetErrno(EINVAL); return -1; } @@ -7161,7 +7169,11 @@ Tcl_Tell( * defined. This means that the channel does not support seeking. */ - if (chanPtr->typePtr->seekProc == NULL) { + if ((chanPtr->typePtr->wideSeekProc == NULL) +#ifndef TCL_NO_DEPRECATED + && (chanPtr->typePtr->seekProc == NULL) +#endif + ) { Tcl_SetErrno(EINVAL); return -1; } @@ -10499,22 +10511,17 @@ Tcl_ChannelVersion( const Tcl_ChannelType *chanTypePtr) /* Pointer to channel type. */ { - if (chanTypePtr->version == TCL_CHANNEL_VERSION_2) { - return TCL_CHANNEL_VERSION_2; - } else if (chanTypePtr->version == TCL_CHANNEL_VERSION_3) { - return TCL_CHANNEL_VERSION_3; - } else if (chanTypePtr->version == TCL_CHANNEL_VERSION_4) { - return TCL_CHANNEL_VERSION_4; - } else if (chanTypePtr->version == TCL_CHANNEL_VERSION_5) { - return TCL_CHANNEL_VERSION_5; - } else { +#ifndef TCL_NO_DEPRECATED + if ((chanTypePtr->version > (Tcl_ChannelTypeVersion) 0x7) + || (chanTypePtr->version < (Tcl_ChannelTypeVersion) 0x1)) { /* * In version; } /* @@ -10564,15 +10571,15 @@ Tcl_ChannelBlockModeProc( const Tcl_ChannelType *chanTypePtr) /* Pointer to channel type. */ { - if (HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_2)) { - return chanTypePtr->blockModeProc; +#ifndef TCL_NO_DEPRECATED + if (!HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_2)) { + /* + * The v1 structure had the blockModeProc in a different place. + */ + return (Tcl_DriverBlockModeProc *) chanTypePtr->version; } - - /* - * The v1 structure had the blockModeProc in a different place. - */ - - return (Tcl_DriverBlockModeProc *) chanTypePtr->version; +#endif + return chanTypePtr->blockModeProc; } /* @@ -10671,6 +10678,7 @@ Tcl_ChannelOutputProc( return chanTypePtr->outputProc; } +#ifndef TCL_NO_DEPRECATED /* *---------------------------------------------------------------------- * @@ -10694,6 +10702,7 @@ Tcl_ChannelSeekProc( { return chanTypePtr->seekProc; } +#endif /* *---------------------------------------------------------------------- @@ -10812,10 +10821,12 @@ Tcl_ChannelFlushProc( const Tcl_ChannelType *chanTypePtr) /* Pointer to channel type. */ { - if (HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_2)) { - return chanTypePtr->flushProc; +#ifndef TCL_NO_DEPRECATED + if (!HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_2)) { + return NULL; } - return NULL; +#endif + return chanTypePtr->flushProc; } /* @@ -10839,10 +10850,12 @@ Tcl_ChannelHandlerProc( const Tcl_ChannelType *chanTypePtr) /* Pointer to channel type. */ { - if (HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_2)) { - return chanTypePtr->handlerProc; +#ifndef TCL_NO_DEPRECATED + if (!HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_2)) { + return NULL; } - return NULL; +#endif + return chanTypePtr->handlerProc; } /* @@ -10866,10 +10879,12 @@ Tcl_ChannelWideSeekProc( const Tcl_ChannelType *chanTypePtr) /* Pointer to channel type. */ { - if (HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_3)) { - return chanTypePtr->wideSeekProc; +#ifndef TCL_NO_DEPRECATED + if (!HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_3)) { + return NULL; } - return NULL; +#endif + return chanTypePtr->wideSeekProc; } /* @@ -10894,10 +10909,12 @@ Tcl_ChannelThreadActionProc( const Tcl_ChannelType *chanTypePtr) /* Pointer to channel type. */ { - if (HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_4)) { - return chanTypePtr->threadActionProc; +#ifndef TCL_NO_DEPRECATED + if (!HaveVersion(chanTypePtr, TCL_CHANNEL_VERSION_4)) { + return NULL; } - return NULL; +#endif + return chanTypePtr->threadActionProc; } /* diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 9949a0e..ee180fa 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -27,8 +27,10 @@ static int TransformInputProc(ClientData instanceData, char *buf, int toRead, int *errorCodePtr); static int TransformOutputProc(ClientData instanceData, const char *buf, int toWrite, int *errorCodePtr); +#ifndef TCL_NO_DEPRECATED static int TransformSeekProc(ClientData instanceData, long offset, int mode, int *errorCodePtr); +#endif static int TransformSetOptionProc(ClientData instanceData, Tcl_Interp *interp, const char *optionName, const char *value); @@ -122,7 +124,11 @@ static const Tcl_ChannelType transformChannelType = { TransformCloseProc, /* Close proc. */ TransformInputProc, /* Input proc. */ TransformOutputProc, /* Output proc. */ +#ifndef TCL_NO_DEPRECATED TransformSeekProc, /* Seek proc. */ +#else + NULL, +#endif TransformSetOptionProc, /* Set option proc. */ TransformGetOptionProc, /* Get option proc. */ TransformWatchProc, /* Initialize notifier. */ @@ -808,6 +814,7 @@ TransformOutputProc( return toWrite; } +#ifndef TCL_NO_DEPRECATED /* *---------------------------------------------------------------------- * @@ -838,7 +845,7 @@ TransformSeekProc( TransformChannelData *dataPtr = instanceData; Tcl_Channel parent = Tcl_GetStackedChannel(dataPtr->self); const Tcl_ChannelType *parentType = Tcl_GetChannelType(parent); - Tcl_DriverSeekProc *parentSeekProc = Tcl_ChannelSeekProc(parentType); + Tcl_DriverSeekProc *parentSeekProc = parentType->seekProc; if ((offset == 0) && (mode == SEEK_CUR)) { /* @@ -874,6 +881,7 @@ TransformSeekProc( return parentSeekProc(Tcl_GetChannelInstanceData(parent), offset, mode, errorCodePtr); } +#endif /* *---------------------------------------------------------------------- @@ -905,7 +913,9 @@ TransformWideSeekProc( TransformChannelData *dataPtr = instanceData; Tcl_Channel parent = Tcl_GetStackedChannel(dataPtr->self); const Tcl_ChannelType *parentType = Tcl_GetChannelType(parent); - Tcl_DriverSeekProc *parentSeekProc = Tcl_ChannelSeekProc(parentType); +#ifndef TCL_NO_DEPRECATED + Tcl_DriverSeekProc *parentSeekProc = parentType->seekProc; +#endif Tcl_DriverWideSeekProc *parentWideSeekProc = Tcl_ChannelWideSeekProc(parentType); ClientData parentData = Tcl_GetChannelInstanceData(parent); @@ -916,11 +926,13 @@ TransformWideSeekProc( * location. Simply pass the request down. */ - if (parentWideSeekProc != NULL) { - return parentWideSeekProc(parentData, offset, mode, errorCodePtr); +#ifndef TCL_NO_DEPRECATED + if (parentWideSeekProc == NULL) { + return parentSeekProc(parentData, 0, mode, errorCodePtr); } +#endif - return parentSeekProc(parentData, 0, mode, errorCodePtr); + return parentWideSeekProc(parentData, offset, mode, errorCodePtr); } /* @@ -948,25 +960,26 @@ TransformWideSeekProc( * If we have a wide seek capability, we should stick with that. */ - if (parentWideSeekProc != NULL) { - return parentWideSeekProc(parentData, offset, mode, errorCodePtr); - } +#ifndef TCL_NO_DEPRECATED + if (parentWideSeekProc == NULL) { + /* + * We're transferring to narrow seeks at this point; this is a bit complex + * because we have to check whether the seek is possible first (i.e. + * whether we are losing information in truncating the bits of the + * offset). Luckily, there's a defined error for what happens when trying + * to go out of the representable range. + */ - /* - * We're transferring to narrow seeks at this point; this is a bit complex - * because we have to check whether the seek is possible first (i.e. - * whether we are losing information in truncating the bits of the - * offset). Luckily, there's a defined error for what happens when trying - * to go out of the representable range. - */ + if (offsetLONG_MAX) { + *errorCodePtr = EOVERFLOW; + return -1; + } - if (offsetLONG_MAX) { - *errorCodePtr = EOVERFLOW; - return -1; + return parentSeekProc(parentData, offset, + mode, errorCodePtr); } - - return parentSeekProc(parentData, offset, - mode, errorCodePtr); +#endif + return parentWideSeekProc(parentData, offset, mode, errorCodePtr); } /* diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 1d90def..99dff63 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -696,7 +696,9 @@ TclChanCreateObjCmd( clonePtr->blockModeProc = NULL; } if (!(methods & FLAG(METH_SEEK))) { +#ifndef TCL_NO_DEPRECATED clonePtr->seekProc = NULL; +#endif clonePtr->wideSeekProc = NULL; } diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 8385d88..8f6b079 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -28,8 +28,10 @@ #endif /* DUPLICATE of HaveVersion() in tclIO.c // TODO - MODULE_SCOPE */ +#ifndef TCL_NO_DEPRECATED static int HaveVersion(const Tcl_ChannelType *typePtr, Tcl_ChannelTypeVersion minimumVersion); +#endif /* * Signatures of all functions used in the C layer of the reflection. @@ -1331,14 +1333,18 @@ ReflectSeekWide( Channel *parent = (Channel *) rtPtr->parent; Tcl_WideInt curPos; /* Position on the device. */ - Tcl_DriverSeekProc *seekProc = - Tcl_ChannelSeekProc(Tcl_GetChannelType(rtPtr->parent)); + const Tcl_ChannelType *channelType = + Tcl_GetChannelType(rtPtr->parent); /* * Fail if the parent channel is not seekable. */ - if (seekProc == NULL) { + if ((channelType->wideSeekProc == NULL) +#ifndef TCL_NO_DEPRECATED + && (channelType->seekProc == NULL) +#endif + ) { Tcl_SetErrno(EINVAL); return -1; } @@ -1386,18 +1392,25 @@ ReflectSeekWide( * non-NULL... */ - if (HaveVersion(parent->typePtr, TCL_CHANNEL_VERSION_3) && - parent->typePtr->wideSeekProc != NULL) { +#ifndef TCL_NO_DEPRECATED + if (!HaveVersion(parent->typePtr, TCL_CHANNEL_VERSION_3) || + parent->typePtr->wideSeekProc == NULL) { + if (offset < LONG_MIN || offset > LONG_MAX) { + *errorCodePtr = EOVERFLOW; + curPos = -1; + } else { + curPos = parent->typePtr->seekProc( + parent->instanceData, offset, seekMode, + errorCodePtr); + } + } else { curPos = parent->typePtr->wideSeekProc(parent->instanceData, offset, seekMode, errorCodePtr); - } else if (offset < LONG_MIN || offset > LONG_MAX) { - *errorCodePtr = EOVERFLOW; - curPos = -1; - } else { - curPos = parent->typePtr->seekProc( - parent->instanceData, offset, seekMode, - errorCodePtr); } +#else + curPos = parent->typePtr->wideSeekProc(parent->instanceData, offset, + seekMode, errorCodePtr); +#endif if (curPos == -1) { Tcl_SetErrno(*errorCodePtr); } @@ -3407,6 +3420,7 @@ TransformLimit( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED static int HaveVersion( const Tcl_ChannelType *chanTypePtr, @@ -3416,6 +3430,7 @@ HaveVersion( return PTR2INT(actualVersion) >= PTR2INT(minimumVersion); } +#endif /* * Local Variables: diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 6a588a5..927f1d0 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -256,6 +256,7 @@ mp_err TclBN_mp_mul_d(const mp_int *a, unsigned int b, mp_int *c) { # define Tcl_DbNewLongObj 0 # define Tcl_BackgroundError 0 # define Tcl_FreeResult 0 +# define Tcl_ChannelSeekProc 0 #else mp_err TclBN_mp_div_3(const mp_int *a, mp_int *c, unsigned int *d) { -- cgit v0.12 From bfad7e731e065f729b1b29430eadc5599fed2221 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 31 Jan 2020 14:58:07 +0000 Subject: Make Tcl_ChannelCloseProc() deprecated too. Implement close2Proc and wideSeekProc for all internal channel types. --- generic/tcl.decls | 2 +- generic/tcl.h | 10 +------- generic/tclDecls.h | 5 ++-- generic/tclIO.c | 68 ++++++++++++++++++++++++++++++--------------------- generic/tclIOGT.c | 13 +++++++--- generic/tclIORChan.c | 13 +++++++--- generic/tclIORTrans.c | 13 +++++++--- generic/tclStubInit.c | 1 + generic/tclZipfs.c | 13 +++++++--- generic/tclZlib.c | 13 +++++++--- unix/tclUnixChan.c | 27 +++++++++++++------- unix/tclUnixSock.c | 4 +++ win/tclWinChan.c | 14 ++++++++--- win/tclWinConsole.c | 14 ++++++++--- win/tclWinSerial.c | 16 +++++++----- win/tclWinSock.c | 4 +++ 16 files changed, 147 insertions(+), 83 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 8a88a04..1e124a4 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -1415,7 +1415,7 @@ declare 400 { Tcl_DriverBlockModeProc *Tcl_ChannelBlockModeProc( const Tcl_ChannelType *chanTypePtr) } -declare 401 { +declare 401 {deprecated {Use Tcl_ChannelClose2Proc}} { Tcl_DriverCloseProc *Tcl_ChannelCloseProc( const Tcl_ChannelType *chanTypePtr) } diff --git a/generic/tcl.h b/generic/tcl.h index d8a28a5..18a56dc 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -1428,12 +1428,8 @@ typedef int (Tcl_DriverInputProc) (ClientData instanceData, char *buf, int toRead, int *errorCodePtr); typedef int (Tcl_DriverOutputProc) (ClientData instanceData, const char *buf, int toWrite, int *errorCodePtr); -#ifndef TCL_NO_DEPRECATED typedef int (Tcl_DriverSeekProc) (ClientData instanceData, long offset, int mode, int *errorCodePtr); -#else -#define Tcl_DriverSeekProc Tcl_DriverWideSeekProc -#endif typedef int (Tcl_DriverSetOptionProc) (ClientData instanceData, Tcl_Interp *interp, const char *optionName, const char *value); @@ -1478,19 +1474,15 @@ typedef struct Tcl_ChannelType { /* Version of the channel type. */ Tcl_DriverCloseProc *closeProc; /* Function to call to close the channel, or - * TCL_CLOSE2PROC if the close2Proc should be + * NULL or TCL_CLOSE2PROC if the close2Proc should be * used instead. */ Tcl_DriverInputProc *inputProc; /* Function to call for input on channel. */ Tcl_DriverOutputProc *outputProc; /* Function to call for output on channel. */ -#ifdef TCL_NO_DEPRECATED - struct something_undefined *notUsed; -#else Tcl_DriverSeekProc *seekProc; /* Function to call to seek on the channel. * May be NULL. */ -#endif Tcl_DriverSetOptionProc *setOptionProc; /* Set an option on a channel. */ Tcl_DriverGetOptionProc *getOptionProc; diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 6e9b391..6cb7547 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1206,7 +1206,8 @@ EXTERN Tcl_ChannelTypeVersion Tcl_ChannelVersion( EXTERN Tcl_DriverBlockModeProc * Tcl_ChannelBlockModeProc( const Tcl_ChannelType *chanTypePtr); /* 401 */ -EXTERN Tcl_DriverCloseProc * Tcl_ChannelCloseProc( +TCL_DEPRECATED("Use Tcl_ChannelClose2Proc") +Tcl_DriverCloseProc * Tcl_ChannelCloseProc( const Tcl_ChannelType *chanTypePtr); /* 402 */ EXTERN Tcl_DriverClose2Proc * Tcl_ChannelClose2Proc( @@ -2356,7 +2357,7 @@ typedef struct TclStubs { const char * (*tcl_ChannelName) (const Tcl_ChannelType *chanTypePtr); /* 398 */ Tcl_ChannelTypeVersion (*tcl_ChannelVersion) (const Tcl_ChannelType *chanTypePtr); /* 399 */ Tcl_DriverBlockModeProc * (*tcl_ChannelBlockModeProc) (const Tcl_ChannelType *chanTypePtr); /* 400 */ - Tcl_DriverCloseProc * (*tcl_ChannelCloseProc) (const Tcl_ChannelType *chanTypePtr); /* 401 */ + TCL_DEPRECATED_API("Use Tcl_ChannelClose2Proc") Tcl_DriverCloseProc * (*tcl_ChannelCloseProc) (const Tcl_ChannelType *chanTypePtr); /* 401 */ Tcl_DriverClose2Proc * (*tcl_ChannelClose2Proc) (const Tcl_ChannelType *chanTypePtr); /* 402 */ Tcl_DriverInputProc * (*tcl_ChannelInputProc) (const Tcl_ChannelType *chanTypePtr); /* 403 */ Tcl_DriverOutputProc * (*tcl_ChannelOutputProc) (const Tcl_ChannelType *chanTypePtr); /* 404 */ diff --git a/generic/tclIO.c b/generic/tclIO.c index fccc989..370508d 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -374,11 +374,12 @@ ChanClose( Channel *chanPtr, Tcl_Interp *interp) { - if (chanPtr->typePtr->closeProc != TCL_CLOSE2PROC) { +#ifndef TCL_NO_DEPRECATED + if ((chanPtr->typePtr->closeProc != TCL_CLOSE2PROC) && (chanPtr->typePtr->closeProc != NULL)) { return chanPtr->typePtr->closeProc(chanPtr->instanceData, interp); - } else { - return chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, 0); } +#endif + return chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, 0); } static inline int @@ -1630,9 +1631,18 @@ Tcl_CreateChannel( assert(sizeof(Tcl_ChannelTypeVersion) == sizeof(Tcl_DriverBlockModeProc *)); assert(typePtr->typeName != NULL); - if (NULL == typePtr->closeProc) { - Tcl_Panic("channel type %s must define closeProc", typePtr->typeName); +#ifndef TCL_NO_DEPRECATED + if (((NULL == typePtr->closeProc) || (TCL_CLOSE2PROC == typePtr->closeProc)) && (typePtr->close2Proc == NULL)) { + Tcl_Panic("channel type %s must define closeProc or close2Proc", typePtr->typeName); + } +#else + if (Tcl_ChannelVersion(typePtr) < TCL_CHANNEL_VERSION_5) { + Tcl_Panic("channel type %s must be version TCL_CHANNEL_VERSION_5", typePtr->typeName); + } + if (typePtr->close2Proc == NULL) { + Tcl_Panic("channel type %s must define close2Proc", typePtr->typeName); } +#endif if ((TCL_READABLE & mask) && (NULL == typePtr->inputProc)) { Tcl_Panic("channel type %s must define inputProc when used for reader channel", typePtr->typeName); } @@ -1643,17 +1653,9 @@ Tcl_CreateChannel( Tcl_Panic("channel type %s must define watchProc", typePtr->typeName); } #ifndef TCL_NO_DEPRECATED - if ((NULL!=typePtr->wideSeekProc) && (NULL == typePtr->seekProc)) { + if ((NULL != typePtr->wideSeekProc) && (NULL == typePtr->seekProc)) { Tcl_Panic("channel type %s must define seekProc if defining wideSeekProc", typePtr->typeName); } -#elif 1 /* TODO: Too strict for backwards compatibility, just make sure for the Tcl core for now. */ - if (NULL != typePtr->notUsed) { - Tcl_Panic("channel type %s cannot have seekProc", typePtr->typeName); - } -#else - if ((NULL!=typePtr->notUsed) && (NULL == typePtr->wideSeekProc)) { - Tcl_Panic("channel type %s must define wideSeekProc if defining seekProc", typePtr->typeName); - } #endif /* @@ -3396,7 +3398,7 @@ Tcl_Close( * channel. */ Channel *chanPtr; /* The real IO channel. */ ChannelState *statePtr; /* State of real IO channel. */ - int result; /* Of calling FlushChannel. */ + int result = 0; /* Of calling FlushChannel. */ int flushcode; int stickyError; @@ -3497,12 +3499,14 @@ Tcl_Close( * it anymore and this will help avoid deadlocks on some channel types. */ - if (chanPtr->typePtr->closeProc == TCL_CLOSE2PROC) { - result = chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, - TCL_CLOSE_READ); - } else { - result = 0; +#ifndef TCL_NO_DEPRECATED + if ((chanPtr->typePtr->closeProc == TCL_CLOSE2PROC) || (chanPtr->typePtr->closeProc == NULL)) { + /* If this half-close fails, just continue the full close */ + (void)chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, TCL_CLOSE_READ); } +#else + (void)chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, TCL_CLOSE_READ); +#endif /* * The call to FlushChannel will flush any queued output and invoke the @@ -3562,19 +3566,17 @@ Tcl_Close( * * Tcl_CloseEx -- * - * Closes one side of a channel, read or write. + * Closes one side of a channel, read or write, close all. * * Results: * A standard Tcl result. * * Side effects: - * Closes one direction of the channel. + * Closes one direction of the channel, or do a full close. * * NOTE: * Tcl_CloseEx closes the specified direction of the channel as far as - * the user is concerned. The channel keeps existing however. You cannot - * calls this function to close the last possible direction of the - * channel. Use Tcl_Close for that. + * the user is concerned. If flags = 0, this is equivalent to Tcl_Close. * *---------------------------------------------------------------------- */ @@ -3594,18 +3596,26 @@ Tcl_CloseEx( return TCL_OK; } - /* TODO: assert flags validity ? */ - chanPtr = (Channel *) chan; statePtr = chanPtr->state; + if ((flags & (TCL_READABLE | TCL_WRITABLE)) == 0) { + return Tcl_Close(interp, chan); + } + if ((flags & (TCL_READABLE | TCL_WRITABLE)) == (TCL_READABLE | TCL_WRITABLE)) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "double-close of channels not supported by %ss", + chanPtr->typePtr->typeName)); + return TCL_ERROR; + } + /* * Does the channel support half-close anyway? Error if not. */ if (!chanPtr->typePtr->close2Proc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "half-close of channels not supported by %ss", + "half-close of channels not supported by %ss", chanPtr->typePtr->typeName)); return TCL_ERROR; } @@ -10585,6 +10595,7 @@ Tcl_ChannelBlockModeProc( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED Tcl_DriverCloseProc * Tcl_ChannelCloseProc( const Tcl_ChannelType *chanTypePtr) @@ -10592,6 +10603,7 @@ Tcl_ChannelCloseProc( { return chanTypePtr->closeProc; } +#endif /* *---------------------------------------------------------------------- diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 4195256..c983434 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -22,7 +22,7 @@ static int TransformBlockModeProc(ClientData instanceData, int mode); static int TransformCloseProc(ClientData instanceData, - Tcl_Interp *interp); + Tcl_Interp *interp, int flags); static int TransformInputProc(ClientData instanceData, char *buf, int toRead, int *errorCodePtr); static int TransformOutputProc(ClientData instanceData, @@ -121,7 +121,7 @@ static inline void ResultAdd(ResultBuffer *r, unsigned char *buf, static const Tcl_ChannelType transformChannelType = { "transform", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ - TransformCloseProc, /* Close proc. */ + TCL_CLOSE2PROC, /* Close proc. */ TransformInputProc, /* Input proc. */ TransformOutputProc, /* Output proc. */ #ifndef TCL_NO_DEPRECATED @@ -133,7 +133,7 @@ static const Tcl_ChannelType transformChannelType = { TransformGetOptionProc, /* Get option proc. */ TransformWatchProc, /* Initialize notifier. */ TransformGetFileHandleProc, /* Get OS handles out of channel. */ - NULL, /* close2proc */ + TransformCloseProc, /* close2proc */ TransformBlockModeProc, /* Set blocking/nonblocking mode.*/ NULL, /* Flush proc. */ TransformNotifyProc, /* Handling of events bubbling up. */ @@ -539,10 +539,15 @@ TransformBlockModeProc( static int TransformCloseProc( ClientData instanceData, - Tcl_Interp *interp) + Tcl_Interp *interp, + int flags) { TransformChannelData *dataPtr = instanceData; + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { + return EINVAL; + } + /* * Important: In this procedure 'dataPtr->self' already points to the * underlying channel. diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 3baf8f3..ebe2f7e 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -32,7 +32,7 @@ */ static int ReflectClose(ClientData clientData, - Tcl_Interp *interp); + Tcl_Interp *interp, int flags); static int ReflectInput(ClientData clientData, char *buf, int toRead, int *errorCodePtr); static int ReflectOutput(ClientData clientData, const char *buf, @@ -67,7 +67,7 @@ static void TimerRunWrite(ClientData clientData); static const Tcl_ChannelType tclRChannelType = { "tclrchannel", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ - ReflectClose, /* Close channel, clean instance data */ + TCL_CLOSE2PROC, /* Close channel, clean instance data */ ReflectInput, /* Handle read request */ ReflectOutput, /* Handle write request */ #ifndef TCL_NO_DEPRECATED @@ -79,7 +79,7 @@ static const Tcl_ChannelType tclRChannelType = { ReflectGetOption, /* Get options. NULL'able */ ReflectWatch, /* Initialize notifier */ NULL, /* Get OS handle from the channel. NULL'able */ - NULL, /* No close2 support. NULL'able */ + ReflectClose, /* No close2 support. NULL'able */ ReflectBlock, /* Set blocking/nonblocking. NULL'able */ NULL, /* Flush channel. Not used by core. NULL'able */ NULL, /* Handle events. NULL'able */ @@ -1158,7 +1158,8 @@ TclChanCaughtErrorBypass( static int ReflectClose( ClientData clientData, - Tcl_Interp *interp) + Tcl_Interp *interp, + int flags) { ReflectedChannel *rcPtr = clientData; int result; /* Result code for 'close' */ @@ -1168,6 +1169,10 @@ ReflectClose( Tcl_HashEntry *hPtr; /* Entry in the above map */ const Tcl_ChannelType *tctPtr; + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { + return EINVAL; + } + if (TclInThreadExit()) { /* * This call comes from TclFinalizeIOSystem. There are no diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 70dd640..316378f 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -32,7 +32,7 @@ */ static int ReflectClose(ClientData clientData, - Tcl_Interp *interp); + Tcl_Interp *interp, int flags); static int ReflectInput(ClientData clientData, char *buf, int toRead, int *errorCodePtr); static int ReflectOutput(ClientData clientData, const char *buf, @@ -62,7 +62,7 @@ static int ReflectNotify(ClientData clientData, int mask); static const Tcl_ChannelType tclRTransformType = { "tclrtransform", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel. */ - ReflectClose, /* Close channel, clean instance data. */ + TCL_CLOSE2PROC, /* Close channel, clean instance data. */ ReflectInput, /* Handle read request. */ ReflectOutput, /* Handle write request. */ #ifndef TCL_NO_DEPRECATED @@ -74,7 +74,7 @@ static const Tcl_ChannelType tclRTransformType = { ReflectGetOption, /* Get options. */ ReflectWatch, /* Initialize notifier. */ ReflectHandle, /* Get OS handle from the channel. */ - NULL, /* No close2 support. NULL'able. */ + ReflectClose, /* No close2 support. NULL'able. */ ReflectBlock, /* Set blocking/nonblocking. */ NULL, /* Flush channel. Not used by core. * NULL'able. */ @@ -885,7 +885,8 @@ UnmarshallErrorResult( static int ReflectClose( ClientData clientData, - Tcl_Interp *interp) + Tcl_Interp *interp, + int flags) { ReflectedTransform *rtPtr = clientData; int errorCode, errorCodeSet = 0; @@ -896,6 +897,10 @@ ReflectClose( * in this interp. */ Tcl_HashEntry *hPtr; /* Entry in the above map */ + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { + return EINVAL; + } + if (TclInThreadExit()) { /* * This call comes from TclFinalizeIOSystem. There are no diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 927f1d0..971d42d 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -257,6 +257,7 @@ mp_err TclBN_mp_mul_d(const mp_int *a, unsigned int b, mp_int *c) { # define Tcl_BackgroundError 0 # define Tcl_FreeResult 0 # define Tcl_ChannelSeekProc 0 +# define Tcl_ChannelCloseProc 0 #else mp_err TclBN_mp_div_3(const mp_int *a, mp_int *c, unsigned int *d) { diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index b45d86e..ee87af0 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -385,7 +385,7 @@ static int ZipFSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, static void ZipfsExitHandler(ClientData clientData); static void ZipfsSetup(void); static int ZipChannelClose(void *instanceData, - Tcl_Interp *interp); + Tcl_Interp *interp, int flags); static int ZipChannelGetFile(void *instanceData, int direction, void **handlePtr); static int ZipChannelRead(void *instanceData, char *buf, @@ -446,7 +446,7 @@ static const Tcl_Filesystem zipfsFilesystem = { static Tcl_ChannelType ZipChannelType = { "zip", /* Type name. */ TCL_CHANNEL_VERSION_5, - ZipChannelClose, /* Close channel, clean instance data */ + TCL_CLOSE2PROC, /* Close channel, clean instance data */ ZipChannelRead, /* Handle read request */ ZipChannelWrite, /* Handle write request */ #ifndef TCL_NO_DEPRECATED @@ -458,7 +458,7 @@ static Tcl_ChannelType ZipChannelType = { NULL, /* Get options, NULL'able */ ZipChannelWatchChannel, /* Initialize notifier */ ZipChannelGetFile, /* Get OS handle from the channel */ - NULL, /* 2nd version of close channel, NULL'able */ + ZipChannelClose, /* 2nd version of close channel, NULL'able */ NULL, /* Set blocking mode for raw channel, NULL'able */ NULL, /* Function to flush channel, NULL'able */ NULL, /* Function to handle event, NULL'able */ @@ -3318,10 +3318,15 @@ ZipFSTclLibraryObjCmd( static int ZipChannelClose( void *instanceData, - Tcl_Interp *dummy) /* Current interpreter. */ + Tcl_Interp *dummy, /* Current interpreter. */ + int flags) { ZipChannel *info = instanceData; + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { + return EINVAL; + } + if (info->iscompr && info->ubuf) { ckfree(info->ubuf); info->ubuf = NULL; diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 49f1c39..44451e2 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -160,7 +160,7 @@ typedef struct { static Tcl_CmdDeleteProc ZlibStreamCmdDelete; static Tcl_DriverBlockModeProc ZlibTransformBlockMode; -static Tcl_DriverCloseProc ZlibTransformClose; +static Tcl_DriverClose2Proc ZlibTransformClose; static Tcl_DriverGetHandleProc ZlibTransformGetHandle; static Tcl_DriverGetOptionProc ZlibTransformGetOption; static Tcl_DriverHandlerProc ZlibTransformEventHandler; @@ -205,7 +205,7 @@ static void ZlibTransformTimerRun(void *clientData); static const Tcl_ChannelType zlibChannelType = { "zlib", TCL_CHANNEL_VERSION_5, - ZlibTransformClose, + TCL_CLOSE2PROC, ZlibTransformInput, ZlibTransformOutput, NULL, /* seekProc */ @@ -213,7 +213,7 @@ static const Tcl_ChannelType zlibChannelType = { ZlibTransformGetOption, ZlibTransformWatch, ZlibTransformGetHandle, - NULL, /* close2Proc */ + ZlibTransformClose, /* close2Proc */ ZlibTransformBlockMode, NULL, /* flushProc */ ZlibTransformEventHandler, @@ -2895,11 +2895,16 @@ ZlibStreamHeaderCmd( static int ZlibTransformClose( void *instanceData, - Tcl_Interp *interp) + Tcl_Interp *interp, + int flags) { ZlibChannelData *cd = instanceData; int e, written, result = TCL_OK; + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { + return EINVAL; + } + /* * Delete the support timer. */ diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 56a0276..e1b7223 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -121,7 +121,7 @@ typedef struct { static int FileBlockModeProc(ClientData instanceData, int mode); static int FileCloseProc(ClientData instanceData, - Tcl_Interp *interp); + Tcl_Interp *interp, int flags); static int FileGetHandleProc(ClientData instanceData, int direction, ClientData *handlePtr); static int FileInputProc(ClientData instanceData, char *buf, @@ -139,7 +139,7 @@ static Tcl_WideInt FileWideSeekProc(ClientData instanceData, static void FileWatchProc(ClientData instanceData, int mask); #ifdef SUPPORTS_TTY static int TtyCloseProc(ClientData instanceData, - Tcl_Interp *interp); + Tcl_Interp *interp, int flags); static void TtyGetAttributes(int fd, TtyAttrs *ttyPtr); static int TtyGetOptionProc(ClientData instanceData, Tcl_Interp *interp, const char *optionName, @@ -163,7 +163,7 @@ static int TtySetOptionProc(ClientData instanceData, static const Tcl_ChannelType fileChannelType = { "file", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ - FileCloseProc, /* Close proc. */ + TCL_CLOSE2PROC, /* Close proc. */ FileInputProc, /* Input proc. */ FileOutputProc, /* Output proc. */ #ifndef TCL_NO_DEPRECATED @@ -175,7 +175,7 @@ static const Tcl_ChannelType fileChannelType = { NULL, /* Get option proc. */ FileWatchProc, /* Initialize notifier. */ FileGetHandleProc, /* Get OS handles out of channel. */ - NULL, /* close2proc. */ + FileCloseProc, /* close2proc. */ FileBlockModeProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -193,7 +193,7 @@ static const Tcl_ChannelType fileChannelType = { static const Tcl_ChannelType ttyChannelType = { "tty", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ - TtyCloseProc, /* Close proc. */ + TCL_CLOSE2PROC, /* Close proc. */ FileInputProc, /* Input proc. */ FileOutputProc, /* Output proc. */ NULL, /* Seek proc. */ @@ -201,7 +201,7 @@ static const Tcl_ChannelType ttyChannelType = { TtyGetOptionProc, /* Get option proc. */ FileWatchProc, /* Initialize notifier. */ FileGetHandleProc, /* Get OS handles out of channel. */ - NULL, /* close2proc. */ + TtyCloseProc, /* close2proc. */ FileBlockModeProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -359,11 +359,16 @@ FileOutputProc( static int FileCloseProc( ClientData instanceData, /* File state. */ - Tcl_Interp *interp) /* For error reporting - unused. */ + Tcl_Interp *dummy, /* For error reporting - unused. */ + int flags) { FileState *fsPtr = instanceData; int errorCode = 0; + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { + return EINVAL; + } + Tcl_DeleteFileHandler(fsPtr->fd); /* @@ -384,10 +389,14 @@ FileCloseProc( static int TtyCloseProc( ClientData instanceData, - Tcl_Interp *interp) + Tcl_Interp *interp, + int flags) { TtyState *ttyPtr = instanceData; + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { + return EINVAL; + } /* * If we've been asked by the user to drain or flush, do so now. */ @@ -416,7 +425,7 @@ TtyCloseProc( * Delegate to close for files. */ - return FileCloseProc(instanceData, interp); + return FileCloseProc(instanceData, interp, flags); } #endif /* SUPPORTS_TTY */ diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 57735da..e9c552e 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -157,7 +157,11 @@ static void WrapNotify(ClientData clientData, int mask); static const Tcl_ChannelType tcpChannelType = { "tcp", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ +#ifndef TCL_NO_DEPRECATED TcpCloseProc, /* Close proc. */ +#else + TCL_CLOSE2PROC, /* Close proc. */ +#endif TcpInputProc, /* Input proc. */ TcpOutputProc, /* Output proc. */ NULL, /* Seek proc. */ diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 829cc74..b7f5c04 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -76,7 +76,7 @@ static int FileBlockProc(ClientData instanceData, int mode); static void FileChannelExitHandler(ClientData clientData); static void FileCheckProc(ClientData clientData, int flags); static int FileCloseProc(ClientData instanceData, - Tcl_Interp *interp); + Tcl_Interp *interp, int flags); static int FileEventProc(Tcl_Event *evPtr, int flags); static int FileGetHandleProc(ClientData instanceData, int direction, ClientData *handlePtr); @@ -107,7 +107,7 @@ static int NativeIsComPort(const WCHAR *nativeName); static const Tcl_ChannelType fileChannelType = { "file", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ - FileCloseProc, /* Close proc. */ + TCL_CLOSE2PROC, /* Close proc. */ FileInputProc, /* Input proc. */ FileOutputProc, /* Output proc. */ #ifndef TCL_NO_DEPRECATED @@ -119,7 +119,7 @@ static const Tcl_ChannelType fileChannelType = { NULL, /* Get option proc. */ FileWatchProc, /* Set up the notifier to watch the channel. */ FileGetHandleProc, /* Get an OS handle from channel. */ - NULL, /* close2proc. */ + FileCloseProc, /* close2proc. */ FileBlockProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -392,12 +392,18 @@ FileBlockProc( static int FileCloseProc( ClientData instanceData, /* Pointer to FileInfo structure. */ - Tcl_Interp *interp) /* Not used. */ + Tcl_Interp *dummy, /* Not used. */ + int flags) { FileInfo *fileInfoPtr = instanceData; FileInfo *infoPtr; ThreadSpecificData *tsdPtr; int errorCode = 0; + (void)dummy; + + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { + return EINVAL; + } /* * Remove the file from the watch list. diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 7de425b..632f0e7 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -142,7 +142,7 @@ static int ConsoleBlockModeProc(ClientData instanceData, int mode); static void ConsoleCheckProc(ClientData clientData, int flags); static int ConsoleCloseProc(ClientData instanceData, - Tcl_Interp *interp); + Tcl_Interp *interp, int flags); static int ConsoleEventProc(Tcl_Event *evPtr, int flags); static void ConsoleExitHandler(ClientData clientData); static int ConsoleGetHandleProc(ClientData instanceData, @@ -180,7 +180,7 @@ static BOOL WriteConsoleBytes(HANDLE hConsole, static const Tcl_ChannelType consoleChannelType = { "console", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ - ConsoleCloseProc, /* Close proc. */ + TCL_CLOSE2PROC, /* Close proc. */ ConsoleInputProc, /* Input proc. */ ConsoleOutputProc, /* Output proc. */ NULL, /* Seek proc. */ @@ -188,7 +188,7 @@ static const Tcl_ChannelType consoleChannelType = { ConsoleGetOptionProc, /* Get option proc. */ ConsoleWatchProc, /* Set up notifier to watch the channel. */ ConsoleGetHandleProc, /* Get an OS handle from channel. */ - NULL, /* close2proc. */ + ConsoleCloseProc, /* close2proc. */ ConsoleBlockModeProc, /* Set blocking or non-blocking mode. */ NULL, /* Flush proc. */ NULL, /* Handler proc. */ @@ -531,12 +531,18 @@ ConsoleBlockModeProc( static int ConsoleCloseProc( ClientData instanceData, /* Pointer to ConsoleInfo structure. */ - Tcl_Interp *interp) /* For error reporting. */ + Tcl_Interp *dummy, /* For error reporting. */ + int flags) { ConsoleInfo *consolePtr = instanceData; int errorCode = 0; ConsoleInfo *infoPtr, **nextPtrPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + (void)dummy; + + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { + return EINVAL; + } /* * Clean up the background thread if necessary. Note that this must be diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index e945055..ec5d17b 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -168,7 +168,7 @@ static COMMTIMEOUTS no_timeout = { static int SerialBlockProc(ClientData instanceData, int mode); static void SerialCheckProc(ClientData clientData, int flags); static int SerialCloseProc(ClientData instanceData, - Tcl_Interp *interp); + Tcl_Interp *interp, int flags); static int SerialEventProc(Tcl_Event *evPtr, int flags); static void SerialExitHandler(ClientData clientData); static int SerialGetHandleProc(ClientData instanceData, @@ -204,7 +204,7 @@ static int SerialBlockingWrite(SerialInfo *infoPtr, LPVOID buf, static const Tcl_ChannelType serialChannelType = { "serial", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ - SerialCloseProc, /* Close proc. */ + TCL_CLOSE2PROC, /* Close proc. */ SerialInputProc, /* Input proc. */ SerialOutputProc, /* Output proc. */ NULL, /* Seek proc. */ @@ -212,7 +212,7 @@ static const Tcl_ChannelType serialChannelType = { SerialGetOptionProc, /* Get option proc. */ SerialWatchProc, /* Set up notifier to watch the channel. */ SerialGetHandleProc, /* Get an OS handle from channel. */ - NULL, /* close2proc. */ + SerialCloseProc, /* close2proc. */ SerialBlockProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -597,14 +597,18 @@ SerialBlockProc( static int SerialCloseProc( ClientData instanceData, /* Pointer to SerialInfo structure. */ - Tcl_Interp *interp) /* For error reporting. */ + Tcl_Interp *interp, /* For error reporting. */ + int flags) { SerialInfo *serialPtr = (SerialInfo *) instanceData; - int errorCode, result = 0; + int errorCode = 0, result = 0; SerialInfo *infoPtr, **nextPtrPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - errorCode = 0; + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { + return EINVAL; + } + if (serialPtr->validMask & TCL_READABLE) { PurgeComm(serialPtr->handle, PURGE_RXABORT | PURGE_RXCLEAR); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 8b42b9b..8213fde 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -280,7 +280,11 @@ static Tcl_DriverGetHandleProc TcpGetHandleProc; static const Tcl_ChannelType tcpChannelType = { "tcp", /* Type name. */ TCL_CHANNEL_VERSION_5, /* v5 channel */ +#ifndef TCL_NO_DEPRECATED TcpCloseProc, /* Close proc. */ +#else + TCL_CLOSE2PROC, /* Close proc. */ +#endif TcpInputProc, /* Input proc. */ TcpOutputProc, /* Output proc. */ NULL, /* Seek proc. */ -- cgit v0.12 From f2ae531f0fc28d15c43ec95cf8b7299bc7a49e88 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 2 Feb 2020 22:17:50 +0000 Subject: Oopsee --- generic/tclDecls.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclDecls.h b/generic/tclDecls.h index fad7811..4619dfe 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -4174,7 +4174,7 @@ extern const TclStubs *tclStubsPtr; #define Tcl_GlobalEvalObj(interp, objPtr) \ Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL) -#if !defined(TCL_NO_DEPRECATED) && defined(USE_TCL_STUBS) +#if defined(TCL_NO_DEPRECATED) && defined(USE_TCL_STUBS) #undef Tcl_Close #define Tcl_Close(interp, chan) Tcl_CloseEx(interp, chan, 0) #endif -- cgit v0.12 From 1fb8e115c4cd0dc9a351e7a6e183f8956996117d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 21 Feb 2020 08:46:15 +0000 Subject: Restore compatibility with older (mingw) Makefiles. Fix for [4b5deacc70]: undefined reference to `Tcl_SetStartupScript'. --- generic/tclMain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclMain.c b/generic/tclMain.c index 08c1fe0..cef4543 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -117,7 +117,7 @@ static void Prompt(Tcl_Interp *interp, InteractiveState *isPtr); static void StdinProc(ClientData clientData, int mask); static void FreeMainInterp(ClientData clientData); -#if !defined(_WIN32) || defined(UNICODE) +#if !defined(_WIN32) || defined(UNICODE) && !defined(TCL_ASCII_MAIN) static Tcl_ThreadDataKey dataKey; /* -- cgit v0.12 From 5eb39e3973c7016b834d0881ca4c69515a1e89e0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 21 Feb 2020 09:25:03 +0000 Subject: Fix [da235271f1]: [info hostname] on Windows is limited to max NetBIOS name length --- win/tclWinSock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win/tclWinSock.c b/win/tclWinSock.c index e52e509..d4df032 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -343,11 +343,11 @@ InitializeHostName( int *lengthPtr, Tcl_Encoding *encodingPtr) { - WCHAR wbuf[MAX_COMPUTERNAME_LENGTH + 1]; - DWORD length = MAX_COMPUTERNAME_LENGTH + 1; + WCHAR wbuf[256]; + DWORD length = sizeof(wbuf)/sizeof(WCHAR); Tcl_DString ds; - if (GetComputerNameW(wbuf, &length) != 0) { + if (GetComputerNameExW(ComputerNameDnsFullyQualified, wbuf, &length) != 0) { /* * Convert string from native to UTF then change to lowercase. */ -- cgit v0.12 From fc3487d2b29493c0eea7db77f8d92e609d539c91 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 22 Feb 2020 12:34:14 +0000 Subject: typo fix --- doc/my.n | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/my.n b/doc/my.n index 262186f..4618525 100644 --- a/doc/my.n +++ b/doc/my.n @@ -23,7 +23,7 @@ package require TclOO The \fBmy\fR command is used to allow methods of objects to invoke methods of the object (or its class), .VS TIP478 -and he \fBmyclass\fR command is used to allow methods of objects to invoke +and the \fBmyclass\fR command is used to allow methods of objects to invoke methods of the current class of the object \fIas an object\fR. .VE TIP478 In particular, the set of valid values for -- cgit v0.12 From 1eeefb073a3dec57e47e1b30b8df7467358857e7 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 25 Feb 2020 15:07:51 +0000 Subject: Ensure that we release the correct references when an error occurs during setting a class's superclasses --- generic/tclOODefineCmds.c | 3 +-- tests/oo.test | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index f02e1d3..2ace60c 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -2132,7 +2132,6 @@ ClassSuperSet( superclasses[i] = GetClassInOuterContext(interp, superv[i], "only a class can be a superclass"); if (superclasses[i] == NULL) { - i--; goto failedAfterAlloc; } for (j = 0; j < i; j++) { @@ -2149,7 +2148,7 @@ ClassSuperSet( "attempt to form circular dependency graph", -1)); Tcl_SetErrorCode(interp, "TCL", "OO", "CIRCULARITY", NULL); failedAfterAlloc: - for (; i > 0; i--) { + for (; i-- > 0 ;) { TclOODecrRefCount(superclasses[i]->thisPtr); } ckfree(superclasses); diff --git a/tests/oo.test b/tests/oo.test index 065c017..e917bc9 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -314,7 +314,41 @@ test oo-1.18.3 {Bug 21c144f0f5} -setup { } } -cleanup { interp delete slave -} +} +test oo-1.18.4 {correct handling of cleanup in superclass set error} -setup { + interp create slave +} -body { + slave eval { + oo::class create A + oo::class create B { + superclass oo::class + constructor {} { + next {superclass A} + next {superclass -append A} + } + } + [B create C] create d + } +} -returnCodes error -cleanup { + interp delete slave +} -result {class should only be a direct superclass once} +test oo-1.18.5 {correct handling of cleanup in superclass set error} -setup { + interp create slave +} -body { + slave eval { + oo::class create A + oo::class create B { + superclass oo::class + constructor {c} { + next {superclass A} + next [list superclass -append {*}$c] + } + } + [B create C {B C}] create d + } +} -returnCodes error -cleanup { + interp delete slave +} -result {attempt to form circular dependency graph} test oo-1.19 {basic test of OO functionality: teardown order} -body { oo::object create o namespace delete [info object namespace o] -- cgit v0.12 From a4154b246b048a378dd83998031d103263856c8f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Feb 2020 13:45:40 +0000 Subject: Resolve a number of shadowed variables (discovered by compiling with -Wshadow) --- generic/tclAssembly.c | 4 +--- generic/tclClock.c | 64 +++++++++++++++++++++++++-------------------------- generic/tclCmdIL.c | 6 ++--- generic/tclEnv.c | 6 ++--- 4 files changed, 39 insertions(+), 41 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index f05814fa..15e36ac 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -1697,9 +1697,7 @@ AssembleOneLine( goto cleanup; } { - int flags = TCL_REG_ADVANCED | (opnd ? TCL_REG_NOCASE : 0); - - BBEmitInstInt1(assemEnvPtr, tblIdx, flags, 0); + BBEmitInstInt1(assemEnvPtr, tblIdx, TCL_REG_ADVANCED | (opnd ? TCL_REG_NOCASE : 0), 0); } break; diff --git a/generic/tclClock.c b/generic/tclClock.c index 1629cb8..01058f5 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -337,7 +337,7 @@ ClockConvertlocaltoutcObjCmd( Tcl_Obj *const *objv) /* Parameter vector */ { ClockClientData *data = clientData; - Tcl_Obj *const *literals = data->literals; + Tcl_Obj *const *lit = data->literals; Tcl_Obj *secondsObj; Tcl_Obj *dict; int changeover; @@ -354,7 +354,7 @@ ClockConvertlocaltoutcObjCmd( return TCL_ERROR; } dict = objv[1]; - if (Tcl_DictObjGet(interp, dict, literals[LIT_LOCALSECONDS], + if (Tcl_DictObjGet(interp, dict, lit[LIT_LOCALSECONDS], &secondsObj)!= TCL_OK) { return TCL_ERROR; } @@ -380,7 +380,7 @@ ClockConvertlocaltoutcObjCmd( created = 1; Tcl_IncrRefCount(dict); } - status = Tcl_DictObjPut(interp, dict, literals[LIT_SECONDS], + status = Tcl_DictObjPut(interp, dict, lit[LIT_SECONDS], Tcl_NewWideIntObj(fields.seconds)); if (status == TCL_OK) { Tcl_SetObjResult(interp, dict); @@ -431,7 +431,7 @@ ClockGetdatefieldsObjCmd( TclDateFields fields; Tcl_Obj *dict; ClockClientData *data = clientData; - Tcl_Obj *const *literals = data->literals; + Tcl_Obj *const *lit = data->literals; int changeover; /* @@ -453,7 +453,7 @@ ClockGetdatefieldsObjCmd( */ if (objv[1]->typePtr == &tclBignumType) { - Tcl_SetObjResult(interp, literals[LIT_INTEGER_VALUE_TOO_LARGE]); + Tcl_SetObjResult(interp, lit[LIT_INTEGER_VALUE_TOO_LARGE]); return TCL_ERROR; } @@ -481,33 +481,33 @@ ClockGetdatefieldsObjCmd( GetYearWeekDay(&fields, changeover); dict = Tcl_NewDictObj(); - Tcl_DictObjPut(NULL, dict, literals[LIT_LOCALSECONDS], + Tcl_DictObjPut(NULL, dict, lit[LIT_LOCALSECONDS], Tcl_NewWideIntObj(fields.localSeconds)); - Tcl_DictObjPut(NULL, dict, literals[LIT_SECONDS], + Tcl_DictObjPut(NULL, dict, lit[LIT_SECONDS], Tcl_NewWideIntObj(fields.seconds)); - Tcl_DictObjPut(NULL, dict, literals[LIT_TZNAME], fields.tzName); + Tcl_DictObjPut(NULL, dict, lit[LIT_TZNAME], fields.tzName); Tcl_DecrRefCount(fields.tzName); - Tcl_DictObjPut(NULL, dict, literals[LIT_TZOFFSET], + Tcl_DictObjPut(NULL, dict, lit[LIT_TZOFFSET], Tcl_NewIntObj(fields.tzOffset)); - Tcl_DictObjPut(NULL, dict, literals[LIT_JULIANDAY], + Tcl_DictObjPut(NULL, dict, lit[LIT_JULIANDAY], Tcl_NewIntObj(fields.julianDay)); - Tcl_DictObjPut(NULL, dict, literals[LIT_GREGORIAN], + Tcl_DictObjPut(NULL, dict, lit[LIT_GREGORIAN], Tcl_NewIntObj(fields.gregorian)); - Tcl_DictObjPut(NULL, dict, literals[LIT_ERA], - literals[fields.era ? LIT_BCE : LIT_CE]); - Tcl_DictObjPut(NULL, dict, literals[LIT_YEAR], + Tcl_DictObjPut(NULL, dict, lit[LIT_ERA], + lit[fields.era ? LIT_BCE : LIT_CE]); + Tcl_DictObjPut(NULL, dict, lit[LIT_YEAR], Tcl_NewIntObj(fields.year)); - Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFYEAR], + Tcl_DictObjPut(NULL, dict, lit[LIT_DAYOFYEAR], Tcl_NewIntObj(fields.dayOfYear)); - Tcl_DictObjPut(NULL, dict, literals[LIT_MONTH], + Tcl_DictObjPut(NULL, dict, lit[LIT_MONTH], Tcl_NewIntObj(fields.month)); - Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFMONTH], + Tcl_DictObjPut(NULL, dict, lit[LIT_DAYOFMONTH], Tcl_NewIntObj(fields.dayOfMonth)); - Tcl_DictObjPut(NULL, dict, literals[LIT_ISO8601YEAR], + Tcl_DictObjPut(NULL, dict, lit[LIT_ISO8601YEAR], Tcl_NewIntObj(fields.iso8601Year)); - Tcl_DictObjPut(NULL, dict, literals[LIT_ISO8601WEEK], + Tcl_DictObjPut(NULL, dict, lit[LIT_ISO8601WEEK], Tcl_NewIntObj(fields.iso8601Week)); - Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFWEEK], + Tcl_DictObjPut(NULL, dict, lit[LIT_DAYOFWEEK], Tcl_NewIntObj(fields.dayOfWeek)); Tcl_SetObjResult(interp, dict); @@ -585,7 +585,7 @@ ClockGetjuliandayfromerayearmonthdayObjCmd( TclDateFields fields; Tcl_Obj *dict; ClockClientData *data = clientData; - Tcl_Obj *const *literals = data->literals; + Tcl_Obj *const *lit = data->literals; int changeover; int copied = 0; int status; @@ -600,12 +600,12 @@ ClockGetjuliandayfromerayearmonthdayObjCmd( return TCL_ERROR; } dict = objv[1]; - if (FetchEraField(interp, dict, literals[LIT_ERA], &era) != TCL_OK - || FetchIntField(interp, dict, literals[LIT_YEAR], &fields.year) + if (FetchEraField(interp, dict, lit[LIT_ERA], &era) != TCL_OK + || FetchIntField(interp, dict, lit[LIT_YEAR], &fields.year) != TCL_OK - || FetchIntField(interp, dict, literals[LIT_MONTH], &fields.month) + || FetchIntField(interp, dict, lit[LIT_MONTH], &fields.month) != TCL_OK - || FetchIntField(interp, dict, literals[LIT_DAYOFMONTH], + || FetchIntField(interp, dict, lit[LIT_DAYOFMONTH], &fields.dayOfMonth) != TCL_OK || TclGetIntFromObj(interp, objv[2], &changeover) != TCL_OK) { return TCL_ERROR; @@ -627,7 +627,7 @@ ClockGetjuliandayfromerayearmonthdayObjCmd( Tcl_IncrRefCount(dict); copied = 1; } - status = Tcl_DictObjPut(interp, dict, literals[LIT_JULIANDAY], + status = Tcl_DictObjPut(interp, dict, lit[LIT_JULIANDAY], Tcl_NewIntObj(fields.julianDay)); if (status == TCL_OK) { Tcl_SetObjResult(interp, dict); @@ -669,7 +669,7 @@ ClockGetjuliandayfromerayearweekdayObjCmd( TclDateFields fields; Tcl_Obj *dict; ClockClientData *data = clientData; - Tcl_Obj *const *literals = data->literals; + Tcl_Obj *const *lit = data->literals; int changeover; int copied = 0; int status; @@ -684,12 +684,12 @@ ClockGetjuliandayfromerayearweekdayObjCmd( return TCL_ERROR; } dict = objv[1]; - if (FetchEraField(interp, dict, literals[LIT_ERA], &era) != TCL_OK - || FetchIntField(interp, dict, literals[LIT_ISO8601YEAR], + if (FetchEraField(interp, dict, lit[LIT_ERA], &era) != TCL_OK + || FetchIntField(interp, dict, lit[LIT_ISO8601YEAR], &fields.iso8601Year) != TCL_OK - || FetchIntField(interp, dict, literals[LIT_ISO8601WEEK], + || FetchIntField(interp, dict, lit[LIT_ISO8601WEEK], &fields.iso8601Week) != TCL_OK - || FetchIntField(interp, dict, literals[LIT_DAYOFWEEK], + || FetchIntField(interp, dict, lit[LIT_DAYOFWEEK], &fields.dayOfWeek) != TCL_OK || TclGetIntFromObj(interp, objv[2], &changeover) != TCL_OK) { return TCL_ERROR; @@ -711,7 +711,7 @@ ClockGetjuliandayfromerayearweekdayObjCmd( Tcl_IncrRefCount(dict); copied = 1; } - status = Tcl_DictObjPut(interp, dict, literals[LIT_JULIANDAY], + status = Tcl_DictObjPut(interp, dict, lit[LIT_JULIANDAY], Tcl_NewIntObj(fields.julianDay)); if (status == TCL_OK) { Tcl_SetObjResult(interp, dict); diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index a73a292..7e685bd 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -3729,7 +3729,7 @@ Tcl_LsortObjCmd( sortInfo.isIncreasing = 1; break; case LSORT_INDEX: { - int indexc; + int sortindex; Tcl_Obj **indexv; if (i == objc-2) { @@ -3740,7 +3740,7 @@ Tcl_LsortObjCmd( sortInfo.resultCode = TCL_ERROR; goto done; } - if (TclListObjGetElements(interp, objv[i+1], &indexc, + if (TclListObjGetElements(interp, objv[i+1], &sortindex, &indexv) != TCL_OK) { sortInfo.resultCode = TCL_ERROR; goto done; @@ -3754,7 +3754,7 @@ Tcl_LsortObjCmd( * options is done. */ - for (j=0 ; j Date: Fri, 28 Feb 2020 14:23:34 +0000 Subject: Minor TIP #562 fix: Missing #endif, results in (harmless) compiler warning when compiling with -DTCL_NO_DEPRECATED. --- unix/tclUnixChan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index a377419..0636b6d 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -128,8 +128,10 @@ static int FileInputProc(void *instanceData, char *buf, int toRead, int *errorCode); static int FileOutputProc(void *instanceData, const char *buf, int toWrite, int *errorCode); +#ifndef TCL_NO_DEPRECATED static int FileSeekProc(void *instanceData, long offset, int mode, int *errorCode); +#endif static int FileTruncateProc(void *instanceData, Tcl_WideInt length); static Tcl_WideInt FileWideSeekProc(void *instanceData, -- cgit v0.12 From 520e0c9938ef5229a94dd4d50005f141db548e69 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 29 Feb 2020 21:42:18 +0000 Subject: Better error-message in case of "index out of range", mentioning the actual index which was out of range. Also, use the same error-code, because the underlying cause is all the same. --- generic/tclCmdIL.c | 8 ++++---- generic/tclListObj.c | 25 ++++++++++++------------- tests/cmdIL.test | 14 +++++++------- tests/lpop.test | 8 ++++---- tests/lsearch.test | 10 +++++----- tests/lset.test | 40 ++++++++++++++++++++-------------------- tests/lsetComp.test | 4 ++-- 7 files changed, 54 insertions(+), 55 deletions(-) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 07b41ac..08948ea 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -3421,8 +3421,8 @@ Tcl_LsearchObjCmd( } if (encoded == (int)TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "index \"%s\" cannot select an element " - "from any list", TclGetString(indices[j]))); + "index \"%s\" out of range", + TclGetString(indices[j]))); Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX" "OUTOFRANGE", NULL); result = TCL_ERROR; @@ -4142,8 +4142,8 @@ Tcl_LsortObjCmd( if ((result == TCL_OK) && (encoded == (int)TCL_INDEX_NONE)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "index \"%s\" cannot select an element " - "from any list", TclGetString(indexv[j]))); + "index \"%s\" out of range", + TclGetString(indexv[j]))); Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX" "OUTOFRANGE", NULL); result = TCL_ERROR; diff --git a/generic/tclListObj.c b/generic/tclListObj.c index bae6452..5de2eac 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -1608,11 +1608,10 @@ TclLsetFlat( || (valuePtr == NULL && index >= elemCount)) { /* ...the index points outside the sublist. */ if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("list index out of range", -1)); - Tcl_SetErrorCode(interp, "TCL", "OPERATION", - valuePtr == NULL ? "LPOP" : "LSET", - "BADINDEX", NULL); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "index \"%s\" out of range", Tcl_GetString(indexArray[-1]))); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX" + "OUTOFRANGE", NULL); } result = TCL_ERROR; break; @@ -1803,10 +1802,10 @@ TclListObjSetElement( (void) Tcl_GetStringFromObj(listPtr, &length); if (length == 0) { if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("list index out of range", -1)); - Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSET", - "BADINDEX", NULL); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "index \"%d\" out of range", index)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", + "OUTOFRANGE", NULL); } return TCL_ERROR; } @@ -1825,10 +1824,10 @@ TclListObjSetElement( if (index<0 || index>=elemCount) { if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("list index out of range", -1)); - Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSET", "BADINDEX", - NULL); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "index \"%d\" out of range", index)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", + "OUTOFRANGE", NULL); } return TCL_ERROR; } diff --git a/tests/cmdIL.test b/tests/cmdIL.test index 05b5040..fe72d94 100644 --- a/tests/cmdIL.test +++ b/tests/cmdIL.test @@ -163,10 +163,10 @@ test cmdIL-1.40 {Tcl_LsortObjCmd procedure, Bug 8e1e31eac0fd6b6c} { } [list \0 \x7f \x80 \uffff \U01ffff] test cmdIL-1.41 {lsort -stride and -index} -body { lsort -stride 2 -index -2 {a 2 b 1} -} -returnCodes error -result {index "-2" cannot select an element from any list} +} -returnCodes error -result {index "-2" out of range} test cmdIL-1.42 {lsort -stride and-index} -body { lsort -stride 2 -index -1-1 {a 2 b 1} -} -returnCodes error -result {index "-1-1" cannot select an element from any list} +} -returnCodes error -result {index "-1-1" out of range} # Can't think of any good tests for the MergeSort and MergeLists procedures, # except a bunch of random lists to sort. @@ -228,10 +228,10 @@ test cmdIL-3.5.1 {SortCompare procedure, -index option (out of range, calculated } -returnCodes error -result {element 4 missing from sublist "1 . c"} test cmdIL-3.5.2 {SortCompare procedure, -index option (out of range, calculated index)} -body { lsort -index -1-1 {{1 . c} {2 . b} {3 . a}} -} -returnCodes error -result {index "-1-1" cannot select an element from any list} +} -returnCodes error -result {index "-1-1" out of range} test cmdIL-3.5.3 {SortCompare procedure, -index option (out of range, calculated index)} -body { lsort -index -2 {{1 . c} {2 . b} {3 . a}} -} -returnCodes error -result {index "-2" cannot select an element from any list} +} -returnCodes error -result {index "-2" out of range} test cmdIL-3.5.4 {SortCompare procedure, -index option (out of range, calculated index)} -body { lsort -index end-4 {{1 . c} {2 . b} {3 . a}} } -returnCodes error -result {element end-4 missing from sublist "1 . c"} @@ -243,13 +243,13 @@ test cmdIL-3.5.6 {SortCompare procedure, -index option} { } {a \{} test cmdIL-3.5.7 {SortCompare procedure, -index option (out of range, calculated index)} -body { lsort -index end--1 {{1 . c} {2 . b} {3 . a}} -} -returnCodes error -result {index "end--1" cannot select an element from any list} +} -returnCodes error -result {index "end--1" out of range} test cmdIL-3.5.8 {SortCompare procedure, -index option (out of range, calculated index)} -body { lsort -index end+1 {{1 . c} {2 . b} {3 . a}} -} -returnCodes error -result {index "end+1" cannot select an element from any list} +} -returnCodes error -result {index "end+1" out of range} test cmdIL-3.5.9 {SortCompare procedure, -index option (out of range, calculated index)} -body { lsort -index end+2 {{1 . c} {2 . b} {3 . a}} -} -returnCodes error -result {index "end+2" cannot select an element from any list} +} -returnCodes error -result {index "end+2" out of range} test cmdIL-3.5.10 {SortCompare procedure, -index option (out of range, calculated index)} -body { lsort -index 0 {{}} } -returnCodes error -result {element 0 missing from sublist ""} diff --git a/tests/lpop.test b/tests/lpop.test index 089299b..89b651c 100644 --- a/tests/lpop.test +++ b/tests/lpop.test @@ -29,15 +29,15 @@ test lpop-1.3 {error conditions} -returnCodes error -body { test lpop-1.4 {error conditions} -returnCodes error -body { set no "x y" lpop no -1 -} -result {list index out of range} +} -result {index "-1" out of range} test lpop-1.5 {error conditions} -returnCodes error -body { set no "x y z" lpop no 3 -} -result {list index out of range} ;#-errorCode {TCL OPERATION LPOP BADINDEX} +} -result {index "3" out of range} ;#-errorCode {TCL OPERATION LPOP BADINDEX} test lpop-1.6 {error conditions} -returnCodes error -body { set no "x y" lpop no end+1 -} -result {list index out of range} +} -result {index "end+1" out of range} test lpop-1.7 {error conditions} -returnCodes error -body { set no "x y" lpop no {} @@ -45,7 +45,7 @@ test lpop-1.7 {error conditions} -returnCodes error -body { test lpop-1.8 {error conditions} -returnCodes error -body { set no "x y" lpop no 0 0 0 0 1 -} -result {list index out of range} +} -result {index "1" out of range} test lpop-1.9 {error conditions} -returnCodes error -body { set no "x y" lpop no {1 0} diff --git a/tests/lsearch.test b/tests/lsearch.test index e401581..b188924 100644 --- a/tests/lsearch.test +++ b/tests/lsearch.test @@ -432,19 +432,19 @@ test lsearch-17.11 {lsearch -index option, empty argument} { } [lsearch [list \{] \{] test lsearch-17.12 {lsearch -index option, encoding aliasing} -body { lsearch -index -2 a a -} -returnCodes error -result {index "-2" cannot select an element from any list} +} -returnCodes error -result {index "-2" out of range} test lsearch-17.13 {lsearch -index option, encoding aliasing} -body { lsearch -index -1-1 a a -} -returnCodes error -result {index "-1-1" cannot select an element from any list} +} -returnCodes error -result {index "-1-1" out of range} test lsearch-17.14 {lsearch -index option, encoding aliasing} -body { lsearch -index end--1 a a -} -returnCodes error -result {index "end--1" cannot select an element from any list} +} -returnCodes error -result {index "end--1" out of range} test lsearch-17.15 {lsearch -index option, encoding aliasing} -body { lsearch -index end+1 a a -} -returnCodes error -result {index "end+1" cannot select an element from any list} +} -returnCodes error -result {index "end+1" out of range} test lsearch-17.16 {lsearch -index option, encoding aliasing} -body { lsearch -index end+2 a a -} -returnCodes error -result {index "end+2" cannot select an element from any list} +} -returnCodes error -result {index "end+2" out of range} test lsearch-18.1 {lsearch -index option, list as index basic functionality} { diff --git a/tests/lset.test b/tests/lset.test index 1c1300b..b1ed110 100644 --- a/tests/lset.test +++ b/tests/lset.test @@ -97,31 +97,31 @@ test lset-4.3 {lset, not compiled, 3 args, index out of range} testevalex { list [catch { testevalex {lset a [list -1] w} } msg] $msg -} {1 {list index out of range}} +} {1 {index "-1" out of range}} test lset-4.4 {lset, not compiled, 3 args, index out of range} testevalex { set a {x y z} list [catch { testevalex {lset a [list 4] w} } msg] $msg -} {1 {list index out of range}} +} {1 {index "4" out of range}} test lset-4.5a {lset, not compiled, 3 args, index out of range} testevalex { set a {x y z} list [catch { testevalex {lset a [list end--2] w} } msg] $msg -} {1 {list index out of range}} +} {1 {index "end--2" out of range}} test lset-4.5b {lset, not compiled, 3 args, index out of range} testevalex { set a {x y z} list [catch { testevalex {lset a [list end+2] w} } msg] $msg -} {1 {list index out of range}} +} {1 {index "end+2" out of range}} test lset-4.6 {lset, not compiled, 3 args, index out of range} testevalex { set a {x y z} list [catch { testevalex {lset a [list end-3] w} } msg] $msg -} {1 {list index out of range}} +} {1 {index "end-3" out of range}} test lset-4.7 {lset, not compiled, 3 args, not a list} testevalex { set a "x \{" list [catch { @@ -139,31 +139,31 @@ test lset-4.9 {lset, not compiled, 3 args, index out of range} testevalex { list [catch { testevalex {lset a -1 w} } msg] $msg -} {1 {list index out of range}} +} {1 {index "-1" out of range}} test lset-4.10 {lset, not compiled, 3 args, index out of range} testevalex { set a {x y z} list [catch { testevalex {lset a 4 w} } msg] $msg -} {1 {list index out of range}} +} {1 {index "4" out of range}} test lset-4.11a {lset, not compiled, 3 args, index out of range} testevalex { set a {x y z} list [catch { testevalex {lset a end--2 w} } msg] $msg -} {1 {list index out of range}} +} {1 {index "end--2" out of range}} test lset-4.11 {lset, not compiled, 3 args, index out of range} testevalex { set a {x y z} list [catch { testevalex {lset a end+2 w} } msg] $msg -} {1 {list index out of range}} +} {1 {index "end+2" out of range}} test lset-4.12 {lset, not compiled, 3 args, index out of range} testevalex { set a {x y z} list [catch { testevalex {lset a end-3 w} } msg] $msg -} {1 {list index out of range}} +} {1 {index "end-3" out of range}} test lset-5.1 {lset, not compiled, 3 args, can't set variable} testevalex { list [catch { @@ -281,43 +281,43 @@ test lset-8.4 {lset, not compiled, bad second index} testevalex { test lset-8.5 {lset, not compiled, second index out of range} testevalex { set a {{b c} {d e} {f g}} list [catch {testevalex {lset a 2 -1 h}} msg] $msg -} {1 {list index out of range}} +} {1 {index "-1" out of range}} test lset-8.6 {lset, not compiled, second index out of range} testevalex { set a {{b c} {d e} {f g}} list [catch {testevalex {lset a {2 -1} h}} msg] $msg -} {1 {list index out of range}} +} {1 {index "-1" out of range}} test lset-8.7 {lset, not compiled, second index out of range} testevalex { set a {{b c} {d e} {f g}} list [catch {testevalex {lset a 2 3 h}} msg] $msg -} {1 {list index out of range}} +} {1 {index "3" out of range}} test lset-8.8 {lset, not compiled, second index out of range} testevalex { set a {{b c} {d e} {f g}} list [catch {testevalex {lset a {2 3} h}} msg] $msg -} {1 {list index out of range}} +} {1 {index "3" out of range}} test lset-8.9a {lset, not compiled, second index out of range} testevalex { set a {{b c} {d e} {f g}} list [catch {testevalex {lset a 2 end--2 h}} msg] $msg -} {1 {list index out of range}} +} {1 {index "end--2" out of range}} test lset-8.9b {lset, not compiled, second index out of range} testevalex { set a {{b c} {d e} {f g}} list [catch {testevalex {lset a 2 end+2 h}} msg] $msg -} {1 {list index out of range}} +} {1 {index "end+2" out of range}} test lset-8.10a {lset, not compiled, second index out of range} testevalex { set a {{b c} {d e} {f g}} list [catch {testevalex {lset a {2 end--2} h}} msg] $msg -} {1 {list index out of range}} +} {1 {index "end--2" out of range}} test lset-8.10b {lset, not compiled, second index out of range} testevalex { set a {{b c} {d e} {f g}} list [catch {testevalex {lset a {2 end+2} h}} msg] $msg -} {1 {list index out of range}} +} {1 {index "end+2" out of range}} test lset-8.11 {lset, not compiled, second index out of range} testevalex { set a {{b c} {d e} {f g}} list [catch {testevalex {lset a 2 end-2 h}} msg] $msg -} {1 {list index out of range}} +} {1 {index "end-2" out of range}} test lset-8.12 {lset, not compiled, second index out of range} testevalex { set a {{b c} {d e} {f g}} list [catch {testevalex {lset a {2 end-2} h}} msg] $msg -} {1 {list index out of range}} +} {1 {index "end-2" out of range}} test lset-9.1 {lset, not compiled, entire variable} testevalex { set a x diff --git a/tests/lsetComp.test b/tests/lsetComp.test index 6330de4..32bfd5f 100644 --- a/tests/lsetComp.test +++ b/tests/lsetComp.test @@ -219,7 +219,7 @@ test lsetComp-2.8 {lset, compiled, list of args, error } { set x { {1 2} {3 4} } lset x {1 5} 5 } -} "1 {list index out of range}" +} {1 {index "5" out of range}} test lsetComp-2.9 {lset, compiled, list of args, error - is string preserved} { set ::x { { 1 2 } { 3 4 } } @@ -412,7 +412,7 @@ test lsetComp-3.8 {lset, compiled, flat args, error } { set x { {1 2} {3 4} } lset x 1 5 5 } -} "1 {list index out of range}" +} {1 {index "5" out of range}} test lsetComp-3.9 {lset, compiled, flat args, error - is string preserved} { set ::x { { 1 2 } { 3 4 } } -- cgit v0.12 From ac5f46d2701330d40d72814660be2efa4b69e39f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 2 Mar 2020 11:30:05 +0000 Subject: Don't generate "deprecated" warning for Tcl_Close(), since only the stub entry is deprecated. Will be replaced by macro. --- generic/tcl.decls | 2 +- generic/tclDecls.h | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 8837dfd..2575de1 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -299,7 +299,7 @@ declare 79 { declare 80 { void Tcl_CancelIdleCall(Tcl_IdleProc *idleProc, ClientData clientData) } -declare 81 {deprecated {Use Tcl_CloseEx}} { +declare 81 { int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan) } declare 82 { diff --git a/generic/tclDecls.h b/generic/tclDecls.h index ccea15d..890114a 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -288,8 +288,7 @@ EXTERN void Tcl_CallWhenDeleted(Tcl_Interp *interp, EXTERN void Tcl_CancelIdleCall(Tcl_IdleProc *idleProc, ClientData clientData); /* 81 */ -TCL_DEPRECATED("Use Tcl_CloseEx") -int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan); +EXTERN int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan); /* 82 */ EXTERN int Tcl_CommandComplete(const char *cmd); /* 83 */ @@ -2030,7 +2029,7 @@ typedef struct TclStubs { int (*tcl_BadChannelOption) (Tcl_Interp *interp, const char *optionName, const char *optionList); /* 78 */ void (*tcl_CallWhenDeleted) (Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 79 */ void (*tcl_CancelIdleCall) (Tcl_IdleProc *idleProc, ClientData clientData); /* 80 */ - TCL_DEPRECATED_API("Use Tcl_CloseEx") int (*tcl_Close) (Tcl_Interp *interp, Tcl_Channel chan); /* 81 */ + int (*tcl_Close) (Tcl_Interp *interp, Tcl_Channel chan); /* 81 */ int (*tcl_CommandComplete) (const char *cmd); /* 82 */ char * (*tcl_Concat) (int argc, const char *const *argv); /* 83 */ int (*tcl_ConvertElement) (const char *src, char *dst, int flags); /* 84 */ -- cgit v0.12 From 71e8c4c72b18b1f2e78b53f4ca5d67a029de99d0 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 2 Mar 2020 17:08:01 +0000 Subject: Create a new macro to deal with unused arguments so we can silence compiler warnings without the need of an explosion of noise lines "(void)dummy" --- generic/tcl.h | 10 ++++++++++ generic/tclZlib.c | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 369a894..4e601ca 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -146,6 +146,11 @@ extern "C" { # else # define TCL_NORETURN1 /* nothing */ # endif +# if defined(__cplusplus) +# define TCL_UNUSED(T) T +# else +# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused)) +# endif #else # define TCL_FORMAT_PRINTF(a,b) # if defined(_MSC_VER) && (_MSC_VER >= 1310) @@ -156,6 +161,11 @@ extern "C" { # define TCL_NOINLINE /* nothing */ # endif # define TCL_NORETURN1 /* nothing */ +# if defined(__cplusplus) +# define TCL_UNUSED(T) T +# else +# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) +# endif #endif /* diff --git a/generic/tclZlib.c b/generic/tclZlib.c index ac69511..1ab20fe 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -1920,7 +1920,7 @@ Tcl_ZlibAdler32( static int ZlibCmd( - void *dummy, + TCL_UNUSED(void *), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1939,7 +1939,6 @@ ZlibCmd( CMD_ADLER, CMD_COMPRESS, CMD_CRC, CMD_DECOMPRESS, CMD_DEFLATE, CMD_GUNZIP, CMD_GZIP, CMD_INFLATE, CMD_PUSH, CMD_STREAM }; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "command arg ?...?"); -- cgit v0.12 From 8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Mar 2020 13:42:42 +0000 Subject: Implement WideSeekProc() for all channels which have a SeekProc(). Implement Close2Proc() for all channels, as minimal wrapper around CloseProc(). Backported (with comments) and adapted from core-8-branch. --- generic/tclIO.c | 846 +++++++++++++++++++++++++++----------------------- generic/tclIOGT.c | 48 ++- generic/tclIORChan.c | 150 +++++---- generic/tclIORTrans.c | 95 +++--- unix/tclUnixChan.c | 17 +- win/tclWinChan.c | 18 +- win/tclWinConsole.c | 18 +- win/tclWinSerial.c | 18 +- 8 files changed, 708 insertions(+), 502 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 23280c5..36f0a8e 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -379,20 +379,20 @@ ChanCloseHalf( * * ChanRead -- * - * Read up to dstSize bytes using the inputProc of chanPtr, store - * them at dst, and return the number of bytes stored. + * Read up to dstSize bytes using the inputProc of chanPtr, store them at + * dst, and return the number of bytes stored. * * Results: * The return value of the driver inputProc, * - number of bytes stored at dst, ot - * - -1 on error, with a Posix error code available to the - * caller by calling Tcl_GetErrno(). + * - -1 on error, with a Posix error code available to the caller by + * calling Tcl_GetErrno(). * * Side effects: - * The CHANNEL_BLOCKED and CHANNEL_EOF flags of the channel state are - * set as appropriate. - * On EOF, the inputEncodingFlags are set to perform ending operations - * on decoding. + * The CHANNEL_BLOCKED and CHANNEL_EOF flags of the channel state are set + * as appropriate. On EOF, the inputEncodingFlags are set to perform + * ending operations on decoding. + * * TODO - Is this really the right place for that? * *--------------------------------------------------------------------------- @@ -406,15 +406,17 @@ ChanRead( int bytesRead, result; /* - * If the caller asked for zero bytes, we'd force the inputProc - * to return zero bytes, and then misinterpret that as EOF. + * If the caller asked for zero bytes, we'd force the inputProc to return + * zero bytes, and then misinterpret that as EOF. */ + assert(dstSize > 0); /* * Each read op must set the blocked and eof states anew, not let * the effect of prior reads leak through. */ + if (GotFlag(chanPtr->state, CHANNEL_EOF)) { chanPtr->state->inputEncodingFlags |= TCL_ENCODING_START; } @@ -427,7 +429,10 @@ ChanRead( bytesRead = chanPtr->typePtr->inputProc(chanPtr->instanceData, dst, dstSize, &result); - /* Stop any flag leakage through stacked channel levels */ + /* + * Stop any flag leakage through stacked channel levels. + */ + if (GotFlag(chanPtr->state, CHANNEL_EOF)) { chanPtr->state->inputEncodingFlags |= TCL_ENCODING_START; } @@ -435,10 +440,10 @@ ChanRead( chanPtr->state->inputEncodingFlags &= ~TCL_ENCODING_END; if (bytesRead > 0) { /* - * If we get a short read, signal up that we may be BLOCKED. - * We should avoid calling the driver because on some - * platforms we will block in the low level reading code even - * though the channel is set into nonblocking mode. + * If we get a short read, signal up that we may be BLOCKED. We should + * avoid calling the driver because on some platforms we will block in + * the low level reading code even though the channel is set into + * nonblocking mode. */ if (bytesRead < dstSize) { @@ -571,7 +576,10 @@ TclFinalizeIOSubsystem(void) int active = 1; /* Flag == 1 while there's still work to do */ int doflushnb; - /* Fetch the pre-TIP#398 compatibility flag */ + /* + * Fetch the pre-TIP#398 compatibility flag. + */ + { const char *s; Tcl_DString ds; @@ -616,18 +624,20 @@ TclFinalizeIOSubsystem(void) */ if (active) { - TclChannelPreserve((Tcl_Channel)chanPtr); + /* - * TIP #398: by default, we no longer set the channel back into - * blocking mode. To restore the old blocking behavior, the - * environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT must be set + * TIP #398: by default, we no longer set the channel back into + * blocking mode. To restore the old blocking behavior, the + * environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT must be set * and not be "0". */ + if (doflushnb) { - /* Set the channel back into blocking mode to ensure that we wait - * for all data to flush out. - */ + /* + * Set the channel back into blocking mode to ensure that we + * wait for all data to flush out. + */ (void) Tcl_SetChannelOption(NULL, (Tcl_Channel) chanPtr, "-blocking", "on"); @@ -831,7 +841,7 @@ Tcl_CreateCloseHandler( ChannelState *statePtr = ((Channel *) chan)->state; CloseCallback *cbPtr; - cbPtr = ckalloc(sizeof(CloseCallback)); + cbPtr = (CloseCallback *)ckalloc(sizeof(CloseCallback)); cbPtr->proc = proc; cbPtr->clientData = clientData; @@ -910,9 +920,9 @@ GetChannelTable( Tcl_HashTable *hTblPtr; /* Hash table of channels. */ Tcl_Channel stdinChan, stdoutChan, stderrChan; - hTblPtr = Tcl_GetAssocData(interp, "tclIO", NULL); + hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclIO", NULL); if (hTblPtr == NULL) { - hTblPtr = ckalloc(sizeof(Tcl_HashTable)); + hTblPtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(hTblPtr, TCL_STRING_KEYS); Tcl_SetAssocData(interp, "tclIO", (Tcl_InterpDeleteProc *) DeleteChannelTable, hTblPtr); @@ -980,10 +990,10 @@ DeleteChannelTable( * refcount reaches zero. */ - hTblPtr = clientData; + hTblPtr = (Tcl_HashTable *)clientData; for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch); hPtr != NULL; hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch)) { - chanPtr = Tcl_GetHashValue(hPtr); + chanPtr = (Channel *)Tcl_GetHashValue(hPtr); statePtr = chanPtr->state; /* @@ -1350,7 +1360,7 @@ DetachChannel( statePtr = chanPtr->state; if (interp != NULL) { - hTblPtr = Tcl_GetAssocData(interp, "tclIO", NULL); + hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclIO", NULL); if (hTblPtr == NULL) { return TCL_ERROR; } @@ -1453,7 +1463,7 @@ Tcl_GetChannel( * compensate where necessary to retrieve the topmost channel again. */ - chanPtr = Tcl_GetHashValue(hPtr); + chanPtr = (Channel *)Tcl_GetHashValue(hPtr); chanPtr = chanPtr->state->bottomChanPtr; if (modePtr != NULL) { *modePtr = chanPtr->state->flags & (TCL_READABLE|TCL_WRITABLE); @@ -1497,6 +1507,7 @@ TclGetChannelFromObj( ChannelState *statePtr; ResolvedChanName *resPtr = NULL; Tcl_Channel chan; + (void)flags; if (interp == NULL) { return TCL_ERROR; @@ -1512,8 +1523,10 @@ TclGetChannelFromObj( if ((resPtr->interp == interp) /* Same interp context */ /* No epoch change in channel since lookup */ && (resPtr->epoch == statePtr->epoch)) { + /* + * Have a valid saved lookup. Jump to end to return it. + */ - /* Have a valid saved lookup. Jump to end to return it. */ goto valid; } } @@ -1619,8 +1632,8 @@ Tcl_CreateChannel( * assignments to 0/NULL below. */ - chanPtr = ckalloc(sizeof(Channel)); - statePtr = ckalloc(sizeof(ChannelState)); + chanPtr = (Channel *)ckalloc(sizeof(Channel)); + statePtr = (ChannelState *)ckalloc(sizeof(ChannelState)); chanPtr->state = statePtr; chanPtr->instanceData = instanceData; @@ -1639,10 +1652,10 @@ Tcl_CreateChannel( * later. */ - tmp = ckalloc((len < 7) ? 7 : len); + tmp = (char *)ckalloc((len < 7) ? 7 : len); strcpy(tmp, chanName); } else { - tmp = ckalloc(7); + tmp = (char *)ckalloc(7); tmp[0] = '\0'; } statePtr->channelName = tmp; @@ -1672,7 +1685,7 @@ Tcl_CreateChannel( * Set the channel up initially in AUTO input translation mode to accept * "\n", "\r" and "\r\n". Output translation mode is set to a platform * specific default value. The eofChar is set to 0 for both input and - * output, so that Tcl does not look for an in-file EOF indicator (e.g. + * output, so that Tcl does not look for an in-file EOF indicator (e.g., * ^Z) and does not append an EOF indicator to files. */ @@ -1900,7 +1913,6 @@ Tcl_StackChannel( */ if (((mask & TCL_READABLE) != 0) && (statePtr->inQueueHead != NULL)) { - /* * When statePtr->inQueueHead is not NULL, we know * prevChanPtr->inQueueHead must be NULL. @@ -1916,7 +1928,7 @@ Tcl_StackChannel( statePtr->inQueueTail = NULL; } - chanPtr = ckalloc(sizeof(Channel)); + chanPtr = (Channel *)ckalloc(sizeof(Channel)); /* * Save some of the current state into the new structure, reinitialize the @@ -2032,9 +2044,7 @@ Tcl_UnstackChannel( * of registered channels we wind down the state of the * transformation, and then restore the state of underlying channel * into the old structure. - */ - - /* + * * TODO: Figure out how to handle the situation where the chan * operations called below by this unstacking operation cause * another unstacking recursively. In that case the downChanPtr @@ -2447,7 +2457,7 @@ AllocChannelBuffer( int n; n = length + CHANNELBUFFER_HEADER_SIZE + BUFFER_PADDING + BUFFER_PADDING; - bufPtr = ckalloc(n); + bufPtr = (ChannelBuffer *)ckalloc(n); bufPtr->nextAdded = BUFFER_PADDING; bufPtr->nextRemoved = BUFFER_PADDING; bufPtr->bufLength = length + BUFFER_PADDING; @@ -2512,6 +2522,7 @@ RecycleBuffer( /* * Do we have to free the buffer to the OS? */ + if (IsShared(bufPtr)) { mustDiscard = 1; } @@ -2522,9 +2533,8 @@ RecycleBuffer( } /* - * Only save buffers which have the requested buffersize for the - * channel. This is to honor dynamic changes of the buffersize - * made by the user. + * Only save buffers which have the requested buffersize for the channel. + * This is to honor dynamic changes of the buffersize made by the user. */ if ((bufPtr->bufLength - BUFFER_PADDING) != statePtr->bufSize) { @@ -2694,14 +2704,18 @@ FlushChannel( /* * Should we shift the current output buffer over to the output queue? * First check that there are bytes in it. If so then... - * If the output queue is empty, then yes, trusting the caller called - * us only when written bytes ought to be flushed. - * If the current output buffer is full, then yes, so we can meet - * the post-condition that on a successful return to caller we've - * left space in the current output buffer for more writing (the flush - * call was to make new room). - * If the channel is blocking, then yes, so we guarantee that - * blocking flushes actually flush all pending data. + * + * If the output queue is empty, then yes, trusting the caller called us + * only when written bytes ought to be flushed. + * + * If the current output buffer is full, then yes, so we can meet the + * post-condition that on a successful return to caller we've left space + * in the current output buffer for more writing (the flush call was to + * make new room). + * + * If the channel is blocking, then yes, so we guarantee that blocking + * flushes actually flush all pending data. + * * Otherwise, no. Keep the current output buffer where it is so more * can be written to it, possibly filling it, to promote more efficient * buffer usage. @@ -2795,8 +2809,8 @@ FlushChannel( /* * TIP #219, Tcl Channel Reflection API. * When defering the error copy a message from the bypass into - * the unreported area. Or discard it if the new error is to be - * ignored in favor of an earlier defered error. + * the unreported area. Or discard it if the new error is to + * be ignored in favor of an earlier defered error. */ Tcl_Obj *msg = statePtr->chanMsg; @@ -2848,8 +2862,11 @@ FlushChannel( ReleaseChannelBuffer(bufPtr); break; } else { - /* TODO: Consider detecting and reacting to short writes - * on blocking channels. Ought not happen. See iocmd-24.2. */ + /* + * TODO: Consider detecting and reacting to short writes on + * blocking channels. Ought not happen. See iocmd-24.2. + */ + wroteSome = 1; } @@ -2883,7 +2900,6 @@ FlushChannel( ResetFlag(statePtr, BG_FLUSH_SCHEDULED); ChanWatch(chanPtr, statePtr->interestMask); } else { - /* * When we are calledFromAsyncFlush, that means a writable * state on the channel triggered the call, so we should be @@ -2928,7 +2944,8 @@ FlushChannel( (statePtr->outQueueHead == NULL) && ((statePtr->curOutPtr == NULL) || IsBufferEmpty(statePtr->curOutPtr))) { - errorCode = CloseChannelPart(interp, chanPtr, errorCode, TCL_CLOSE_WRITE); + errorCode = CloseChannelPart(interp, chanPtr, errorCode, + TCL_CLOSE_WRITE); goto done; } @@ -3350,7 +3367,7 @@ Tcl_Close( * channel. */ Channel *chanPtr; /* The real IO channel. */ ChannelState *statePtr; /* State of real IO channel. */ - int result; /* Of calling FlushChannel. */ + int result = 0; /* Of calling FlushChannel. */ int flushcode; int stickyError; @@ -3399,7 +3416,6 @@ Tcl_Close( if (GotFlag(statePtr, TCL_WRITABLE) && (statePtr->encoding != NULL) && !(statePtr->outputEncodingFlags & TCL_ENCODING_START)) { - int code = CheckChannelErrors(statePtr, TCL_WRITABLE); if (code == 0) { @@ -3450,8 +3466,9 @@ Tcl_Close( if (chanPtr->typePtr->closeProc == TCL_CLOSE2PROC) { result = chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, TCL_CLOSE_READ); - } else { - result = 0; + if (result == EINVAL) { + result = 0; + } } /* @@ -3489,12 +3506,14 @@ Tcl_Close( } return TCL_ERROR; } + /* * Bug 97069ea11a: set error message if a flush code is set and no error * message set up to now. */ + if (flushcode != 0 && interp != NULL - && 0 == Tcl_GetCharLength(Tcl_GetObjResult(interp)) ) { + && 0 == Tcl_GetCharLength(Tcl_GetObjResult(interp))) { Tcl_SetErrno(flushcode); Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_PosixError(interp), -1)); @@ -3521,7 +3540,7 @@ Tcl_Close( * NOTE: * Tcl_CloseEx closes the specified direction of the channel as far as * the user is concerned. The channel keeps existing however. You cannot - * calls this function to close the last possible direction of the + * call this function to close the last possible direction of the * channel. Use Tcl_Close for that. * *---------------------------------------------------------------------- @@ -3542,18 +3561,26 @@ Tcl_CloseEx( return TCL_OK; } - /* TODO: assert flags validity ? */ - chanPtr = (Channel *) chan; statePtr = chanPtr->state; + if ((flags & (TCL_READABLE | TCL_WRITABLE)) == 0) { + return Tcl_Close(interp, chan); + } + if ((flags & (TCL_READABLE | TCL_WRITABLE)) == (TCL_READABLE | TCL_WRITABLE)) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "double-close of channels not supported by %ss", + chanPtr->typePtr->typeName)); + return TCL_ERROR; + } + /* * Does the channel support half-close anyway? Error if not. */ if (!chanPtr->typePtr->close2Proc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "half-close of channels not supported by %ss", + "half-close of channels not supported by %ss", chanPtr->typePtr->typeName)); return TCL_ERROR; } @@ -3589,8 +3616,8 @@ Tcl_CloseEx( } /* - * A user may try to call half-close from within a channel close - * handler. That won't do. + * A user may try to call half-close from within a channel close handler. + * That won't do. */ if (statePtr->flags & CHANNEL_INCLOSE) { @@ -3661,9 +3688,12 @@ CloseWrite( * closed. May still be used by some * interpreter */ { - /* Notes: clear-channel-handlers - write side only ? or keep around, just - * not called. */ - /* No close cllbacks are run - channel is still open (read side) */ + /* + * Notes: clear-channel-handlers - write side only ? or keep around, just + * not called. + * + * No close callbacks are run - channel is still open (read side) + */ ChannelState *statePtr = chanPtr->state; /* State of real IO channel. */ @@ -3688,9 +3718,9 @@ CloseWrite( * Notes: Due to the assertion of CHANNEL_CLOSEDWRITE in the flags * FlushChannel() has called CloseChannelPart(). While we can still access * "chan" (no structures were freed), the only place which may still - * contain a message is the interpreter itself, and "CloseChannelPart" made - * sure to lift any channel message it generated into it. Hence the NULL - * argument in the call below. + * contain a message is the interpreter itself, and "CloseChannelPart" + * made sure to lift any channel message it generated into it. Hence the + * NULL argument in the call below. */ if (TclChanCaughtErrorBypass(interp, NULL)) { @@ -3914,10 +3944,10 @@ Tcl_ClearChannelHandlers( StopCopy(statePtr->csPtrW); /* - * Must set the interest mask now to 0, otherwise infinite loops - * will occur if Tcl_DoOneEvent is called before the channel is - * finally deleted in FlushChannel. This can happen if the channel - * has a background flush active. + * Must set the interest mask now to 0, otherwise infinite loops will + * occur if Tcl_DoOneEvent is called before the channel is finally deleted + * in FlushChannel. This can happen if the channel has a background flush + * active. */ statePtr->interestMask = 0; @@ -4173,11 +4203,11 @@ WillWrite( int inputBuffered; if ((Tcl_ChannelSeekProc(chanPtr->typePtr) != NULL) && - ((inputBuffered = Tcl_InputBuffered((Tcl_Channel) chanPtr)) > 0)){ - int ignore; + ((inputBuffered = Tcl_InputBuffered((Tcl_Channel) chanPtr)) > 0)){ + int ignore; - DiscardInputQueued(chanPtr->state, 0); - ChanSeek(chanPtr, -inputBuffered, SEEK_CUR, &ignore); + DiscardInputQueued(chanPtr->state, 0); + ChanSeek(chanPtr, -inputBuffered, SEEK_CUR, &ignore); } } @@ -4186,7 +4216,10 @@ WillRead( Channel *chanPtr) { if (chanPtr->typePtr == NULL) { - /* Prevent read attempts on a closed channel */ + /* + * Prevent read attempts on a closed channel. + */ + DiscardInputQueued(chanPtr->state, 0); Tcl_SetErrno(EINVAL); return -1; @@ -4195,13 +4228,13 @@ WillRead( && (Tcl_OutputBuffered((Tcl_Channel) chanPtr) > 0)) { /* - * CAVEAT - The assumption here is that FlushChannel() will - * push out the bytes of any writes that are in progress. - * Since this is a seekable channel, we assume it is not one - * that can block and force bg flushing. Channels we know that - * can do that -- sockets, pipes -- are not seekable. If the - * assumption is wrong, more drastic measures may be required here - * like temporarily setting the channel into blocking mode. + * CAVEAT - The assumption here is that FlushChannel() will push out + * the bytes of any writes that are in progress. Since this is a + * seekable channel, we assume it is not one that can block and force + * bg flushing. Channels we know that can do that - sockets, pipes - + * are not seekable. If the assumption is wrong, more drastic measures + * may be required here like temporarily setting the channel into + * blocking mode. */ if (FlushChannel(NULL, chanPtr, 0) != 0) { @@ -4256,7 +4289,7 @@ Write( if (GotFlag(statePtr, CHANNEL_LINEBUFFERED) || (statePtr->outputTranslation != TCL_TRANSLATE_LF)) { - nextNewLine = memchr(src, '\n', srcLen); + nextNewLine = (char *)memchr(src, '\n', srcLen); } while (srcLen + saved + endEncoding > 0) { @@ -4293,11 +4326,17 @@ Write( &statePtr->outputEncodingState, dst, dstLen + BUFFER_PADDING, &srcRead, &dstWrote, NULL); - /* See chan-io-1.[89]. Tcl Bug 506297. */ + /* + * See chan-io-1.[89]. Tcl Bug 506297. + */ + statePtr->outputEncodingFlags &= ~TCL_ENCODING_START; if ((result != TCL_OK) && (srcRead + dstWrote == 0)) { - /* We're reading from invalid/incomplete UTF-8 */ + /* + * We're reading from invalid/incomplete UTF-8. + */ + ReleaseChannelBuffer(bufPtr); if (total == 0) { Tcl_SetErrno(EINVAL); @@ -4337,11 +4376,10 @@ Write( } result |= Tcl_UtfToExternal(NULL, encoding, nl, nlLen, - statePtr->outputEncodingFlags, - &statePtr->outputEncodingState, dst, - dstLen + BUFFER_PADDING, &srcRead, &dstWrote, NULL); - - assert (srcRead == nlLen); + statePtr->outputEncodingFlags, + &statePtr->outputEncodingState, dst, + dstLen + BUFFER_PADDING, &srcRead, &dstWrote, NULL); + assert(srcRead == nlLen); bufPtr->nextAdded += dstWrote; src++; @@ -4349,21 +4387,21 @@ Write( total += dstWrote; dst += dstWrote; dstLen -= dstWrote; - nextNewLine = memchr(src, '\n', srcLen); + nextNewLine = (char *)memchr(src, '\n', srcLen); needNlFlush = 1; } if (IsBufferOverflowing(bufPtr)) { /* - * When translating from UTF-8 to external encoding, we - * allowed the translation to produce a character that crossed - * the end of the output buffer, so that we would get a - * completely full buffer before flushing it. The extra bytes - * will be moved to the beginning of the next buffer. + * When translating from UTF-8 to external encoding, we allowed + * the translation to produce a character that crossed the end of + * the output buffer, so that we would get a completely full + * buffer before flushing it. The extra bytes will be moved to the + * beginning of the next buffer. */ saved = -SpaceLeft(bufPtr); - memcpy(safe, dst + dstLen, (size_t) saved); + memcpy(safe, dst + dstLen, saved); bufPtr->nextAdded = bufPtr->bufLength; } @@ -4379,15 +4417,16 @@ Write( flushed += statePtr->bufSize; /* - * We just flushed. So if we have needNlFlush set to record - * that we need to flush because theres a (translated) newline - * in the buffer, that's likely not true any more. But there - * is a tricky exception. If we have saved bytes that did not - * really get flushed and those bytes came from a translation - * of a newline as the last thing taken from the src array, - * then needNlFlush needs to remain set to flag that the - * next buffer still needs a newline flush. + * We just flushed. So if we have needNlFlush set to record that + * we need to flush because theres a (translated) newline in the + * buffer, that's likely not true any more. But there is a tricky + * exception. If we have saved bytes that did not really get + * flushed and those bytes came from a translation of a newline as + * the last thing taken from the src array, then needNlFlush needs + * to remain set to flag that the next buffer still needs a + * newline flush. */ + if (needNlFlush && (saved == 0 || src[-1] != '\n')) { needNlFlush = 0; } @@ -4493,8 +4532,8 @@ Tcl_GetsObj( if (GotFlag(statePtr, CHANNEL_STICKY_EOF)) { SetFlag(statePtr, CHANNEL_EOF); - assert( statePtr->inputEncodingFlags & TCL_ENCODING_END ); - assert( !GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR) ); + assert(statePtr->inputEncodingFlags & TCL_ENCODING_END); + assert(!GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR)); /* TODO: Do we need this? */ UpdateInterest(chanPtr); @@ -4659,14 +4698,14 @@ Tcl_GetsObj( * Skip the raw bytes that make up the '\n'. */ - char tmp[TCL_UTF_MAX]; int rawRead; + char tmp[TCL_UTF_MAX]; bufPtr = gs.bufPtr; Tcl_ExternalToUtf(NULL, gs.encoding, RemovePoint(bufPtr), gs.rawRead, statePtr->inputEncodingFlags | TCL_ENCODING_NO_TERMINATE, &gs.state, tmp, - TCL_UTF_MAX, &rawRead, NULL, NULL); + sizeof(tmp), &rawRead, NULL, NULL); bufPtr->nextRemoved += rawRead; gs.rawRead -= rawRead; gs.bytesWrote--; @@ -4834,17 +4873,17 @@ Tcl_GetsObj( */ done: - assert(!GotFlag(statePtr, CHANNEL_EOF) - || GotFlag(statePtr, CHANNEL_STICKY_EOF) - || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); - - assert( !(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) - == (CHANNEL_EOF|CHANNEL_BLOCKED)) ); + assert(!GotFlag(statePtr, CHANNEL_EOF) + || GotFlag(statePtr, CHANNEL_STICKY_EOF) + || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); + assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) + == (CHANNEL_EOF|CHANNEL_BLOCKED))); /* * Regenerate the top channel, in case it was changed due to * self-modifying reflected transforms. */ + if (chanPtr != statePtr->topChanPtr) { TclChannelRelease((Tcl_Channel)chanPtr); chanPtr = statePtr->topChanPtr; @@ -4864,10 +4903,9 @@ Tcl_GetsObj( * end-of-line or end-of-file has been seen. Bytes read from the input * channel return as a ByteArray obj. * - * WARNING! The notion of "binary" used here is different from - * notions of "binary" used in other places. In particular, this - * "binary" routine may be called when an -eofchar is set on the - * channel. + * WARNING! The notion of "binary" used here is different from notions + * of "binary" used in other places. In particular, this "binary" routine + * may be called when an -eofchar is set on the channel. * * Results: * Number of characters accumulated in the object or -1 if error, @@ -4933,8 +4971,8 @@ TclGetsObjBinary( ResetFlag(statePtr, CHANNEL_BLOCKED); while (1) { /* - * Subtract the number of bytes that were removed from channel - * buffer during last call. + * Subtract the number of bytes that were removed from channel buffer + * during last call. */ if (bufPtr != NULL) { @@ -4946,10 +4984,11 @@ TclGetsObjBinary( if ((bufPtr == NULL) || (bufPtr->nextAdded == BUFFER_PADDING)) { /* - * All channel buffers were exhausted and the caller still - * hasn't seen EOL. Need to read more bytes from the channel - * device. Side effect is to allocate another channel buffer. + * All channel buffers were exhausted and the caller still hasn't + * seen EOL. Need to read more bytes from the channel device. Side + * effect is to allocate another channel buffer. */ + if (GetInput(chanPtr) != 0) { goto restore; } @@ -4959,15 +4998,15 @@ TclGetsObjBinary( } } else { /* - * Incoming CHANNEL_STICKY_EOF is filtered out on entry. - * A new CHANNEL_STICKY_EOF set in this routine leads to - * return before coming back here. When we are not dealing - * with CHANNEL_STICKY_EOF, a CHANNEL_EOF implies an - * empty buffer. Here the buffer is non-empty so we know - * we're a non-EOF */ + * Incoming CHANNEL_STICKY_EOF is filtered out on entry. A new + * CHANNEL_STICKY_EOF set in this routine leads to return before + * coming back here. When we are not dealing with + * CHANNEL_STICKY_EOF, a CHANNEL_EOF implies an empty buffer. + * Here the buffer is non-empty so we know we're a non-EOF. + */ - assert ( !GotFlag(statePtr, CHANNEL_STICKY_EOF) ); - assert ( !GotFlag(statePtr, CHANNEL_EOF) ); + assert(!GotFlag(statePtr, CHANNEL_STICKY_EOF)); + assert(!GotFlag(statePtr, CHANNEL_EOF)); } dst = (unsigned char *) RemovePoint(bufPtr); @@ -5034,13 +5073,13 @@ TclGetsObjBinary( } /* - * Copy bytes from the channel buffer to the ByteArray. - * This may realloc space, so keep track of result. + * Copy bytes from the channel buffer to the ByteArray. This may + * realloc space, so keep track of result. */ rawLen = dstEnd - dst; byteArray = Tcl_SetByteArrayLength(objPtr, byteLen + rawLen); - memcpy(byteArray + byteLen, dst, (size_t) rawLen); + memcpy(byteArray + byteLen, dst, rawLen); byteLen += rawLen; } @@ -5057,7 +5096,7 @@ TclGetsObjBinary( rawLen = eol - dst; byteArray = Tcl_SetByteArrayLength(objPtr, byteLen + rawLen); - memcpy(byteArray + byteLen, dst, (size_t) rawLen); + memcpy(byteArray + byteLen, dst, rawLen); byteLen += rawLen; bufPtr->nextRemoved += rawLen + skip; @@ -5119,11 +5158,11 @@ TclGetsObjBinary( */ done: - assert(!GotFlag(statePtr, CHANNEL_EOF) - || GotFlag(statePtr, CHANNEL_STICKY_EOF) - || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); - assert( !(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) - == (CHANNEL_EOF|CHANNEL_BLOCKED)) ); + assert(!GotFlag(statePtr, CHANNEL_EOF) + || GotFlag(statePtr, CHANNEL_STICKY_EOF) + || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); + assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) + == (CHANNEL_EOF|CHANNEL_BLOCKED))); UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return copiedTotal; @@ -5148,6 +5187,7 @@ FreeBinaryEncoding( ClientData dummy) /* Not used */ { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + (void)dummy; if (tsdPtr->binaryEncoding != NULL) { Tcl_FreeEncoding(tsdPtr->binaryEncoding); @@ -5256,15 +5296,15 @@ FilterInputBytes( } } else { /* - * Incoming CHANNEL_STICKY_EOF is filtered out on entry. - * A new CHANNEL_STICKY_EOF set in this routine leads to - * return before coming back here. When we are not dealing - * with CHANNEL_STICKY_EOF, a CHANNEL_EOF implies an - * empty buffer. Here the buffer is non-empty so we know - * we're a non-EOF */ + * Incoming CHANNEL_STICKY_EOF is filtered out on entry. A new + * CHANNEL_STICKY_EOF set in this routine leads to return before + * coming back here. When we are not dealing with CHANNEL_STICKY_EOF, + * a CHANNEL_EOF implies an empty buffer. Here the buffer is + * non-empty so we know we're a non-EOF. + */ - assert ( !GotFlag(statePtr, CHANNEL_STICKY_EOF) ); - assert ( !GotFlag(statePtr, CHANNEL_EOF) ); + assert(!GotFlag(statePtr, CHANNEL_STICKY_EOF)); + assert(!GotFlag(statePtr, CHANNEL_EOF)); } /* @@ -5594,7 +5634,9 @@ Tcl_ReadRaw( return -1; } - /* First read bytes from the push-back buffers. */ + /* + * First read bytes from the push-back buffers. + */ while (chanPtr->inQueueHead && bytesToRead > 0) { ChannelBuffer *bufPtr = chanPtr->inQueueHead; @@ -5602,15 +5644,19 @@ Tcl_ReadRaw( int toCopy = (bytesInBuffer < bytesToRead) ? bytesInBuffer : bytesToRead; - /* Copy the current chunk into the read buffer. */ + /* + * Copy the current chunk into the read buffer. + */ - memcpy(readBuf, RemovePoint(bufPtr), (size_t) toCopy); + memcpy(readBuf, RemovePoint(bufPtr), toCopy); bufPtr->nextRemoved += toCopy; copied += toCopy; readBuf += toCopy; bytesToRead -= toCopy; - /* If the current buffer is empty recycle it. */ + /* + * If the current buffer is empty recycle it. + */ if (IsBufferEmpty(bufPtr)) { chanPtr->inQueueHead = bufPtr->nextPtr; @@ -5622,37 +5668,40 @@ Tcl_ReadRaw( } /* - * Go to the driver only if we got nothing from pushback. - * Have to do it this way to avoid EOF mis-timings when we - * consider the ability that EOF may not be a permanent - * condition in the driver, and in that case we have to - * synchronize. + * Go to the driver only if we got nothing from pushback. Have to do it + * this way to avoid EOF mis-timings when we consider the ability that EOF + * may not be a permanent condition in the driver, and in that case we + * have to synchronize. */ if (copied) { return copied; } - /* This test not needed. */ - if (bytesToRead > 0) { + /* + * This test not needed. + */ + if (bytesToRead > 0) { int nread = ChanRead(chanPtr, readBuf, bytesToRead); if (nread > 0) { - /* Successful read (short is OK) - add to bytes copied */ + /* + * Successful read (short is OK) - add to bytes copied. + */ + copied += nread; } else if (nread < 0) { /* - * An error signaled. If CHANNEL_BLOCKED, then the error - * is not real, but an indication of blocked state. In - * that case, retain the flag and let caller receive the - * short read of copied bytes from the pushback. - * HOWEVER, if copied==0 bytes from pushback then repeat - * signalling the blocked state as an error to caller so - * there is no false report of an EOF. - * When !CHANNEL_BLOCKED, the error is real and passes on - * to caller. + * An error signaled. If CHANNEL_BLOCKED, then the error is not + * real, but an indication of blocked state. In that case, retain + * the flag and let caller receive the short read of copied bytes + * from the pushback. HOWEVER, if copied==0 bytes from pushback + * then repeat signalling the blocked state as an error to caller + * so there is no false report of an EOF. When !CHANNEL_BLOCKED, + * the error is real and passes on to caller. */ + if (!GotFlag(statePtr, CHANNEL_BLOCKED) || copied == 0) { copied = -1; } @@ -5789,21 +5838,23 @@ DoReadChars( /* * Early out when next read will see eofchar. * - * NOTE: See DoRead for argument that it's a bug (one we're keeping) - * to have this escape before the one for zero-char read request. + * NOTE: See DoRead for argument that it's a bug (one we're keeping) to + * have this escape before the one for zero-char read request. */ if (GotFlag(statePtr, CHANNEL_STICKY_EOF)) { SetFlag(statePtr, CHANNEL_EOF); - assert( statePtr->inputEncodingFlags & TCL_ENCODING_END ); - assert( !GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR) ); + assert(statePtr->inputEncodingFlags & TCL_ENCODING_END); + assert(!GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR)); /* TODO: We don't need this call? */ UpdateInterest(chanPtr); return 0; } - /* Special handling for zero-char read request. */ + /* + * Special handling for zero-char read request. + */ if (toRead == 0) { if (GotFlag(statePtr, CHANNEL_EOF)) { statePtr->inputEncodingFlags |= TCL_ENCODING_START; @@ -5822,7 +5873,10 @@ DoReadChars( chanPtr = statePtr->topChanPtr; TclChannelPreserve((Tcl_Channel)chanPtr); - /* Must clear the BLOCKED|EOF flags here since we check before reading */ + /* + * Must clear the BLOCKED|EOF flags here since we check before reading. + */ + if (GotFlag(statePtr, CHANNEL_EOF)) { statePtr->inputEncodingFlags |= TCL_ENCODING_START; } @@ -5880,10 +5934,11 @@ DoReadChars( } /* - * Failure to fill a channel buffer may have left channel reporting - * a "blocked" state, but so long as we fulfilled the request here, - * the caller does not consider us blocked. + * Failure to fill a channel buffer may have left channel reporting a + * "blocked" state, but so long as we fulfilled the request here, the + * caller does not consider us blocked. */ + if (toRead == 0) { ResetFlag(statePtr, CHANNEL_BLOCKED); } @@ -5892,6 +5947,7 @@ DoReadChars( * Regenerate the top channel, in case it was changed due to * self-modifying reflected transforms. */ + if (chanPtr != statePtr->topChanPtr) { TclChannelRelease((Tcl_Channel)chanPtr); chanPtr = statePtr->topChanPtr; @@ -5902,11 +5958,12 @@ DoReadChars( * Update the notifier state so we don't block while there is still data * in the buffers. */ - assert(!GotFlag(statePtr, CHANNEL_EOF) - || GotFlag(statePtr, CHANNEL_STICKY_EOF) - || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); - assert( !(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) - == (CHANNEL_EOF|CHANNEL_BLOCKED)) ); + + assert(!GotFlag(statePtr, CHANNEL_EOF) + || GotFlag(statePtr, CHANNEL_STICKY_EOF) + || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); + assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) + == (CHANNEL_EOF|CHANNEL_BLOCKED))); UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return copied; @@ -6023,11 +6080,10 @@ ReadChars( int numBytes, srcLen = BytesLeft(bufPtr); /* - * One src byte can yield at most one character. So when the - * number of src bytes we plan to read is less than the limit on - * character count to be read, clearly we will remain within that - * limit, and we can use the value of "srcLen" as a tighter limit - * for sizing receiving buffers. + * One src byte can yield at most one character. So when the number of + * src bytes we plan to read is less than the limit on character count to + * be read, clearly we will remain within that limit, and we can use the + * value of "srcLen" as a tighter limit for sizing receiving buffers. */ int toRead = ((charsToRead<0)||(charsToRead > srcLen)) ? srcLen : charsToRead; @@ -6045,6 +6101,7 @@ ReadChars( Tcl_AppendToObj(objPtr, NULL, dstLimit); if (toRead == srcLen) { unsigned int size; + dst = TclGetStringStorage(objPtr, &size) + numBytes; dstLimit = size - numBytes; } else { @@ -6052,19 +6109,18 @@ ReadChars( } /* - * This routine is burdened with satisfying several constraints. - * It cannot append more than 'charsToRead` chars onto objPtr. - * This is measured after encoding and translation transformations - * are completed. There is no precise number of src bytes that can - * be associated with the limit. Yet, when we are done, we must know - * precisely the number of src bytes that were consumed to produce - * the appended chars, so that all subsequent bytes are left in - * the buffers for future read operations. + * This routine is burdened with satisfying several constraints. It cannot + * append more than 'charsToRead` chars onto objPtr. This is measured + * after encoding and translation transformations are completed. There is + * no precise number of src bytes that can be associated with the limit. + * Yet, when we are done, we must know precisely the number of src bytes + * that were consumed to produce the appended chars, so that all + * subsequent bytes are left in the buffers for future read operations. * - * The consequence is that we have no choice but to implement a - * "trial and error" approach, where in general we may need to - * perform transformations and copies multiple times to achieve - * a consistent set of results. This takes the shape of a loop. + * The consequence is that we have no choice but to implement a "trial and + * error" approach, where in general we may need to perform + * transformations and copies multiple times to achieve a consistent set + * of results. This takes the shape of a loop. */ while (1) { @@ -6077,18 +6133,17 @@ ReadChars( } /* - * Perform the encoding transformation. Read no more than - * srcLen bytes, write no more than dstLimit bytes. + * Perform the encoding transformation. Read no more than srcLen + * bytes, write no more than dstLimit bytes. * - * Some trickiness with encoding flags here. We do not want - * the end of a buffer to be treated as the end of all input - * when the presence of bytes in a next buffer are already - * known to exist. This is checked with an assert() because - * so far no test case causing the assertion to be false has - * been created. The normal operations of channel reading - * appear to cause EOF and TCL_ENCODING_END setting to appear - * only in situations where there are no further bytes in - * any buffers. + * Some trickiness with encoding flags here. We do not want the end + * of a buffer to be treated as the end of all input when the presence + * of bytes in a next buffer are already known to exist. This is + * checked with an assert() because so far no test case causing the + * assertion to be false has been created. The normal operations of + * channel reading appear to cause EOF and TCL_ENCODING_END setting to + * appear only in situations where there are no further bytes in any + * buffers. */ assert(bufPtr->nextPtr == NULL || BytesLeft(bufPtr->nextPtr) == 0 @@ -6099,10 +6154,10 @@ ReadChars( dst, dstLimit, &srcRead, &dstDecoded, &numChars); /* - * Perform the translation transformation in place. Read no more - * than the dstDecoded bytes the encoding transformation actually - * produced. Capture the number of bytes written in dstWrote. - * Capture the number of bytes actually consumed in dstRead. + * Perform the translation transformation in place. Read no more than + * the dstDecoded bytes the encoding transformation actually produced. + * Capture the number of bytes written in dstWrote. Capture the number + * of bytes actually consumed in dstRead. */ dstWrote = dstLimit; @@ -6110,11 +6165,9 @@ ReadChars( TranslateInputEOL(statePtr, dst, dst, &dstWrote, &dstRead); if (dstRead < dstDecoded) { - /* - * The encoding transformation produced bytes that the - * translation transformation did not consume. Why did - * this happen? + * The encoding transformation produced bytes that the translation + * transformation did not consume. Why did this happen? */ if (statePtr->inEofChar && dst[dstRead] == statePtr->inEofChar) { @@ -6123,43 +6176,41 @@ ReadChars( * we saw it and stopped translating at that point. * * NOTE the bizarre spec of TranslateInputEOL in this case. - * Clearly the eof char had to be read in order to account - * for the stopping, but the value of dstRead does not - * include it. + * Clearly the eof char had to be read in order to account for + * the stopping, but the value of dstRead does not include it. * - * Also rather bizarre, our caller can only notice an - * EOF condition if we return the value -1 as the number - * of chars read. This forces us to perform a 2-call - * dance where the first call can read all the chars - * up to the eof char, and the second call is solely - * for consuming the encoded eof char then pointed at - * by src so that we can return that magic -1 value. - * This seems really wasteful, especially since - * the first decoding pass of each call is likely to - * decode many bytes beyond that eof char that's all we - * care about. + * Also rather bizarre, our caller can only notice an EOF + * condition if we return the value -1 as the number of chars + * read. This forces us to perform a 2-call dance where the + * first call can read all the chars up to the eof char, and + * the second call is solely for consuming the encoded eof + * char then pointed at by src so that we can return that + * magic -1 value. This seems really wasteful, especially + * since the first decoding pass of each call is likely to + * decode many bytes beyond that eof char that's all we care + * about. */ if (dstRead == 0) { /* - * Curious choice in the eof char handling. We leave - * the eof char in the buffer. So, no need to compute - * a proper srcRead value. At this point, there - * are no chars before the eof char in the buffer. + * Curious choice in the eof char handling. We leave the + * eof char in the buffer. So, no need to compute a proper + * srcRead value. At this point, there are no chars before + * the eof char in the buffer. */ + Tcl_SetObjLength(objPtr, numBytes); return -1; } { /* - * There are chars leading the buffer before the eof - * char. Adjust the dstLimit so we go back and read - * only those and do not encounter the eof char this - * time. + * There are chars leading the buffer before the eof char. + * Adjust the dstLimit so we go back and read only those + * and do not encounter the eof char this time. */ - dstLimit = dstRead - 1 + TCL_UTF_MAX; + dstLimit = dstRead + (TCL_UTF_MAX - 1); statePtr->flags = savedFlags; statePtr->inputEncodingFlags = savedIEFlags; statePtr->inputEncodingState = savedState; @@ -6168,10 +6219,9 @@ ReadChars( } /* - * 2) The other way to read fewer bytes than are decoded - * is when the final byte is \r and we're in a CRLF - * translation mode so we cannot decide whether to - * record \r or \n yet. + * 2) The other way to read fewer bytes than are decoded is when + * the final byte is \r and we're in a CRLF translation mode so + * we cannot decide whether to record \r or \n yet. */ assert(dst[dstRead] == '\r'); @@ -6179,13 +6229,13 @@ ReadChars( if (dstWrote > 0) { /* - * There are chars we can read before we hit the bare cr. - * Go back with a smaller dstLimit so we get them in the - * next pass, compute a matching srcRead, and don't end - * up back here in this call. + * There are chars we can read before we hit the bare CR. Go + * back with a smaller dstLimit so we get them in the next + * pass, compute a matching srcRead, and don't end up back + * here in this call. */ - dstLimit = dstRead - 1 + TCL_UTF_MAX; + dstLimit = dstRead + (TCL_UTF_MAX - 1); statePtr->flags = savedFlags; statePtr->inputEncodingFlags = savedIEFlags; statePtr->inputEncodingState = savedState; @@ -6196,14 +6246,14 @@ ReadChars( assert(dstRead == 0); /* - * We decoded only the bare cr, and we cannot read a - * translated char from that alone. We have to know what's - * next. So why do we only have the one decoded char? + * We decoded only the bare CR, and we cannot read a translated + * char from that alone. We have to know what's next. So why do + * we only have the one decoded char? */ if (code != TCL_OK) { - char buffer[TCL_UTF_MAX + 1]; int read, decoded, count; + char buffer[TCL_UTF_MAX + 1]; /* * Didn't get everything the buffer could offer @@ -6219,7 +6269,7 @@ ReadChars( Tcl_ExternalToUtf(NULL, encoding, src, srcLen, (statePtr->inputEncodingFlags | TCL_ENCODING_NO_TERMINATE), - &statePtr->inputEncodingState, buffer, TCL_UTF_MAX + 1, + &statePtr->inputEncodingState, buffer, sizeof(buffer), &read, &decoded, &count); if (count == 2) { @@ -6239,10 +6289,9 @@ ReadChars( } } else if (statePtr->flags & CHANNEL_EOF) { - /* - * The bare \r is the only char and we will never read - * a subsequent char to make the determination. + * The bare \r is the only char and we will never read a + * subsequent char to make the determination. */ dst[0] = '\r'; @@ -6252,8 +6301,8 @@ ReadChars( } /* - * Revise the dstRead value so that the numChars calc - * below correctly computes zero characters read. + * Revise the dstRead value so that the numChars calc below + * correctly computes zero characters read. */ dstRead = numChars; @@ -6262,9 +6311,9 @@ ReadChars( } /* - * The translation transformation can only reduce the number - * of chars when it converts \r\n into \n. The reduction in - * the number of chars is the difference in bytes read and written. + * The translation transformation can only reduce the number of chars + * when it converts \r\n into \n. The reduction in the number of chars + * is the difference in bytes read and written. */ numChars -= (dstRead - dstWrote); @@ -6274,13 +6323,12 @@ ReadChars( /* * TODO: This cannot happen anymore. * - * We read more chars than allowed. Reset limits to - * prevent that and try again. Don't forget the extra - * padding of TCL_UTF_MAX bytes demanded by the - * Tcl_ExternalToUtf() call! + * We read more chars than allowed. Reset limits to prevent that + * and try again. Don't forget the extra padding of TCL_UTF_MAX + * bytes demanded by the Tcl_ExternalToUtf() call! */ - dstLimit = Tcl_UtfAtIndex(dst, charsToRead) - 1 + TCL_UTF_MAX - dst; + dstLimit = Tcl_UtfAtIndex(dst, charsToRead) - dst + (TCL_UTF_MAX - 1); statePtr->flags = savedFlags; statePtr->inputEncodingFlags = savedIEFlags; statePtr->inputEncodingState = savedState; @@ -6290,18 +6338,19 @@ ReadChars( if (dstWrote == 0) { ChannelBuffer *nextPtr; - /* We were not able to read any chars. */ + /* + * We were not able to read any chars. + */ - assert (numChars == 0); + assert(numChars == 0); /* - * There is one situation where this is the correct final - * result. If the src buffer contains only a single \n - * byte, and we are in TCL_TRANSLATE_AUTO mode, and - * when the translation pass was made the INPUT_SAW_CR - * flag was set on the channel. In that case, the - * correct behavior is to consume that \n and produce the - * empty string. + * There is one situation where this is the correct final result. + * If the src buffer contains only a single \n byte, and we are in + * TCL_TRANSLATE_AUTO mode, and when the translation pass was made + * the INPUT_SAW_CR flag was set on the channel. In that case, the + * correct behavior is to consume that \n and produce the empty + * string. */ if (dstRead == 1 && dst[0] == '\n') { @@ -6310,12 +6359,13 @@ ReadChars( goto consume; } - /* Otherwise, reading zero characters indicates there's - * something incomplete at the end of the src buffer. - * Maybe there were not enough src bytes to decode into - * a char. Maybe a lone \r could not be translated (crlf - * mode). Need to combine any unused src bytes we have - * in the first buffer with subsequent bytes to try again. + /* + * Otherwise, reading zero characters indicates there's something + * incomplete at the end of the src buffer. Maybe there were not + * enough src bytes to decode into a char. Maybe a lone \r could + * not be translated (crlf mode). Need to combine any unused src + * bytes we have in the first buffer with subsequent bytes to try + * again. */ nextPtr = bufPtr->nextPtr; @@ -6330,15 +6380,15 @@ ReadChars( /* * Space is made at the beginning of the buffer to copy the - * previous unused bytes there. Check first if the buffer we - * are using actually has enough space at its beginning for - * the data we are copying. Because if not we will write over - * the buffer management information, especially the 'nextPtr'. + * previous unused bytes there. Check first if the buffer we are + * using actually has enough space at its beginning for the data + * we are copying. Because if not we will write over the buffer + * management information, especially the 'nextPtr'. * - * Note that the BUFFER_PADDING (See AllocChannelBuffer) is - * used to prevent exactly this situation. I.e. it should never - * happen. Therefore it is ok to panic should it happen despite - * the precautions. + * Note that the BUFFER_PADDING (See AllocChannelBuffer) is used + * to prevent exactly this situation. I.e. it should never happen. + * Therefore it is ok to panic should it happen despite the + * precautions. */ if (nextPtr->nextRemoved - srcLen < 0) { @@ -6346,7 +6396,7 @@ ReadChars( } nextPtr->nextRemoved -= srcLen; - memcpy(RemovePoint(nextPtr), src, (size_t) srcLen); + memcpy(RemovePoint(nextPtr), src, srcLen); RecycleBuffer(statePtr, bufPtr, 0); statePtr->inQueueHead = nextPtr; Tcl_SetObjLength(objPtr, numBytes); @@ -6357,10 +6407,12 @@ ReadChars( consume: bufPtr->nextRemoved += srcRead; + /* - * If this read contained multibyte characters, revise factorPtr - * so the next read will allocate bigger buffers. + * If this read contained multibyte characters, revise factorPtr so + * the next read will allocate bigger buffers. */ + if (numChars && numChars < srcRead) { *factorPtr = srcRead * UTF_EXPANSION_FACTOR / numChars; } @@ -6408,22 +6460,27 @@ TranslateInputEOL( int inEofChar = statePtr->inEofChar; /* - * Depending on the translation mode in use, there's no need - * to scan more srcLen bytes at srcStart than can possibly transform - * to dstLen bytes. This keeps the scan for eof char below from - * being pointlessly long. + * Depending on the translation mode in use, there's no need to scan more + * srcLen bytes at srcStart than can possibly transform to dstLen bytes. + * This keeps the scan for eof char below from being pointlessly long. */ switch (statePtr->inputTranslation) { case TCL_TRANSLATE_LF: case TCL_TRANSLATE_CR: if (srcLen > dstLen) { - /* In these modes, each src byte become a dst byte. */ + /* + * In these modes, each src byte become a dst byte. + */ + srcLen = dstLen; } break; default: - /* In other modes, at most 2 src bytes become a dst byte. */ + /* + * In other modes, at most 2 src bytes become a dst byte. + */ + if (srcLen/2 > dstLen) { srcLen = 2 * dstLen; } @@ -6436,7 +6493,7 @@ TranslateInputEOL( * created by the presence of the input eof char. */ - if ((eof = memchr(srcStart, inEofChar, srcLen))) { + if ((eof = (const char *)memchr(srcStart, inEofChar, srcLen))) { srcLen = eof - srcStart; } } @@ -6445,13 +6502,13 @@ TranslateInputEOL( case TCL_TRANSLATE_LF: case TCL_TRANSLATE_CR: if (dstStart != srcStart) { - memcpy(dstStart, srcStart, (size_t) srcLen); + memcpy(dstStart, srcStart, srcLen); } if (statePtr->inputTranslation == TCL_TRANSLATE_CR) { char *dst = dstStart; char *dstEnd = dstStart + srcLen; - while ((dst = memchr(dst, '\r', dstEnd - dst))) { + while ((dst = (char *)memchr(dst, '\r', dstEnd - dst))) { *dst++ = '\n'; } } @@ -6462,7 +6519,7 @@ TranslateInputEOL( char *dst = dstStart; int lesser = (dstLen < srcLen) ? dstLen : srcLen; - while ((crFound = memchr(src, '\r', lesser))) { + while ((crFound = (const char *)memchr(src, '\r', lesser))) { int numBytes = crFound - src; memmove(dst, src, numBytes); @@ -6502,7 +6559,7 @@ TranslateInputEOL( ResetFlag(statePtr, INPUT_SAW_CR); } lesser = (dstLen < srcLen) ? dstLen : srcLen; - while ((crFound = memchr(src, '\r', lesser))) { + while ((crFound = (const char *)memchr(src, '\r', lesser))) { int numBytes = crFound - src; memmove(dst, src, numBytes); @@ -6602,7 +6659,7 @@ Tcl_Ungets( statePtr->inputEncodingFlags &= ~TCL_ENCODING_END; bufPtr = AllocChannelBuffer(len); - memcpy(InsertPoint(bufPtr), str, (size_t) len); + memcpy(InsertPoint(bufPtr), str, len); bufPtr->nextAdded += len; if (statePtr->inQueueHead == NULL) { @@ -6756,7 +6813,7 @@ GetInput( * eofchar. */ - assert( !GotFlag(statePtr, CHANNEL_STICKY_EOF) ); + assert(!GotFlag(statePtr, CHANNEL_STICKY_EOF)); /* * Prevent reading from a dead channel -- a channel that has been closed @@ -6795,7 +6852,6 @@ GetInput( */ if (chanPtr->inQueueHead != NULL) { - /* TODO: Tests to cover this. */ assert(statePtr->inQueueHead == NULL); @@ -6825,8 +6881,9 @@ GetInput( /* * Check the actual buffersize against the requested buffersize. - * Saved buffers of the wrong size are squashed. This is done - * to honor dynamic changes of the buffersize made by the user. + * Saved buffers of the wrong size are squashed. This is done to honor + * dynamic changes of the buffersize made by the user. + * * TODO: Tests to cover this. */ @@ -6905,7 +6962,7 @@ Tcl_Seek( * non-blocking mode after the seek. */ if (CheckChannelErrors(statePtr, TCL_WRITABLE | TCL_READABLE) != 0) { - return Tcl_LongAsWide(-1); + return -1; } /* @@ -6916,7 +6973,7 @@ Tcl_Seek( */ if (CheckForDeadChannel(NULL, statePtr)) { - return Tcl_LongAsWide(-1); + return -1; } /* @@ -6932,7 +6989,7 @@ Tcl_Seek( if (Tcl_ChannelSeekProc(chanPtr->typePtr) == NULL) { Tcl_SetErrno(EINVAL); - return Tcl_LongAsWide(-1); + return -1; } /* @@ -6945,7 +7002,7 @@ Tcl_Seek( if ((inputBuffered != 0) && (outputBuffered != 0)) { Tcl_SetErrno(EFAULT); - return Tcl_LongAsWide(-1); + return -1; } /* @@ -6988,7 +7045,7 @@ Tcl_Seek( wasAsync = 1; result = StackSetBlockMode(chanPtr, TCL_MODE_BLOCKING); if (result != 0) { - return Tcl_LongAsWide(-1); + return -1; } ResetFlag(statePtr, CHANNEL_NONBLOCKING); if (GotFlag(statePtr, BG_FLUSH_SCHEDULED)) { @@ -7013,7 +7070,7 @@ Tcl_Seek( */ curPos = ChanSeek(chanPtr, offset, mode, &result); - if (curPos == Tcl_LongAsWide(-1)) { + if (curPos == -1) { Tcl_SetErrno(result); } } @@ -7029,7 +7086,7 @@ Tcl_Seek( SetFlag(statePtr, CHANNEL_NONBLOCKING); result = StackSetBlockMode(chanPtr, TCL_MODE_NONBLOCKING); if (result != 0) { - return Tcl_LongAsWide(-1); + return -1; } } @@ -7069,7 +7126,7 @@ Tcl_Tell( Tcl_WideInt curPos; /* Position on device. */ if (CheckChannelErrors(statePtr, TCL_WRITABLE | TCL_READABLE) != 0) { - return Tcl_LongAsWide(-1); + return -1; } /* @@ -7080,7 +7137,7 @@ Tcl_Tell( */ if (CheckForDeadChannel(NULL, statePtr)) { - return Tcl_LongAsWide(-1); + return -1; } /* @@ -7096,7 +7153,7 @@ Tcl_Tell( if (Tcl_ChannelSeekProc(chanPtr->typePtr) == NULL) { Tcl_SetErrno(EINVAL); - return Tcl_LongAsWide(-1); + return -1; } /* @@ -7113,10 +7170,10 @@ Tcl_Tell( * wideSeekProc if that is available and non-NULL... */ - curPos = ChanSeek(chanPtr, Tcl_LongAsWide(0), SEEK_CUR, &result); - if (curPos == Tcl_LongAsWide(-1)) { + curPos = ChanSeek(chanPtr, 0, SEEK_CUR, &result); + if (curPos == -1) { Tcl_SetErrno(result); - return Tcl_LongAsWide(-1); + return -1; } if (inputBuffered != 0) { @@ -7174,7 +7231,7 @@ Tcl_TellOld( * Truncate a channel to the given length. * * Results: - * TCL_OK on success, TCL_ERROR if the operation failed (e.g. is not + * TCL_OK on success, TCL_ERROR if the operation failed (e.g., is not * supported by the type of channel, or the underlying OS operation * failed in some way). * @@ -7454,7 +7511,7 @@ Tcl_OutputBuffered( bytesBuffered += BytesLeft(bufPtr); } if (statePtr->curOutPtr != NULL) { - register ChannelBuffer *curOutPtr = statePtr->curOutPtr; + ChannelBuffer *curOutPtr = statePtr->curOutPtr; if (IsBufferReady(curOutPtr)) { bytesBuffered += BytesLeft(curOutPtr); @@ -8456,9 +8513,9 @@ UpdateInterest( * * - Tcl drops READABLE here, because it has data in its own * buffers waiting to be read by the extension. - * - A READABLE event is syntesized via timer. + * - A READABLE event is synthesized via timer. * - The OS still reports the EXCEPTION condition on the file. - * - And the extension gets the EXCPTION event first, and handles + * - And the extension gets the EXCEPTION event first, and handles * this as EOF. * * End result ==> Premature end of reading from a file. @@ -8508,7 +8565,7 @@ static void ChannelTimerProc( ClientData clientData) { - Channel *chanPtr = clientData; + Channel *chanPtr = (Channel *)clientData; ChannelState *statePtr = chanPtr->state; /* State info for channel */ @@ -8583,7 +8640,7 @@ Tcl_CreateChannelHandler( } } if (chPtr == NULL) { - chPtr = ckalloc(sizeof(ChannelHandler)); + chPtr = (ChannelHandler *)ckalloc(sizeof(ChannelHandler)); chPtr->mask = 0; chPtr->proc = proc; chPtr->clientData = clientData; @@ -8795,7 +8852,7 @@ CreateScriptRecord( makeCH = (esPtr == NULL); if (makeCH) { - esPtr = ckalloc(sizeof(EventScriptRecord)); + esPtr = (EventScriptRecord *)ckalloc(sizeof(EventScriptRecord)); } /* @@ -8851,7 +8908,7 @@ TclChannelEventScriptInvoker( * in. */ int result; /* Result of call to eval script. */ - esPtr = clientData; + esPtr = (EventScriptRecord *)clientData; chanPtr = esPtr->chanPtr; mask = esPtr->mask; interp = esPtr->interp; @@ -8906,7 +8963,7 @@ TclChannelEventScriptInvoker( /* ARGSUSED */ int Tcl_FileEventObjCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Interpreter in which the channel for which * to create the handler is found. */ int objc, /* Number of arguments. */ @@ -8920,6 +8977,7 @@ Tcl_FileEventObjCmd( int mask; static const char *const modeOptions[] = {"readable", "writable", NULL}; static const int maskArray[] = {TCL_READABLE, TCL_WRITABLE}; + (void)dummy; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 1, objv, "channelId event ?script?"); @@ -9005,7 +9063,7 @@ ZeroTransferTimerProc( /* calling CopyData with mask==0 still implies immediate invocation of the * -command callback, and completion of the fcopy. */ - CopyData(clientData, 0); + CopyData((CopyState *)clientData, 0); } /* @@ -9123,7 +9181,7 @@ TclCopyChannel( * completed. */ - csPtr = ckalloc(sizeof(CopyState) + !moveBytes * inStatePtr->bufSize); + csPtr = (CopyState *)ckalloc(sizeof(CopyState) + !moveBytes * inStatePtr->bufSize); csPtr->bufSize = !moveBytes * inStatePtr->bufSize; csPtr->readPtr = inPtr; csPtr->writePtr = outPtr; @@ -9534,7 +9592,10 @@ CopyData( } if (size == 0) { if (!GotFlag(inStatePtr, CHANNEL_NONBLOCKING)) { - /* We allowed a short read. Keep trying. */ + /* + * We allowed a short read. Keep trying. + */ + continue; } if (bufObj != NULL) { @@ -9748,7 +9809,7 @@ DoRead( ChannelState *statePtr = chanPtr->state; char *p = dst; - assert (bytesToRead >= 0); + assert(bytesToRead >= 0); /* * Early out when we know a read will get the eofchar. @@ -9764,15 +9825,18 @@ DoRead( if (GotFlag(statePtr, CHANNEL_STICKY_EOF)) { SetFlag(statePtr, CHANNEL_EOF); - assert( statePtr->inputEncodingFlags & TCL_ENCODING_END ); - assert( !GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR) ); + assert(statePtr->inputEncodingFlags & TCL_ENCODING_END); + assert(!GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR)); /* TODO: Don't need this call */ UpdateInterest(chanPtr); return 0; } - /* Special handling for zero-char read request. */ + /* + * Special handling for zero-char read request. + */ + if (bytesToRead == 0) { if (GotFlag(statePtr, CHANNEL_EOF)) { statePtr->inputEncodingFlags |= TCL_ENCODING_START; @@ -9787,8 +9851,8 @@ DoRead( TclChannelPreserve((Tcl_Channel)chanPtr); while (bytesToRead) { /* - * Each pass through the loop is intended to process up to - * one channel buffer. + * Each pass through the loop is intended to process up to one channel + * buffer. */ int bytesRead, bytesWritten; @@ -9800,33 +9864,39 @@ DoRead( while (!bufPtr || /* We got no buffer! OR */ (!IsBufferFull(bufPtr) && /* Our buffer has room AND */ - (BytesLeft(bufPtr) < bytesToRead) ) ) { - /* Not enough bytes in it - * yet to fill the dst */ + (BytesLeft(bufPtr) < bytesToRead))) { + /* Not enough bytes in it yet + * to fill the dst */ int code; moreData: code = GetInput(chanPtr); bufPtr = statePtr->inQueueHead; - assert (bufPtr != NULL); + assert(bufPtr != NULL); if (GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED)) { - /* Further reads cannot do any more */ + /* + * Further reads cannot do any more. + */ + break; } if (code) { - /* Read error */ + /* + * Read error + */ + UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return -1; } - assert (IsBufferFull(bufPtr)); + assert(IsBufferFull(bufPtr)); } - assert (bufPtr != NULL); + assert(bufPtr != NULL); bytesRead = BytesLeft(bufPtr); bytesWritten = bytesToRead; @@ -9841,8 +9911,8 @@ DoRead( /* * Buffer is not empty. How can that be? * - * 0) We stopped early because we got all the bytes - * we were seeking. That's fine. + * 0) We stopped early because we got all the bytes we were + * seeking. That's fine. */ if (bytesToRead == 0) { @@ -9858,8 +9928,8 @@ DoRead( } /* - * 2) The buffer holds a \r while in CRLF translation, - * followed by the end of the buffer. + * 2) The buffer holds a \r while in CRLF translation, followed by + * the end of the buffer. */ assert(statePtr->inputTranslation == TCL_TRANSLATE_CRLF); @@ -9867,26 +9937,38 @@ DoRead( assert(BytesLeft(bufPtr) == 1); if (bufPtr->nextPtr == NULL) { - /* There's no more buffered data.... */ + /* + * There's no more buffered data... + */ if (statePtr->flags & CHANNEL_EOF) { - /* ...and there never will be. */ + /* + * ...and there never will be. + */ *p++ = '\r'; bytesToRead--; bufPtr->nextRemoved++; } else if (statePtr->flags & CHANNEL_BLOCKED) { - /* ...and we cannot get more now. */ + /* + * ...and we cannot get more now. + */ + SetFlag(statePtr, CHANNEL_NEED_MORE_DATA); break; } else { - /* ... so we need to get some. */ + /* + * ...so we need to get some. + */ + goto moreData; } } if (bufPtr->nextPtr) { - /* There's a next buffer. Shift orphan \r to it. */ + /* + * There's a next buffer. Shift orphan \r to it. + */ ChannelBuffer *nextPtr = bufPtr->nextPtr; @@ -9911,8 +9993,8 @@ DoRead( } /* - * When there's no buffered data to read, and we're at EOF, - * escape to the caller. + * When there's no buffered data to read, and we're at EOF, escape to + * the caller. */ if (GotFlag(statePtr, CHANNEL_EOF) @@ -9924,11 +10006,11 @@ DoRead( ResetFlag(statePtr, CHANNEL_BLOCKED); } - assert(!GotFlag(statePtr, CHANNEL_EOF) - || GotFlag(statePtr, CHANNEL_STICKY_EOF) - || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); - assert( !(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) - == (CHANNEL_EOF|CHANNEL_BLOCKED)) ); + assert(!GotFlag(statePtr, CHANNEL_EOF) + || GotFlag(statePtr, CHANNEL_STICKY_EOF) + || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); + assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) + == (CHANNEL_EOF|CHANNEL_BLOCKED))); UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return (int)(p - dst); @@ -9957,7 +10039,7 @@ CopyEventProc( ClientData clientData, int mask) { - (void) CopyData(clientData, mask); + (void) CopyData((CopyState *)clientData, mask); } /* @@ -10290,7 +10372,7 @@ Tcl_IsChannelRegistered( chanPtr = ((Channel *) chan)->state->bottomChanPtr; statePtr = chanPtr->state; - hTblPtr = Tcl_GetAssocData(interp, "tclIO", NULL); + hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclIO", NULL); if (hTblPtr == NULL) { return 0; } @@ -10964,7 +11046,7 @@ FixLevelCode( lcn += 2; } - lvn = ckalloc(lcn * sizeof(Tcl_Obj *)); + lvn = (Tcl_Obj **)ckalloc(lcn * sizeof(Tcl_Obj *)); /* * New level/code information is spliced into the first occurence of @@ -11125,9 +11207,9 @@ Tcl_ChannelTruncateProc( static void DupChannelIntRep( - register Tcl_Obj *srcPtr, /* Object with internal rep to copy. Must have + Tcl_Obj *srcPtr, /* Object with internal rep to copy. Must have * an internal rep of type "Channel". */ - register Tcl_Obj *copyPtr) /* Object with internal rep to set. Must not + Tcl_Obj *copyPtr) /* Object with internal rep to set. Must not * currently have an internal rep.*/ { ResolvedChanName *resPtr = srcPtr->internalRep.twoPtrValue.ptr1; diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 7f61def..dadcb53 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -23,6 +23,8 @@ static int TransformBlockModeProc(ClientData instanceData, int mode); static int TransformCloseProc(ClientData instanceData, Tcl_Interp *interp); +static int TransformClose2Proc(ClientData instanceData, + Tcl_Interp *interp, int flags); static int TransformInputProc(ClientData instanceData, char *buf, int toRead, int *errorCodePtr); static int TransformOutputProc(ClientData instanceData, @@ -127,7 +129,7 @@ static const Tcl_ChannelType transformChannelType = { TransformGetOptionProc, /* Get option proc. */ TransformWatchProc, /* Initialize notifier. */ TransformGetFileHandleProc, /* Get OS handles out of channel. */ - NULL, /* close2proc */ + TransformClose2Proc, /* close2proc */ TransformBlockModeProc, /* Set blocking/nonblocking mode.*/ NULL, /* Flush proc. */ TransformNotifyProc, /* Handling of events bubbling up. */ @@ -287,7 +289,7 @@ TclChannelTransform( * regime of the underlying channel and to use the same for us too. */ - dataPtr = ckalloc(sizeof(TransformChannelData)); + dataPtr = (TransformChannelData *)ckalloc(sizeof(TransformChannelData)); dataPtr->refCount = 1; Tcl_DStringInit(&ds); @@ -503,7 +505,7 @@ TransformBlockModeProc( ClientData instanceData, /* State of transformation. */ int mode) /* New blocking mode. */ { - TransformChannelData *dataPtr = instanceData; + TransformChannelData *dataPtr = (TransformChannelData *)instanceData; if (mode == TCL_MODE_NONBLOCKING) { dataPtr->flags |= CHANNEL_ASYNC; @@ -516,7 +518,7 @@ TransformBlockModeProc( /* *---------------------------------------------------------------------- * - * TransformCloseProc -- + * TransformCloseProc/TransformClose2Proc -- * * Trap handler. Called by the generic IO system during destruction of * the transformation channel. @@ -592,6 +594,18 @@ TransformCloseProc( ReleaseData(dataPtr); return TCL_OK; } + +static int +TransformClose2Proc( + ClientData instanceData, + Tcl_Interp *interp, + int flags) +{ + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) { + return TransformCloseProc(instanceData, interp); + } + return EINVAL; +} /* *---------------------------------------------------------------------- @@ -616,7 +630,7 @@ TransformInputProc( int toRead, int *errorCodePtr) { - TransformChannelData *dataPtr = instanceData; + TransformChannelData *dataPtr = (TransformChannelData *)instanceData; int gotBytes, read, copied; Tcl_Channel downChan; @@ -783,7 +797,7 @@ TransformOutputProc( int toWrite, int *errorCodePtr) { - TransformChannelData *dataPtr = instanceData; + TransformChannelData *dataPtr = (TransformChannelData *)instanceData; /* * Should assert(dataPtr->mode & TCL_WRITABLE); @@ -835,7 +849,7 @@ TransformSeekProc( int mode, /* How to move. */ int *errorCodePtr) /* Location of error flag. */ { - TransformChannelData *dataPtr = instanceData; + TransformChannelData *dataPtr = (TransformChannelData *)instanceData; Tcl_Channel parent = Tcl_GetStackedChannel(dataPtr->self); const Tcl_ChannelType *parentType = Tcl_GetChannelType(parent); Tcl_DriverSeekProc *parentSeekProc = Tcl_ChannelSeekProc(parentType); @@ -902,7 +916,7 @@ TransformWideSeekProc( int mode, /* How to move. */ int *errorCodePtr) /* Location of error flag. */ { - TransformChannelData *dataPtr = instanceData; + TransformChannelData *dataPtr = (TransformChannelData *)instanceData; Tcl_Channel parent = Tcl_GetStackedChannel(dataPtr->self); const Tcl_ChannelType *parentType = Tcl_GetChannelType(parent); Tcl_DriverSeekProc *parentSeekProc = Tcl_ChannelSeekProc(parentType); @@ -910,7 +924,7 @@ TransformWideSeekProc( Tcl_ChannelWideSeekProc(parentType); ClientData parentData = Tcl_GetChannelInstanceData(parent); - if ((offset == Tcl_LongAsWide(0)) && (mode == SEEK_CUR)) { + if ((offset == 0) && (mode == SEEK_CUR)) { /* * This is no seek but a request to tell the caller the current * location. Simply pass the request down. @@ -995,7 +1009,7 @@ TransformSetOptionProc( const char *optionName, const char *value) { - TransformChannelData *dataPtr = instanceData; + TransformChannelData *dataPtr = (TransformChannelData *)instanceData; Tcl_Channel downChan = Tcl_GetStackedChannel(dataPtr->self); Tcl_DriverSetOptionProc *setOptionProc; @@ -1033,7 +1047,7 @@ TransformGetOptionProc( const char *optionName, Tcl_DString *dsPtr) { - TransformChannelData *dataPtr = instanceData; + TransformChannelData *dataPtr = (TransformChannelData *)instanceData; Tcl_Channel downChan = Tcl_GetStackedChannel(dataPtr->self); Tcl_DriverGetOptionProc *getOptionProc; @@ -1079,7 +1093,7 @@ TransformWatchProc( ClientData instanceData, /* Channel to watch. */ int mask) /* Events of interest. */ { - TransformChannelData *dataPtr = instanceData; + TransformChannelData *dataPtr = (TransformChannelData *)instanceData; Tcl_Channel downChan; /* @@ -1158,7 +1172,7 @@ TransformGetFileHandleProc( int direction, /* Direction of interest. */ ClientData *handlePtr) /* Place to store the handle into. */ { - TransformChannelData *dataPtr = instanceData; + TransformChannelData *dataPtr = (TransformChannelData *)instanceData; /* * Return the handle belonging to parent channel. IOW, pass the request @@ -1192,7 +1206,7 @@ TransformNotifyProc( * transformation. */ int mask) /* The mask of occuring events. */ { - TransformChannelData *dataPtr = clientData; + TransformChannelData *dataPtr = (TransformChannelData *)clientData; /* * An event occured in the underlying channel. This transformation doesn't @@ -1235,7 +1249,7 @@ static void TransformChannelHandlerTimer( ClientData clientData) /* Transformation to query. */ { - TransformChannelData *dataPtr = clientData; + TransformChannelData *dataPtr = (TransformChannelData *)clientData; dataPtr->timer = NULL; if (!(dataPtr->watchMask&TCL_READABLE) || ResultEmpty(&dataPtr->result)) { @@ -1417,10 +1431,10 @@ ResultAdd( if (r->allocated == 0) { r->allocated = toWrite + INCREMENT; - r->buf = ckalloc(r->allocated); + r->buf = (unsigned char *)ckalloc(r->allocated); } else { r->allocated += toWrite + INCREMENT; - r->buf = ckrealloc(r->buf, r->allocated); + r->buf = (unsigned char *)ckrealloc(r->buf, r->allocated); } } diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index e862761..9969b87 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -33,6 +33,8 @@ static int ReflectClose(ClientData clientData, Tcl_Interp *interp); +static int ReflectClose2(ClientData clientData, + Tcl_Interp *interp, int flags); static int ReflectInput(ClientData clientData, char *buf, int toRead, int *errorCodePtr); static int ReflectOutput(ClientData clientData, const char *buf, @@ -71,7 +73,7 @@ static const Tcl_ChannelType tclRChannelType = { ReflectGetOption, /* Get options. NULL'able */ ReflectWatch, /* Initialize notifier */ NULL, /* Get OS handle from the channel. NULL'able */ - NULL, /* No close2 support. NULL'able */ + ReflectClose2, /* No close2 support. NULL'able */ ReflectBlock, /* Set blocking/nonblocking. NULL'able */ NULL, /* Flush channel. Not used by core. NULL'able */ NULL, /* Handle events. NULL'able */ @@ -481,7 +483,7 @@ static const char *msg_dstlost = "-code 1 -level 0 -errorcode NONE -errorinfo int TclChanCreateObjCmd( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -507,6 +509,7 @@ TclChanCreateObjCmd( * this interp. */ Tcl_HashEntry *hPtr; /* Entry in the above map */ int isNew; /* Placeholder. */ + (void)dummy; /* * Syntax: chan create MODE CMDPREFIX @@ -670,7 +673,7 @@ TclChanCreateObjCmd( * as the actual channel type. */ - Tcl_ChannelType *clonePtr = ckalloc(sizeof(Tcl_ChannelType)); + Tcl_ChannelType *clonePtr = (Tcl_ChannelType *)ckalloc(sizeof(Tcl_ChannelType)); memcpy(clonePtr, &tclRChannelType, sizeof(Tcl_ChannelType)); @@ -770,6 +773,7 @@ ReflectEventRun( */ ReflectEvent *e = (ReflectEvent *) ev; + (void)flags; Tcl_NotifyChannel(e->rcPtr->chan, e->events); return 1; @@ -798,7 +802,7 @@ ReflectEventDelete( int TclChanPostEventObjCmd( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -827,6 +831,7 @@ TclChanPostEventObjCmd( ReflectedChannelMap *rcmPtr;/* Map of reflected channels with handlers in * this interp. */ Tcl_HashEntry *hPtr; /* Entry in the above map */ + (void)dummy; /* * Number of arguments... @@ -855,11 +860,12 @@ TclChanPostEventObjCmd( } /* - * Note that the search above subsumes several of the older checks, namely: + * Note that the search above subsumes several of the older checks, + * namely: * - * (1) Does the channel handle refer to a reflected channel ? + * (1) Does the channel handle refer to a reflected channel? * (2) Is the post event issued from the interpreter holding the handler - * of the reflected channel ? + * of the reflected channel? * * A successful search answers yes to both. Because the map holds only * handles of reflected channels, and only of such whose handler is @@ -870,7 +876,7 @@ TclChanPostEventObjCmd( * have gone seriously haywire. */ - chan = Tcl_GetHashValue(hPtr); + chan = (Tcl_Channel)Tcl_GetHashValue(hPtr); chanTypePtr = Tcl_GetChannelType(chan); /* @@ -886,7 +892,7 @@ TclChanPostEventObjCmd( Tcl_Panic("TclChanPostEventObjCmd: channel is not a reflected channel"); } - rcPtr = Tcl_GetChannelInstanceData(chan); + rcPtr = (ReflectedChannel *)Tcl_GetChannelInstanceData(chan); if (rcPtr->interp != interp) { Tcl_Panic("TclChanPostEventObjCmd: postevent accepted for call from outside interpreter"); @@ -922,7 +928,7 @@ TclChanPostEventObjCmd( Tcl_NotifyChannel(chan, events); #ifdef TCL_THREADS } else { - ReflectEvent *ev = ckalloc(sizeof(ReflectEvent)); + ReflectEvent *ev = (ReflectEvent *)ckalloc(sizeof(ReflectEvent)); ev->header.proc = ReflectEventRun; ev->events = events; @@ -943,7 +949,8 @@ TclChanPostEventObjCmd( (void) GetThreadReflectedChannelMap(); - /* XXX Race condition !! + /* + * XXX Race condition !! * XXX The destination thread may not exist anymore already. * XXX (Delayed postevent executed after channel got removed). * XXX Can we detect this ? (check the validity of the owner threadid ?) @@ -1091,7 +1098,7 @@ TclChanCaughtErrorBypass( /* *---------------------------------------------------------------------- * - * ReflectClose -- + * ReflectClose/ReflectClose2 -- * * This function is invoked when the channel is closed, to delete the * driver specific instance data. @@ -1110,7 +1117,7 @@ ReflectClose( ClientData clientData, Tcl_Interp *interp) { - ReflectedChannel *rcPtr = clientData; + ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; int result; /* Result code for 'close' */ Tcl_Obj *resObj; /* Result data for 'close' */ ReflectedChannelMap *rcmPtr;/* Map of reflected channels with handlers in @@ -1231,6 +1238,18 @@ ReflectClose( Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel); return (result == TCL_OK) ? EOK : EINVAL; } + +static int +ReflectClose2( + ClientData clientData, + Tcl_Interp *interp, + int flags) +{ + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) { + return ReflectClose(clientData, interp); + } + return EINVAL; +} /* *---------------------------------------------------------------------- @@ -1255,7 +1274,7 @@ ReflectInput( int toRead, int *errorCodePtr) { - ReflectedChannel *rcPtr = clientData; + ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; Tcl_Obj *toReadObj; int bytec; /* Number of returned bytes */ unsigned char *bytev; /* Array of returned bytes */ @@ -1276,7 +1295,10 @@ ReflectInput( if (p.base.code != TCL_OK) { if (p.base.code < 0) { - /* No error message, this is an errno signal. */ + /* + * No error message, this is an errno signal. + */ + *errorCodePtr = -p.base.code; } else { PassReceivedError(rcPtr->chan, &p); @@ -1321,7 +1343,7 @@ ReflectInput( *errorCodePtr = EOK; if (bytec > 0) { - memcpy(buf, bytev, (size_t) bytec); + memcpy(buf, bytev, bytec); } stop: @@ -1359,7 +1381,7 @@ ReflectOutput( int toWrite, int *errorCodePtr) { - ReflectedChannel *rcPtr = clientData; + ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; Tcl_Obj *bufObj; Tcl_Obj *resObj; /* Result data for 'write' */ int written; @@ -1379,7 +1401,10 @@ ReflectOutput( if (p.base.code != TCL_OK) { if (p.base.code < 0) { - /* No error message, this is an errno signal. */ + /* + * No error message, this is an errno signal. + */ + *errorCodePtr = -p.base.code; } else { PassReceivedError(rcPtr->chan, &p); @@ -1430,8 +1455,8 @@ ReflectOutput( if ((written == 0) && (toWrite > 0)) { /* - * The handler claims to have written nothing of what it was - * given. That is bad. + * The handler claims to have written nothing of what it was given. + * That is bad. */ SetChannelErrorStr(rcPtr->chan, msg_write_nothing); @@ -1485,7 +1510,7 @@ ReflectSeekWide( int seekMode, int *errorCodePtr) { - ReflectedChannel *rcPtr = clientData; + ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; Tcl_Obj *offObj, *baseObj; Tcl_Obj *resObj; /* Result for 'seek' */ Tcl_WideInt newLoc; @@ -1536,7 +1561,7 @@ ReflectSeekWide( goto invalid; } - if (newLoc < Tcl_LongAsWide(0)) { + if (newLoc < 0) { SetChannelErrorStr(rcPtr->chan, msg_seek_beforestart); goto invalid; } @@ -1594,7 +1619,7 @@ ReflectWatch( ClientData clientData, int mask) { - ReflectedChannel *rcPtr = clientData; + ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; Tcl_Obj *maskObj; /* @@ -1666,7 +1691,7 @@ ReflectBlock( ClientData clientData, int nonblocking) { - ReflectedChannel *rcPtr = clientData; + ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; Tcl_Obj *blockObj; int errorNum; /* EINVAL or EOK (success). */ Tcl_Obj *resObj; /* Result data for 'blocking' */ @@ -1733,7 +1758,7 @@ ReflectThread( ClientData clientData, int action) { - ReflectedChannel *rcPtr = clientData; + ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; switch (action) { case TCL_CHANNEL_THREAD_INSERT: @@ -1772,7 +1797,7 @@ ReflectSetOption( const char *optionName, /* Name of requested option */ const char *newValue) /* The new value */ { - ReflectedChannel *rcPtr = clientData; + ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; Tcl_Obj *optionObj, *valueObj; int result; /* Result code for 'configure' */ Tcl_Obj *resObj; /* Result data for 'configure' */ @@ -1849,7 +1874,7 @@ ReflectGetOption( * The bypass functions are not required. */ - ReflectedChannel *rcPtr = clientData; + ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; Tcl_Obj *optionObj; Tcl_Obj *resObj; /* Result data for 'configure' */ int listc, result = TCL_OK; @@ -2065,7 +2090,7 @@ static Tcl_Obj * DecodeEventMask( int mask) { - register const char *eventStr; + const char *eventStr; Tcl_Obj *evObj; switch (mask & RANDW) { @@ -2116,7 +2141,7 @@ NewReflectedChannel( ReflectedChannel *rcPtr; MethodName mn = METH_BLOCKING; - rcPtr = ckalloc(sizeof(ReflectedChannel)); + rcPtr = (ReflectedChannel *)ckalloc(sizeof(ReflectedChannel)); /* rcPtr->chan: Assigned by caller. Dummy data here. */ @@ -2377,8 +2402,8 @@ InvokeTclMethod( * None. * * Users: - * ReflectInput/Output(), to enable the signaling of EAGAIN - * on 0-sized short reads/writes. + * ReflectInput/Output(), to enable the signaling of EAGAIN on 0-sized + * short reads/writes. * *---------------------------------------------------------------------- */ @@ -2434,10 +2459,10 @@ static ReflectedChannelMap * GetReflectedChannelMap( Tcl_Interp *interp) { - ReflectedChannelMap *rcmPtr = Tcl_GetAssocData(interp, RCMKEY, NULL); + ReflectedChannelMap *rcmPtr = (ReflectedChannelMap *)Tcl_GetAssocData(interp, RCMKEY, NULL); if (rcmPtr == NULL) { - rcmPtr = ckalloc(sizeof(ReflectedChannelMap)); + rcmPtr = (ReflectedChannelMap *)ckalloc(sizeof(ReflectedChannelMap)); Tcl_InitHashTable(&rcmPtr->map, TCL_STRING_KEYS); Tcl_SetAssocData(interp, RCMKEY, (Tcl_InterpDeleteProc *) DeleteReflectedChannelMap, rcmPtr); @@ -2492,7 +2517,7 @@ DeleteReflectedChannelMap( ClientData clientData, /* The per-interpreter data structure. */ Tcl_Interp *interp) /* The interpreter being deleted. */ { - ReflectedChannelMap *rcmPtr = clientData; + ReflectedChannelMap *rcmPtr = (ReflectedChannelMap *)clientData; /* The map */ Tcl_HashSearch hSearch; /* Search variable. */ Tcl_HashEntry *hPtr; /* Search variable. */ @@ -2519,8 +2544,8 @@ DeleteReflectedChannelMap( for (hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch); hPtr != NULL; hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch)) { - chan = Tcl_GetHashValue(hPtr); - rcPtr = Tcl_GetChannelInstanceData(chan); + chan = (Tcl_Channel)Tcl_GetHashValue(hPtr); + rcPtr = (ReflectedChannel *)Tcl_GetChannelInstanceData(chan); MarkDead(rcPtr); Tcl_DeleteHashEntry(hPtr); @@ -2564,7 +2589,10 @@ DeleteReflectedChannelMap( evPtr = resultPtr->evPtr; - /* Basic crash safety until this routine can get revised [3411310] */ + /* + * Basic crash safety until this routine can get revised [3411310] + */ + if (evPtr == NULL) { continue; } @@ -2594,8 +2622,8 @@ DeleteReflectedChannelMap( for (hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch); hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) { - chan = Tcl_GetHashValue(hPtr); - rcPtr = Tcl_GetChannelInstanceData(chan); + chan = (Tcl_Channel)Tcl_GetHashValue(hPtr); + rcPtr = (ReflectedChannel *)Tcl_GetChannelInstanceData(chan); if (rcPtr->interp != interp) { /* @@ -2635,7 +2663,7 @@ GetThreadReflectedChannelMap(void) ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); if (!tsdPtr->rcmPtr) { - tsdPtr->rcmPtr = ckalloc(sizeof(ReflectedChannelMap)); + tsdPtr->rcmPtr = (ReflectedChannelMap *)ckalloc(sizeof(ReflectedChannelMap)); Tcl_InitHashTable(&tsdPtr->rcmPtr->map, TCL_STRING_KEYS); Tcl_CreateThreadExitHandler(DeleteThreadReflectedChannelMap, NULL); } @@ -2663,13 +2691,14 @@ GetThreadReflectedChannelMap(void) static void DeleteThreadReflectedChannelMap( - ClientData clientData) /* The per-thread data structure. */ + ClientData dummy) /* The per-thread data structure. */ { Tcl_HashSearch hSearch; /* Search variable. */ Tcl_HashEntry *hPtr; /* Search variable. */ Tcl_ThreadId self = Tcl_GetCurrentThread(); ReflectedChannelMap *rcmPtr; /* The map */ ForwardingResult *resultPtr; + (void)dummy; /* * The origin thread for one or more reflected channels is gone. @@ -2679,8 +2708,8 @@ DeleteThreadReflectedChannelMap( /* * Go through the list of pending results and cancel all whose events were - * destined for this thread. While this is in progress we block any - * other access to the list of pending results. + * destined for this thread. While this is in progress we block any other + * access to the list of pending results. */ Tcl_MutexLock(&rcForwardMutex); @@ -2711,7 +2740,10 @@ DeleteThreadReflectedChannelMap( evPtr = resultPtr->evPtr; - /* Basic crash safety until this routine can get revised [3411310] */ + /* + * Basic crash safety until this routine can get revised [3411310] + */ + if (evPtr == NULL ) { continue; } @@ -2749,8 +2781,8 @@ DeleteThreadReflectedChannelMap( for (hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch); hPtr != NULL; hPtr = Tcl_FirstHashEntry(&rcmPtr->map, &hSearch)) { - Tcl_Channel chan = Tcl_GetHashValue(hPtr); - ReflectedChannel *rcPtr = Tcl_GetChannelInstanceData(chan); + Tcl_Channel chan = (Tcl_Channel)Tcl_GetHashValue(hPtr); + ReflectedChannel *rcPtr = (ReflectedChannel *)Tcl_GetChannelInstanceData(chan); MarkDead(rcPtr); Tcl_DeleteHashEntry(hPtr); @@ -2765,8 +2797,8 @@ ForwardOpToHandlerThread( const void *param) /* Arguments */ { /* - * Core of the communication from OWNER to HANDLER thread. - * The receiver is ForwardProc() below. + * Core of the communication from OWNER to HANDLER thread. The receiver is + * ForwardProc() below. */ Tcl_ThreadId dst = rcPtr->thread; @@ -2795,8 +2827,8 @@ ForwardOpToHandlerThread( * Create and initialize the event and data structures. */ - evPtr = ckalloc(sizeof(ForwardingEvent)); - resultPtr = ckalloc(sizeof(ForwardingResult)); + evPtr = (ForwardingEvent *)ckalloc(sizeof(ForwardingEvent)); + resultPtr = (ForwardingResult *)ckalloc(sizeof(ForwardingResult)); evPtr->event.proc = ForwardProc; evPtr->resultPtr = resultPtr; @@ -2816,7 +2848,10 @@ ForwardOpToHandlerThread( */ TclSpliceIn(resultPtr, forwardList); - /* Do not unlock here. That is done by the ConditionWait */ + + /* + * Do not unlock here. That is done by the ConditionWait. + */ /* * Ensure cleanup of the event if the origin thread exits while this event @@ -2892,7 +2927,7 @@ ForwardProc( * Notes regarding access to the referenced data. * * In principle the data belongs to the originating thread (see - * evPtr->src), however this thread is currently blocked at (*), i.e. + * evPtr->src), however this thread is currently blocked at (*), i.e., * quiescent. Because of this we can treat the data as belonging to us, * without fear of race conditions. I.e. we can read and write as we like. * @@ -2910,6 +2945,7 @@ ForwardProc( ReflectedChannelMap *rcmPtr;/* Map of reflected channels with handlers in * this interp. */ Tcl_HashEntry *hPtr; /* Entry in the above map */ + (void)mask; /* * Ignore the event if no one is waiting for its result anymore. @@ -2991,7 +3027,7 @@ ForwardProc( paramPtr->input.toRead = -1; } else { if (bytec > 0) { - memcpy(paramPtr->input.buf, bytev, (size_t) bytec); + memcpy(paramPtr->input.buf, bytev, bytec); } paramPtr->input.toRead = bytec; } @@ -3062,7 +3098,7 @@ ForwardProc( Tcl_WideInt newLoc; if (Tcl_GetWideIntFromObj(interp, resObj, &newLoc) == TCL_OK) { - if (newLoc < Tcl_LongAsWide(0)) { + if (newLoc < 0) { ForwardSetStaticError(paramPtr, msg_seek_beforestart); paramPtr->seek.offset = -1; } else { @@ -3170,7 +3206,7 @@ ForwardProc( * Odd number of elements is wrong. [x]. */ - char *buf = ckalloc(200); + char *buf = (char *)ckalloc(200); sprintf(buf, "{Expected list with even number of elements, got %d %s instead}", listc, (listc == 1 ? "element" : "elements")); @@ -3227,7 +3263,7 @@ static void SrcExitProc( ClientData clientData) { - ForwardingEvent *evPtr = clientData; + ForwardingEvent *evPtr = (ForwardingEvent *)clientData; ForwardingResult *resultPtr; ForwardParam *paramPtr; @@ -3281,7 +3317,7 @@ ForwardSetObjError( len++; ForwardSetDynamicError(paramPtr, ckalloc(len)); - memcpy(paramPtr->base.msgStr, msgStr, (unsigned) len); + memcpy(paramPtr->base.msgStr, msgStr, len); } #endif diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 27a938d..039b594 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -33,6 +33,8 @@ static int ReflectClose(ClientData clientData, Tcl_Interp *interp); +static int ReflectClose2(ClientData clientData, + Tcl_Interp *interp, int flags); static int ReflectInput(ClientData clientData, char *buf, int toRead, int *errorCodePtr); static int ReflectOutput(ClientData clientData, const char *buf, @@ -68,7 +70,7 @@ static const Tcl_ChannelType tclRTransformType = { ReflectGetOption, /* Get options. */ ReflectWatch, /* Initialize notifier. */ ReflectHandle, /* Get OS handle from the channel. */ - NULL, /* No close2 support. NULL'able. */ + ReflectClose2, /* No close2 support. NULL'able. */ ReflectBlock, /* Set blocking/nonblocking. */ NULL, /* Flush channel. Not used by core. * NULL'able. */ @@ -497,7 +499,7 @@ static int TransformLimit(ReflectedTransform *rtPtr, int TclChanPushObjCmd( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -524,6 +526,7 @@ TclChanPushObjCmd( * in this interp. */ Tcl_HashEntry *hPtr; /* Entry in the above map */ int isNew; /* Placeholder. */ + (void)dummy; /* * Syntax: chan push CHANNEL CMDPREFIX @@ -742,7 +745,7 @@ TclChanPushObjCmd( int TclChanPopObjCmd( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -760,6 +763,7 @@ TclChanPopObjCmd( const char *chanId; /* Tcl level channel handle */ Tcl_Channel chan; /* Channel associated to the handle */ int mode; /* Channel r/w mode */ + (void)dummy; /* * Number of arguments... @@ -881,7 +885,7 @@ ReflectClose( ClientData clientData, Tcl_Interp *interp) { - ReflectedTransform *rtPtr = clientData; + ReflectedTransform *rtPtr = (ReflectedTransform *)clientData; int errorCode, errorCodeSet = 0; int result = TCL_OK; /* Result code for 'close' */ Tcl_Obj *resObj; /* Result data for 'close' */ @@ -1033,6 +1037,18 @@ ReflectClose( Tcl_EventuallyFree (rtPtr, (Tcl_FreeProc *) FreeReflectedTransform); return errorCodeSet ? errorCode : ((result == TCL_OK) ? EOK : EINVAL); } + +static int +ReflectClose2( + ClientData clientData, + Tcl_Interp *interp, + int flags) +{ + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) { + return ReflectClose(clientData, interp); + } + return EINVAL; +} /* *---------------------------------------------------------------------- @@ -1057,7 +1073,7 @@ ReflectInput( int toRead, int *errorCodePtr) { - ReflectedTransform *rtPtr = clientData; + ReflectedTransform *rtPtr = (ReflectedTransform *)clientData; int gotBytes, copied, readBytes; Tcl_Obj *bufObj; @@ -1250,7 +1266,7 @@ ReflectOutput( int toWrite, int *errorCodePtr) { - ReflectedTransform *rtPtr = clientData; + ReflectedTransform *rtPtr = (ReflectedTransform *)clientData; /* * The following check can be done before thread redirection, because we @@ -1323,7 +1339,7 @@ ReflectSeekWide( int seekMode, int *errorCodePtr) { - ReflectedTransform *rtPtr = clientData; + ReflectedTransform *rtPtr = (ReflectedTransform *)clientData; Channel *parent = (Channel *) rtPtr->parent; Tcl_WideInt curPos; /* Position on the device. */ @@ -1394,7 +1410,7 @@ ReflectSeekWide( parent->instanceData, Tcl_WideAsLong(offset), seekMode, errorCodePtr)); } - if (curPos == Tcl_LongAsWide(-1)) { + if (curPos == -1) { Tcl_SetErrno(*errorCodePtr); } @@ -1443,7 +1459,7 @@ ReflectWatch( ClientData clientData, int mask) { - ReflectedTransform *rtPtr = clientData; + ReflectedTransform *rtPtr = (ReflectedTransform *)clientData; Tcl_DriverWatchProc *watchProc; watchProc = Tcl_ChannelWatchProc(Tcl_GetChannelType(rtPtr->parent)); @@ -1494,7 +1510,7 @@ ReflectBlock( ClientData clientData, int nonblocking) { - ReflectedTransform *rtPtr = clientData; + ReflectedTransform *rtPtr = (ReflectedTransform *)clientData; /* * Transformations simply record the blocking mode in their C level @@ -1529,7 +1545,7 @@ ReflectSetOption( const char *optionName, /* Name of requested option */ const char *newValue) /* The new value */ { - ReflectedTransform *rtPtr = clientData; + ReflectedTransform *rtPtr = (ReflectedTransform *)clientData; /* * Transformations have no options. Thus the call is passed down unchanged @@ -1571,7 +1587,7 @@ ReflectGetOption( const char *optionName, /* Name of reuqested option */ Tcl_DString *dsPtr) /* String to place the result into */ { - ReflectedTransform *rtPtr = clientData; + ReflectedTransform *rtPtr = (ReflectedTransform *)clientData; /* * Transformations have no options. Thus the call is passed down unchanged @@ -1619,7 +1635,7 @@ ReflectHandle( int direction, ClientData *handlePtr) { - ReflectedTransform *rtPtr = clientData; + ReflectedTransform *rtPtr = (ReflectedTransform *)clientData; /* * Transformations have no handle of their own. As such we simply query @@ -1654,7 +1670,7 @@ ReflectNotify( ClientData clientData, int mask) { - ReflectedTransform *rtPtr = clientData; + ReflectedTransform *rtPtr = (ReflectedTransform *)clientData; /* * An event occured in the underlying channel. @@ -1702,7 +1718,7 @@ static Tcl_Obj * DecodeEventMask( int mask) { - register const char *eventStr; + const char *eventStr; Tcl_Obj *evObj; switch (mask & RANDW) { @@ -1754,8 +1770,9 @@ NewReflectedTransform( int listc; Tcl_Obj **listv; int i; + (void)mode; - rtPtr = ckalloc(sizeof(ReflectedTransform)); + rtPtr = (ReflectedTransform *)ckalloc(sizeof(ReflectedTransform)); /* rtPtr->chan: Assigned by caller. Dummy data here. */ /* rtPtr->methods: Assigned by caller. Dummy data here. */ @@ -1802,7 +1819,7 @@ NewReflectedTransform( */ rtPtr->argc = listc + 2; - rtPtr->argv = ckalloc(sizeof(Tcl_Obj *) * (listc+4)); + rtPtr->argv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (listc+4)); /* * Duplicate object references. @@ -2107,10 +2124,10 @@ static ReflectedTransformMap * GetReflectedTransformMap( Tcl_Interp *interp) { - ReflectedTransformMap *rtmPtr = Tcl_GetAssocData(interp, RTMKEY, NULL); + ReflectedTransformMap *rtmPtr = (ReflectedTransformMap *)Tcl_GetAssocData(interp, RTMKEY, NULL); if (rtmPtr == NULL) { - rtmPtr = ckalloc(sizeof(ReflectedTransformMap)); + rtmPtr = (ReflectedTransformMap *)ckalloc(sizeof(ReflectedTransformMap)); Tcl_InitHashTable(&rtmPtr->map, TCL_STRING_KEYS); Tcl_SetAssocData(interp, RTMKEY, (Tcl_InterpDeleteProc *) DeleteReflectedTransformMap, rtmPtr); @@ -2165,11 +2182,11 @@ DeleteReflectedTransformMap( * this interp. */ - rtmPtr = clientData; + rtmPtr = (ReflectedTransformMap *)clientData; for (hPtr = Tcl_FirstHashEntry(&rtmPtr->map, &hSearch); hPtr != NULL; hPtr = Tcl_FirstHashEntry(&rtmPtr->map, &hSearch)) { - rtPtr = Tcl_GetHashValue(hPtr); + rtPtr = (ReflectedTransform *)Tcl_GetHashValue(hPtr); rtPtr->dead = 1; Tcl_DeleteHashEntry(hPtr); @@ -2193,7 +2210,7 @@ DeleteReflectedTransformMap( for (hPtr = Tcl_FirstHashEntry(&rtmPtr->map, &hSearch); hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) { - rtPtr = Tcl_GetHashValue(hPtr); + rtPtr = (ReflectedTransform *)Tcl_GetHashValue(hPtr); if (rtPtr->interp != interp) { /* @@ -2273,7 +2290,7 @@ GetThreadReflectedTransformMap(void) ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); if (!tsdPtr->rtmPtr) { - tsdPtr->rtmPtr = ckalloc(sizeof(ReflectedTransformMap)); + tsdPtr->rtmPtr = (ReflectedTransformMap *)ckalloc(sizeof(ReflectedTransformMap)); Tcl_InitHashTable(&tsdPtr->rtmPtr->map, TCL_STRING_KEYS); Tcl_CreateThreadExitHandler(DeleteThreadReflectedTransformMap, NULL); } @@ -2301,13 +2318,14 @@ GetThreadReflectedTransformMap(void) static void DeleteThreadReflectedTransformMap( - ClientData clientData) /* The per-thread data structure. */ + ClientData dummy) /* The per-thread data structure. */ { Tcl_HashSearch hSearch; /* Search variable. */ Tcl_HashEntry *hPtr; /* Search variable. */ Tcl_ThreadId self = Tcl_GetCurrentThread(); ReflectedTransformMap *rtmPtr; /* The map */ ForwardingResult *resultPtr; + (void)dummy; /* * The origin thread for one or more reflected channels is gone. @@ -2325,7 +2343,7 @@ DeleteThreadReflectedTransformMap( for (hPtr = Tcl_FirstHashEntry(&rtmPtr->map, &hSearch); hPtr != NULL; hPtr = Tcl_FirstHashEntry(&rtmPtr->map, &hSearch)) { - ReflectedTransform *rtPtr = Tcl_GetHashValue(hPtr); + ReflectedTransform *rtPtr = (ReflectedTransform *)Tcl_GetHashValue(hPtr); rtPtr->dead = 1; FreeReflectedTransformArgs(rtPtr); @@ -2408,8 +2426,8 @@ ForwardOpToOwnerThread( * Create and initialize the event and data structures. */ - evPtr = ckalloc(sizeof(ForwardingEvent)); - resultPtr = ckalloc(sizeof(ForwardingResult)); + evPtr = (ForwardingEvent *)ckalloc(sizeof(ForwardingEvent)); + resultPtr = (ForwardingResult *)ckalloc(sizeof(ForwardingResult)); evPtr->event.proc = ForwardProc; evPtr->resultPtr = resultPtr; @@ -2520,6 +2538,7 @@ ForwardProc( /* Map of reflected channels with handlers in * this interp. */ Tcl_HashEntry *hPtr; /* Entry in the above map */ + (void)mask; /* * Ignore the event if no one is waiting for its result anymore. @@ -2602,8 +2621,8 @@ ForwardProc( paramPtr->transform.size = bytec; if (bytec > 0) { - paramPtr->transform.buf = ckalloc(bytec); - memcpy(paramPtr->transform.buf, bytev, (size_t)bytec); + paramPtr->transform.buf = (char *)ckalloc(bytec); + memcpy(paramPtr->transform.buf, bytev, bytec); } else { paramPtr->transform.buf = NULL; } @@ -2636,8 +2655,8 @@ ForwardProc( paramPtr->transform.size = bytec; if (bytec > 0) { - paramPtr->transform.buf = ckalloc(bytec); - memcpy(paramPtr->transform.buf, bytev, (size_t)bytec); + paramPtr->transform.buf = (char *)ckalloc(bytec); + memcpy(paramPtr->transform.buf, bytev, bytec); } else { paramPtr->transform.buf = NULL; } @@ -2665,8 +2684,8 @@ ForwardProc( paramPtr->transform.size = bytec; if (bytec > 0) { - paramPtr->transform.buf = ckalloc(bytec); - memcpy(paramPtr->transform.buf, bytev, (size_t)bytec); + paramPtr->transform.buf = (char *)ckalloc(bytec); + memcpy(paramPtr->transform.buf, bytev, bytec); } else { paramPtr->transform.buf = NULL; } @@ -2692,8 +2711,8 @@ ForwardProc( paramPtr->transform.size = bytec; if (bytec > 0) { - paramPtr->transform.buf = ckalloc(bytec); - memcpy(paramPtr->transform.buf, bytev, (size_t)bytec); + paramPtr->transform.buf = (char *)ckalloc(bytec); + memcpy(paramPtr->transform.buf, bytev, bytec); } else { paramPtr->transform.buf = NULL; } @@ -2752,7 +2771,7 @@ static void SrcExitProc( ClientData clientData) { - ForwardingEvent *evPtr = clientData; + ForwardingEvent *evPtr = (ForwardingEvent *)clientData; ForwardingResult *resultPtr; ForwardParam *paramPtr; @@ -2806,7 +2825,7 @@ ForwardSetObjError( len++; ForwardSetDynamicError(paramPtr, ckalloc(len)); - memcpy(paramPtr->base.msgStr, msgStr, (unsigned) len); + memcpy(paramPtr->base.msgStr, msgStr, len); } #endif /* TCL_THREADS */ @@ -2892,7 +2911,7 @@ static void TimerRun( ClientData clientData) { - ReflectedTransform *rtPtr = clientData; + ReflectedTransform *rtPtr = (ReflectedTransform *)clientData; rtPtr->timer = NULL; Tcl_NotifyChannel(rtPtr->chan, TCL_READABLE); diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 27f2710..2df7b28 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -99,6 +99,8 @@ typedef struct TtyAttrs { static int FileBlockModeProc(ClientData instanceData, int mode); static int FileCloseProc(ClientData instanceData, Tcl_Interp *interp); +static int FileClose2Proc(ClientData instanceData, + Tcl_Interp *interp, int flags); static int FileGetHandleProc(ClientData instanceData, int direction, ClientData *handlePtr); static int FileInputProc(ClientData instanceData, char *buf, @@ -144,7 +146,7 @@ static const Tcl_ChannelType fileChannelType = { NULL, /* Get option proc. */ FileWatchProc, /* Initialize notifier. */ FileGetHandleProc, /* Get OS handles out of channel. */ - NULL, /* close2proc. */ + FileClose2Proc, /* close2proc. */ FileBlockModeProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -170,7 +172,7 @@ static const Tcl_ChannelType ttyChannelType = { TtyGetOptionProc, /* Get option proc. */ FileWatchProc, /* Initialize notifier. */ FileGetHandleProc, /* Get OS handles out of channel. */ - NULL, /* close2proc. */ + FileClose2Proc, /* close2proc. */ FileBlockModeProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -347,6 +349,17 @@ FileCloseProc( ckfree(fsPtr); return errorCode; } +static int +FileClose2Proc( + ClientData instanceData, /* File state. */ + Tcl_Interp *interp, /* For error reporting - unused. */ + int flags) +{ + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) { + return FileCloseProc(instanceData, interp); + } + return EINVAL; +} /* *---------------------------------------------------------------------- diff --git a/win/tclWinChan.c b/win/tclWinChan.c index b8016ec..54d0c84 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -76,6 +76,8 @@ static void FileChannelExitHandler(ClientData clientData); static void FileCheckProc(ClientData clientData, int flags); static int FileCloseProc(ClientData instanceData, Tcl_Interp *interp); +static int FileClose2Proc(ClientData instanceData, + Tcl_Interp *interp, int flags); static int FileEventProc(Tcl_Event *evPtr, int flags); static int FileGetHandleProc(ClientData instanceData, int direction, ClientData *handlePtr); @@ -111,7 +113,7 @@ static const Tcl_ChannelType fileChannelType = { NULL, /* Get option proc. */ FileWatchProc, /* Set up the notifier to watch the channel. */ FileGetHandleProc, /* Get an OS handle from channel. */ - NULL, /* close2proc. */ + FileClose2Proc, /* close2proc. */ FileBlockProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -360,7 +362,7 @@ FileBlockProc( /* *---------------------------------------------------------------------- * - * FileCloseProc -- + * FileCloseProc/FileClose2Proc -- * * Closes the IO channel. * @@ -427,6 +429,18 @@ FileCloseProc( ckfree(fileInfoPtr); return errorCode; } + +static int +FileClose2Proc( + ClientData instanceData, /* Pointer to FileInfo structure. */ + Tcl_Interp *interp, /* Not used. */ + int flags) +{ + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) { + return FileCloseProc(instanceData, interp); + } + return EINVAL; +} /* *---------------------------------------------------------------------- diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 173fe9e..1293ebe 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -140,6 +140,8 @@ static int ConsoleBlockModeProc(ClientData instanceData, static void ConsoleCheckProc(ClientData clientData, int flags); static int ConsoleCloseProc(ClientData instanceData, Tcl_Interp *interp); +static int ConsoleClose2Proc(ClientData instanceData, + Tcl_Interp *interp, int flags); static int ConsoleEventProc(Tcl_Event *evPtr, int flags); static void ConsoleExitHandler(ClientData clientData); static int ConsoleGetHandleProc(ClientData instanceData, @@ -179,7 +181,7 @@ static const Tcl_ChannelType consoleChannelType = { NULL, /* Get option proc. */ ConsoleWatchProc, /* Set up notifier to watch the channel. */ ConsoleGetHandleProc, /* Get an OS handle from channel. */ - NULL, /* close2proc. */ + ConsoleClose2Proc, /* close2proc. */ ConsoleBlockModeProc, /* Set blocking or non-blocking mode. */ NULL, /* Flush proc. */ NULL, /* Handler proc. */ @@ -506,7 +508,7 @@ ConsoleBlockModeProc( /* *---------------------------------------------------------------------- * - * ConsoleCloseProc -- + * ConsoleCloseProc/ConsoleClose2Proc -- * * Closes a console based IO channel. * @@ -604,6 +606,18 @@ ConsoleCloseProc( return errorCode; } + +static int +ConsoleClose2Proc( + ClientData instanceData, /* Pointer to ConsoleInfo structure. */ + Tcl_Interp *interp, /* For error reporting. */ + int flags) +{ + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) { + return ConsoleCloseProc(instanceData, interp); + } + return EINVAL; +} /* *---------------------------------------------------------------------- diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 4f7c0be..be7ec2c 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -160,6 +160,8 @@ static int SerialBlockProc(ClientData instanceData, int mode); static void SerialCheckProc(ClientData clientData, int flags); static int SerialCloseProc(ClientData instanceData, Tcl_Interp *interp); +static int SerialClose2Proc(ClientData instanceData, + Tcl_Interp *interp, int flags); static int SerialEventProc(Tcl_Event *evPtr, int flags); static void SerialExitHandler(ClientData clientData); static int SerialGetHandleProc(ClientData instanceData, @@ -203,7 +205,7 @@ static const Tcl_ChannelType serialChannelType = { SerialGetOptionProc, /* Get option proc. */ SerialWatchProc, /* Set up notifier to watch the channel. */ SerialGetHandleProc, /* Get an OS handle from channel. */ - NULL, /* close2proc. */ + SerialClose2Proc, /* close2proc. */ SerialBlockProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -572,7 +574,7 @@ SerialBlockProc( /* *---------------------------------------------------------------------- * - * SerialCloseProc -- + * SerialCloseProc/SerialClose2Proc -- * * Closes a serial based IO channel. * @@ -664,6 +666,18 @@ SerialCloseProc( } return errorCode; } + +static int +SerialClose2Proc( + ClientData instanceData, /* Pointer to SerialInfo structure. */ + Tcl_Interp *interp, /* For error reporting. */ + int flags) +{ + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) { + return SerialCloseProc(instanceData, interp); + } + return EINVAL; +} /* *---------------------------------------------------------------------- -- cgit v0.12 From 3e92ec87dfc451e3f36387bc85f0646c659f2d8f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Mar 2020 15:52:50 +0000 Subject: Fix some gcc(-9) warnings caused by -Wcast-function-type --- win/tclWinDde.c | 2 +- win/tclWinInit.c | 4 ++-- win/tclWinLoad.c | 2 +- win/tclWinReg.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/win/tclWinDde.c b/win/tclWinDde.c index a4c00fa..2fc4990 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -251,7 +251,7 @@ Initialize(void) if (ddeInstance == 0) { Tcl_MutexLock(&ddeMutex); if (ddeInstance == 0) { - if (DdeInitializeW(&ddeInstance, (PFNCALLBACK) DdeServerProc, + if (DdeInitializeW(&ddeInstance, (PFNCALLBACK)(void *)DdeServerProc, CBF_SKIP_REGISTRATIONS | CBF_SKIP_UNREGISTRATIONS | CBF_FAIL_POKES, 0) != DMLERR_NO_ERROR) { ddeInstance = 0; diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 02471a6..6ca6a46 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -168,7 +168,7 @@ TclpInitPlatform(void) */ handle = GetModuleHandleW(L"KERNEL32"); tclWinProcs.cancelSynchronousIo = - (BOOL (WINAPI *)(HANDLE)) GetProcAddress(handle, + (BOOL (WINAPI *)(HANDLE))(void *)GetProcAddress(handle, "CancelSynchronousIo"); } @@ -581,7 +581,7 @@ TclpSetVariables( if (!osInfoInitialized) { HMODULE handle = GetModuleHandleW(L"NTDLL"); int(__stdcall *getversion)(void *) = - (int(__stdcall *)(void *)) GetProcAddress(handle, "RtlGetVersion"); + (int(__stdcall *)(void *))(void *)GetProcAddress(handle, "RtlGetVersion"); osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); if (!getversion || getversion(&osInfo)) { GetVersionExW(&osInfo); diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 89adcc3..c6e4bed 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -217,7 +217,7 @@ FindSymbol( Tcl_DStringInit(&ds); TclDStringAppendLiteral(&ds, "_"); sym2 = Tcl_DStringAppend(&ds, symbol, -1); - proc = (Tcl_PackageInitProc *) GetProcAddress(hInstance, sym2); + proc = (Tcl_PackageInitProc *)(void *)GetProcAddress(hInstance, sym2); Tcl_DStringFree(&ds); } if (proc == NULL && interp != NULL) { diff --git a/win/tclWinReg.c b/win/tclWinReg.c index 7bbb10b..16a0d3d 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -1235,7 +1235,7 @@ RecursiveDeleteKey( checkExProc = 1; handle = GetModuleHandleW(L"ADVAPI32"); regDeleteKeyExProc = (LONG (*) (HKEY, LPCWSTR, REGSAM, DWORD)) - GetProcAddress(handle, "RegDeleteKeyExW"); + (void *)GetProcAddress(handle, "RegDeleteKeyExW"); } if (mode && regDeleteKeyExProc) { result = regDeleteKeyExProc(startKey, keyName, mode, 0); -- cgit v0.12 From 167bc4d8e750ec782ba2da35dc08e0605028b9c9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Mar 2020 16:16:30 +0000 Subject: Some more gcc(-9) warnings --- win/tclWinLoad.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index c6e4bed..1d64d18 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -67,6 +67,7 @@ TclpDlopen( const WCHAR *nativeName; Tcl_LoadHandle handlePtr; DWORD firstError; + (void)flags; /* * First try the full path the user gave us. This is particularly @@ -74,7 +75,7 @@ TclpDlopen( * relative path. */ - nativeName = Tcl_FSGetNativePath(pathPtr); + nativeName = (const WCHAR *)Tcl_FSGetNativePath(pathPtr); if (nativeName != NULL) { hInstance = LoadLibraryExW(nativeName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); @@ -170,7 +171,7 @@ TclpDlopen( * Succeded; package everything up for Tcl. */ - handlePtr = ckalloc(sizeof(struct Tcl_LoadHandle_)); + handlePtr = (Tcl_LoadHandle)ckalloc(sizeof(struct Tcl_LoadHandle_)); handlePtr->clientData = (ClientData) hInstance; handlePtr->findSymbolProcPtr = &FindSymbol; handlePtr->unloadFileProcPtr = &UnloadFile; @@ -202,14 +203,14 @@ FindSymbol( const char *symbol) { HINSTANCE hInstance = (HINSTANCE) loadHandle->clientData; - Tcl_PackageInitProc *proc = NULL; + void *proc = NULL; /* * For each symbol, check for both Symbol and _Symbol, since Borland * generates C symbols with a leading '_' by default. */ - proc = (void *) GetProcAddress(hInstance, symbol); + proc = (void *)GetProcAddress(hInstance, symbol); if (proc == NULL) { Tcl_DString ds; const char *sym2; @@ -217,7 +218,7 @@ FindSymbol( Tcl_DStringInit(&ds); TclDStringAppendLiteral(&ds, "_"); sym2 = Tcl_DStringAppend(&ds, symbol, -1); - proc = (Tcl_PackageInitProc *)(void *)GetProcAddress(hInstance, sym2); + proc = (void *)GetProcAddress(hInstance, sym2); Tcl_DStringFree(&ds); } if (proc == NULL && interp != NULL) { @@ -285,6 +286,9 @@ TclGuessPackageName( Tcl_DString *bufPtr) /* Initialized empty dstring. Append package * name to this if possible. */ { + (void)fileName; + (void)bufPtr; + return 0; } @@ -416,7 +420,7 @@ InitDLLDirectoryName(void) */ copyToGlobalBuffer: - dllDirectoryName = ckalloc((nameLen+1) * sizeof(WCHAR)); + dllDirectoryName = (WCHAR *)ckalloc((nameLen+1) * sizeof(WCHAR)); wcscpy(dllDirectoryName, name); return TCL_OK; } -- cgit v0.12 From dd7b6e22451427342c566bd331192a76a3d32d32 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 4 Mar 2020 20:50:38 +0000 Subject: The close routines of the "tcp" channel type were failing to record error messages and error codes. --- unix/tclUnixSock.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index a00559a..0dd8e86 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -631,6 +631,9 @@ TcpCloseProc( freeaddrinfo(statePtr->myaddrlist); } ckfree(statePtr); + if (interp && errorCode) { + Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC); + } return errorCode; } @@ -660,6 +663,7 @@ TcpClose2Proc( TcpState *statePtr = instanceData; int readError = 0; int writeError = 0; + int errorCode = 0; /* * Shutdown the OS socket handle. @@ -673,7 +677,12 @@ TcpClose2Proc( if ((flags & TCL_CLOSE_WRITE) && (shutdown(statePtr->fds.fd, SHUT_WR) < 0)) { writeError = errno; } - return (readError != 0) ? readError : writeError; + + errorCode = (readError != 0) ? readError : writeError; + if (interp && errorCode) { + Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC); + } + return errorCode; } /* -- cgit v0.12 From 38aabeeca86a4a08cdf5def1c47588c02aafcf9c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 5 Mar 2020 11:32:43 +0000 Subject: Move setting of interpreter error-message from tclUnixSock.c to tclIO.c, since the same should be done for all channel types. (Thanks, Don, for noticing this!) Also, ENOTCONN for a half-close should not be fatal, just a EINVAL, when doing it as part of a full close. See: [65c9cd1534] --- generic/tclIO.c | 33 +++++++++++++---------------- unix/tclUnixSock.c | 61 +++++++++++++++++++++++++++--------------------------- 2 files changed, 44 insertions(+), 50 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 36f0a8e..67264a0 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -365,15 +365,6 @@ ChanClose( } } -static inline int -ChanCloseHalf( - Channel *chanPtr, - Tcl_Interp *interp, - int flags) -{ - return chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, flags); -} - /* *--------------------------------------------------------------------------- * @@ -3466,7 +3457,7 @@ Tcl_Close( if (chanPtr->typePtr->closeProc == TCL_CLOSE2PROC) { result = chanPtr->typePtr->close2Proc(chanPtr->instanceData, interp, TCL_CLOSE_READ); - if (result == EINVAL) { + if ((result == EINVAL) || result == ENOTCONN) { result = 0; } } @@ -3512,13 +3503,17 @@ Tcl_Close( * message set up to now. */ - if (flushcode != 0 && interp != NULL + if (flushcode != 0) { + /* flushcode has precedence, if available */ + result = flushcode; + } + if ((result != 0) && (result != TCL_ERROR) && (interp != NULL) && 0 == Tcl_GetCharLength(Tcl_GetObjResult(interp))) { - Tcl_SetErrno(flushcode); + Tcl_SetErrno(result); Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_PosixError(interp), -1)); } - if ((flushcode != 0) || (result != 0)) { + if (result != 0) { return TCL_ERROR; } return TCL_OK; @@ -3816,7 +3811,7 @@ CloseChannelPart( * message in the interp. */ - result = ChanCloseHalf(chanPtr, interp, flags); + result = chanPtr->typePtr->close2Proc(chanPtr->instanceData, NULL, flags); /* * If we are being called synchronously, report either any latent error on @@ -4220,12 +4215,12 @@ WillRead( * Prevent read attempts on a closed channel. */ - DiscardInputQueued(chanPtr->state, 0); + DiscardInputQueued(chanPtr->state, 0); Tcl_SetErrno(EINVAL); return -1; } if ((Tcl_ChannelSeekProc(chanPtr->typePtr) != NULL) - && (Tcl_OutputBuffered((Tcl_Channel) chanPtr) > 0)) { + && (Tcl_OutputBuffered((Tcl_Channel) chanPtr) > 0)) { /* * CAVEAT - The assumption here is that FlushChannel() will push out @@ -4237,9 +4232,9 @@ WillRead( * blocking mode. */ - if (FlushChannel(NULL, chanPtr, 0) != 0) { - return -1; - } + if (FlushChannel(NULL, chanPtr, 0) != 0) { + return -1; + } } return 0; } diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 0dd8e86..1901c8b 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -228,9 +228,9 @@ InitializeHostName( char *dot = strchr(u.nodename, '.'); if (dot != NULL) { - char *node = ckalloc(dot - u.nodename + 1); + char *node = (char *)ckalloc(dot - u.nodename + 1); - memcpy(node, u.nodename, (size_t) (dot - u.nodename)); + memcpy(node, u.nodename, dot - u.nodename); node[dot - u.nodename] = '\0'; hp = TclpGetHostByName(node); ckfree(node); @@ -320,8 +320,10 @@ Tcl_GetHostName(void) int TclpHasSockets( - Tcl_Interp *interp) /* Not used. */ + Tcl_Interp *dummy) /* Not used. */ { + (void)dummy; + return TCL_OK; } @@ -372,7 +374,7 @@ TcpBlockModeProc( * TCL_MODE_BLOCKING or * TCL_MODE_NONBLOCKING. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; if (mode == TCL_MODE_BLOCKING) { CLEAR_BITS(statePtr->flags, TCP_NONBLOCKING); @@ -505,7 +507,7 @@ TcpInputProc( * buffer? */ int *errorCodePtr) /* Where to store error code. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; int bytesRead; *errorCodePtr = 0; @@ -555,7 +557,7 @@ TcpOutputProc( int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; int written; *errorCodePtr = 0; @@ -593,11 +595,12 @@ TcpOutputProc( static int TcpCloseProc( ClientData instanceData, /* The socket to close. */ - Tcl_Interp *interp) /* For error reporting - unused. */ + Tcl_Interp *dummy) /* For error reporting - unused. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; int errorCode = 0; TcpFdList *fds; + (void)dummy; /* * Delete a file handler that may be active for this socket if this is a @@ -631,9 +634,6 @@ TcpCloseProc( freeaddrinfo(statePtr->myaddrlist); } ckfree(statePtr); - if (interp && errorCode) { - Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC); - } return errorCode; } @@ -657,19 +657,19 @@ TcpCloseProc( static int TcpClose2Proc( ClientData instanceData, /* The socket to close. */ - Tcl_Interp *interp, /* For error reporting. */ + Tcl_Interp *dummy, /* For error reporting. */ int flags) /* Flags that indicate which side to close. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; int readError = 0; int writeError = 0; - int errorCode = 0; + (void)dummy; /* * Shutdown the OS socket handle. */ if ((flags & (TCL_CLOSE_READ|TCL_CLOSE_WRITE)) == 0) { - return TcpCloseProc(instanceData, interp); + return TcpCloseProc(instanceData, NULL); } if ((flags & TCL_CLOSE_READ) && (shutdown(statePtr->fds.fd, SHUT_RD) < 0)) { readError = errno; @@ -677,12 +677,7 @@ TcpClose2Proc( if ((flags & TCL_CLOSE_WRITE) && (shutdown(statePtr->fds.fd, SHUT_WR) < 0)) { writeError = errno; } - - errorCode = (readError != 0) ? readError : writeError; - if (interp && errorCode) { - Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC); - } - return errorCode; + return (readError != 0) ? readError : writeError; } /* @@ -821,7 +816,7 @@ TcpGetOptionProc( Tcl_DString *dsPtr) /* Where to store the computed value; * initialized by caller. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; size_t len = 0; WaitForConnect(statePtr, NULL); @@ -1013,7 +1008,7 @@ TcpWatchProc( * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; if (statePtr->acceptProc != NULL) { /* @@ -1086,7 +1081,8 @@ TcpGetHandleProc( int direction, /* Not used. */ ClientData *handlePtr) /* Where to store the handle. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; + (void)direction; *handlePtr = INT2PTR(statePtr->fds.fd); return TCL_OK; @@ -1111,7 +1107,9 @@ TcpAsyncCallback( * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ { - TcpConnect(NULL, clientData); + (void)mask; + + TcpConnect(NULL, (TcpState *)clientData); } /* @@ -1370,7 +1368,7 @@ Tcl_OpenTcpClient( * Allocate a new TcpState for this socket. */ - statePtr = ckalloc(sizeof(TcpState)); + statePtr = (TcpState *)ckalloc(sizeof(TcpState)); memset(statePtr, 0, sizeof(TcpState)); statePtr->flags = async ? TCP_ASYNC_CONNECT : 0; statePtr->cachedBlocking = TCL_MODE_BLOCKING; @@ -1449,7 +1447,7 @@ TclpMakeTcpClientChannelMode( TcpState *statePtr; char channelName[SOCK_CHAN_LENGTH]; - statePtr = ckalloc(sizeof(TcpState)); + statePtr = (TcpState *)ckalloc(sizeof(TcpState)); memset(statePtr, 0, sizeof(TcpState)); statePtr->fds.fd = PTR2INT(sock); statePtr->flags = 0; @@ -1609,14 +1607,14 @@ Tcl_OpenTcpServer( * Allocate a new TcpState for this socket. */ - statePtr = ckalloc(sizeof(TcpState)); + statePtr = (TcpState *)ckalloc(sizeof(TcpState)); memset(statePtr, 0, sizeof(TcpState)); statePtr->acceptProc = acceptProc; statePtr->acceptProcData = acceptProcData; sprintf(channelName, SOCK_TEMPLATE, (long) statePtr); newfds = &statePtr->fds; } else { - newfds = ckalloc(sizeof(TcpFdList)); + newfds = (TcpFdList *)ckalloc(sizeof(TcpFdList)); memset(newfds, (int) 0, sizeof(TcpFdList)); fds->next = newfds; } @@ -1680,13 +1678,14 @@ TcpAccept( ClientData data, /* Callback token. */ int mask) /* Not used. */ { - TcpFdList *fds = data; /* Client data of server socket. */ + TcpFdList *fds = (TcpFdList *)data; /* Client data of server socket. */ int newsock; /* The new client socket */ TcpState *newSockState; /* State for new socket. */ address addr; /* The remote address */ socklen_t len; /* For accept interface */ char channelName[SOCK_CHAN_LENGTH]; char host[NI_MAXHOST], port[NI_MAXSERV]; + (void)mask; len = sizeof(addr); newsock = accept(fds->fd, &addr.sa, &len); @@ -1701,7 +1700,7 @@ TcpAccept( (void) fcntl(newsock, F_SETFD, FD_CLOEXEC); - newSockState = ckalloc(sizeof(TcpState)); + newSockState = (TcpState *)ckalloc(sizeof(TcpState)); memset(newSockState, 0, sizeof(TcpState)); newSockState->flags = 0; newSockState->fds.fd = newsock; -- cgit v0.12 From 02ceb3f3a43bd0d5c7e4fe00b99c1f4cc67919a3 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 5 Mar 2020 19:17:34 +0000 Subject: Have to move the JOIN() macro out of deprecation for this TCL_UNUSED. Alternatives welcome. --- generic/tcl.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 4e601ca..6aff9e7 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -81,16 +81,17 @@ extern "C" { # define STRINGIFY(x) STRINGIFY1(x) # define STRINGIFY1(x) #x #endif -#ifndef JOIN -# define JOIN(a,b) JOIN1(a,b) -# define JOIN1(a,b) a##b -#endif #ifndef TCL_THREADS # define TCL_THREADS 1 #endif #endif /* !TCL_NO_DEPRECATED */ +#ifndef JOIN +# define JOIN(a,b) JOIN1(a,b) +# define JOIN1(a,b) a##b +#endif + /* * A special definition used to allow this header file to be included from * windows resource files so that they can obtain version information. -- cgit v0.12 From 39956f875b4912769d0e660e52054bbdb8670e1c Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 13:45:00 +0000 Subject: More deployment of TCL_UNUSED. (Travis appears happy with it). --- generic/tclAssembly.c | 13 ++--- generic/tclBasic.c | 138 +++++++++++++++++--------------------------------- 2 files changed, 50 insertions(+), 101 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 88f3e29..4491d9b 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -787,7 +787,7 @@ Tcl_AssembleObjCmd( int TclNRAssembleObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -796,7 +796,6 @@ 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; @@ -961,8 +960,7 @@ TclCompileAssembleCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; /* Token in the input script */ @@ -970,7 +968,6 @@ 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. */ @@ -4314,11 +4311,9 @@ AddBasicBlockRangeToErrorInfo( static void DupAssembleCodeInternalRep( - Tcl_Obj *srcPtr, - Tcl_Obj *copyPtr) + TCL_UNUSED(Tcl_Obj *), + TCL_UNUSED(Tcl_Obj *)) { - (void)srcPtr; - (void)copyPtr; return; } diff --git a/generic/tclBasic.c b/generic/tclBasic.c index c02cf6a..f7f4f19 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -1374,12 +1374,10 @@ static int BadEnsembleSubcommand( ClientData clientData, Tcl_Interp *interp, - int objc, - Tcl_Obj *const objv[]) + TCL_UNUSED(int) /*objc*/, + TCL_UNUSED(Tcl_Obj *const *) /* objv */) { const UnsafeEnsembleInfo *infoPtr = (const UnsafeEnsembleInfo *)clientData; - (void)objc; - (void)objv; Tcl_SetObjResult(interp, Tcl_ObjPrintf( "not allowed to invoke subcommand %s of %s", @@ -3319,13 +3317,12 @@ Tcl_GetCommandInfoFromToken( const char * Tcl_GetCommandName( - Tcl_Interp *dummy, /* Not used. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Command command) /* Token for command returned by a previous * call to Tcl_CreateCommand. The command must * not have been deleted. */ { Command *cmdPtr = (Command *) command; - (void)dummy; if ((cmdPtr == NULL) || (cmdPtr->hPtr == NULL)) { /* @@ -3768,12 +3765,11 @@ CallCommandTraces( static int CancelEvalProc( ClientData clientData, /* Interp to cancel the script in progress. */ - Tcl_Interp *dummy, /* Not used. */ + TCL_UNUSED(Tcl_Interp *), int code) /* Current return code from command. */ { CancelInfo *cancelInfo = (CancelInfo *)clientData; Interp *iPtr; - (void)dummy; if (cancelInfo != NULL) { Tcl_MutexLock(&cancelLock); @@ -4616,7 +4612,7 @@ static int EvalObjvCore( ClientData data[], Tcl_Interp *interp, - int result) + TCL_UNUSED(int) /*result*/) { Command *cmdPtr = NULL, *preCmdPtr = (Command *)data[0]; int flags = PTR2INT(data[1]); @@ -4625,7 +4621,6 @@ EvalObjvCore( Interp *iPtr = (Interp *) interp; Namespace *lookupNsPtr = NULL; int enterTracesDone = 0; - (void)result; /* * Push records for task to be done on return, in INVERSE order. First, if @@ -4777,14 +4772,13 @@ static int Dispatch( ClientData data[], Tcl_Interp *interp, - int result) + TCL_UNUSED(int) /*result*/) { Tcl_ObjCmdProc *objProc = (Tcl_ObjCmdProc *)data[0]; ClientData clientData = data[1]; int objc = PTR2INT(data[2]); Tcl_Obj **objv = (Tcl_Obj **)data[3]; Interp *iPtr = (Interp *) interp; - (void)result; #ifdef USE_DTRACE if (TCL_DTRACE_CMD_ARGS_ENABLED()) { @@ -7037,7 +7031,7 @@ TclObjInvoke( int TclNRInvoke( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -7047,7 +7041,6 @@ TclNRInvoke( const char *cmdName; /* Name of the command from objv[0]. */ Tcl_HashEntry *hPtr = NULL; Command *cmdPtr; - (void)dummy; cmdName = TclGetString(objv[0]); hTblPtr = iPtr->hiddenCmdTablePtr; @@ -7081,12 +7074,11 @@ TclNRInvoke( static int NRPostInvoke( - ClientData dummy[], /* Not used. */ + TCL_UNUSED(ClientData *), Tcl_Interp *interp, int result) { Interp *iPtr = (Interp *)interp; - (void)dummy; iPtr->numLevels--; return result; @@ -7522,7 +7514,7 @@ Tcl_GetVersion( static int ExprCeilFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ @@ -7531,7 +7523,6 @@ ExprCeilFunc( int code; double d; mp_int big; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -7563,7 +7554,7 @@ ExprCeilFunc( static int ExprFloorFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ @@ -7572,7 +7563,6 @@ ExprFloorFunc( int code; double d; mp_int big; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -7604,7 +7594,7 @@ ExprFloorFunc( static int ExprIsqrtFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute. */ int objc, /* Actual parameter count. */ Tcl_Obj *const *objv) /* Actual parameter list. */ @@ -7616,7 +7606,6 @@ ExprIsqrtFunc( mp_int big; int exact = 0; /* Flag ==1 if the argument can be represented * in a double as an exact integer. */ - (void)dummy; /* * Check syntax. @@ -7711,7 +7700,7 @@ ExprIsqrtFunc( static int ExprSqrtFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ @@ -7720,7 +7709,6 @@ ExprSqrtFunc( int code; double d; mp_int big; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -7880,7 +7868,7 @@ ExprBinaryFunc( static int ExprAbsFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ @@ -7889,7 +7877,6 @@ ExprAbsFunc( ClientData ptr; int type; mp_int big; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -7980,14 +7967,13 @@ ExprAbsFunc( static int ExprBoolFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ Tcl_Obj *const *objv) /* Actual parameter vector. */ { int value; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -8002,14 +7988,13 @@ ExprBoolFunc( static int ExprDoubleFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ Tcl_Obj *const *objv) /* Actual parameter vector. */ { double dResult; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -8030,7 +8015,7 @@ ExprDoubleFunc( static int ExprIntFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ @@ -8039,7 +8024,6 @@ ExprIntFunc( double d; int type; ClientData ptr; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -8087,14 +8071,13 @@ ExprIntFunc( static int ExprWideFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ Tcl_Obj *const *objv) /* Actual parameter vector. */ { Tcl_WideInt wResult; - (void)dummy; if (ExprIntFunc(NULL, interp, objc, objv) != TCL_OK) { return TCL_ERROR; @@ -8109,7 +8092,7 @@ ExprWideFunc( */ static int ExprMaxMinFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ @@ -8120,7 +8103,6 @@ ExprMaxMinFunc( double d; int type, i; ClientData ptr; - (void)dummy; if (objc < 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -8150,31 +8132,29 @@ ExprMaxMinFunc( static int ExprMaxFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ Tcl_Obj *const *objv) /* Actual parameter vector. */ { - (void)dummy; return ExprMaxMinFunc(NULL, interp, objc, objv, MP_GT); } static int ExprMinFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ Tcl_Obj *const *objv) /* Actual parameter vector. */ { - (void)dummy; return ExprMaxMinFunc(NULL, interp, objc, objv, MP_LT); } static int ExprRandFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ @@ -8185,7 +8165,6 @@ ExprRandFunc( long tmp; /* Algorithm assumes at least 32 bits. Only * long guarantees that. See below. */ Tcl_Obj *oResult; - (void)dummy; if (objc != 1) { MathFuncWrongNumArgs(interp, 1, objc, objv); @@ -8268,7 +8247,7 @@ ExprRandFunc( static int ExprRoundFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ @@ -8277,7 +8256,6 @@ ExprRoundFunc( double d; ClientData ptr; int type; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -8348,15 +8326,14 @@ ExprRoundFunc( static int ExprSrandFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count. */ Tcl_Obj *const *objv) /* Parameter vector. */ { Interp *iPtr = (Interp *) interp; - Tcl_WideInt w = 0; /* Initialized to avoid compiler warning. */ - (void)dummy; + Tcl_WideInt w = 0; /* Initialized to avoid compiler warning. */ /* * Convert argument and use it to reset the seed. @@ -8538,7 +8515,7 @@ ClassifyDouble( static int ExprIsFiniteFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ @@ -8547,7 +8524,6 @@ ExprIsFiniteFunc( double d; ClientData ptr; int type, result = 0; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -8570,7 +8546,7 @@ ExprIsFiniteFunc( static int ExprIsInfinityFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ @@ -8579,7 +8555,6 @@ ExprIsInfinityFunc( double d; ClientData ptr; int type, result = 0; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -8601,7 +8576,7 @@ ExprIsInfinityFunc( static int ExprIsNaNFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ @@ -8610,7 +8585,6 @@ ExprIsNaNFunc( double d; ClientData ptr; int type, result = 1; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -8632,7 +8606,7 @@ ExprIsNaNFunc( static int ExprIsNormalFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ @@ -8641,7 +8615,6 @@ ExprIsNormalFunc( double d; ClientData ptr; int type, result = 0; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -8663,7 +8636,7 @@ ExprIsNormalFunc( static int ExprIsSubnormalFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ @@ -8672,7 +8645,6 @@ ExprIsSubnormalFunc( double d; ClientData ptr; int type, result = 0; - (void)dummy; if (objc != 2) { MathFuncWrongNumArgs(interp, 2, objc, objv); @@ -8694,7 +8666,7 @@ ExprIsSubnormalFunc( static int ExprIsUnorderedFunc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ @@ -8703,7 +8675,6 @@ ExprIsUnorderedFunc( double d; ClientData ptr; int type, result = 0; - (void)dummy; if (objc != 3) { MathFuncWrongNumArgs(interp, 3, objc, objv); @@ -8736,7 +8707,7 @@ ExprIsUnorderedFunc( static int FloatClassifyObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ @@ -8746,7 +8717,6 @@ FloatClassifyObjCmd( Tcl_Obj *objPtr; ClientData ptr; int type; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "floatValue"); @@ -8846,14 +8816,11 @@ MathFuncWrongNumArgs( static int DTraceObjCmd( - ClientData dummy, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ + TCL_UNUSED(ClientData), + TCL_UNUSED(Tcl_Interp *), int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - (void)interp; - if (TCL_DTRACE_TCL_PROBE_ENABLED()) { char *a[10]; int i = 0; @@ -9233,13 +9200,12 @@ TclSetTailcall( int TclNRTailcallObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Interp *iPtr = (Interp *) interp; - (void)dummy; if (objc < 1) { Tcl_WrongNumArgs(interp, 1, objv, "?command? ?arg ...?"); @@ -9339,11 +9305,10 @@ TclNRTailcallEval( int TclNRReleaseValues( ClientData data[], - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), int result) { int i = 0; - (void)dummy; while (i < 4) { if (data[i]) { @@ -9428,7 +9393,7 @@ TclNRYieldObjCmd( int TclNRYieldToObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -9436,7 +9401,6 @@ TclNRYieldToObjCmd( CoroutineData *corPtr = iPtr->execEnvPtr->corPtr; Tcl_Obj *listPtr, *nsObjPtr; Tcl_Namespace *nsPtr = TclGetCurrentNamespace(interp); - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "command ?arg ...?"); @@ -9483,9 +9447,8 @@ static int RewindCoroutineCallback( ClientData data[], Tcl_Interp *interp, - int result) + TCL_UNUSED(int) /*result*/) { - (void)result; return Tcl_RestoreInterpState(interp, (Tcl_InterpState)data[0]); } @@ -9635,13 +9598,12 @@ int TclNRCoroutineActivateCallback( ClientData data[], Tcl_Interp *interp, - int result) + TCL_UNUSED(int) /*result*/) { CoroutineData *corPtr = (CoroutineData *)data[0]; int type = PTR2INT(data[1]); int numLevels, unused; int *stackLevel = &unused; - (void)result; if (!corPtr->stackLevel) { /* @@ -9715,12 +9677,11 @@ static int TclNREvalList( ClientData data[], Tcl_Interp *interp, - int result) + TCL_UNUSED(int) /*result*/) { int objc; Tcl_Obj **objv; Tcl_Obj *listPtr = (Tcl_Obj *)data[0]; - (void)result; Tcl_IncrRefCount(listPtr); @@ -9742,14 +9703,13 @@ TclNREvalList( static int CoroTypeObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Command *cmdPtr; CoroutineData *corPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "coroName"); @@ -9833,14 +9793,13 @@ GetCoroutineFromObj( static int TclNRCoroInjectObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { CoroutineData *corPtr; ExecEnv *savedEEPtr = iPtr->execEnvPtr; - (void)dummy; /* * Usage more or less like tailcall: @@ -9879,7 +9838,7 @@ TclNRCoroInjectObjCmd( static int TclNRCoroProbeObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -9888,7 +9847,6 @@ TclNRCoroProbeObjCmd( ExecEnv *savedEEPtr = iPtr->execEnvPtr; int numLevels, unused; int *stackLevel = &unused; - (void)dummy; /* * Usage more or less like tailcall: @@ -9979,7 +9937,7 @@ static int InjectHandler( ClientData data[], Tcl_Interp *interp, - int result) + TCL_UNUSED(int) /*result*/) { CoroutineData *corPtr = (CoroutineData *)data[0]; Tcl_Obj *listPtr = (Tcl_Obj *)data[1]; @@ -9987,7 +9945,6 @@ InjectHandler( ClientData isProbe = data[3]; int objc; Tcl_Obj **objv; - (void)result; if (!isProbe) { /* @@ -10074,14 +10031,13 @@ InjectHandlerPostCall( static int NRInjectObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { CoroutineData *corPtr; ExecEnv *savedEEPtr = iPtr->execEnvPtr; - (void)dummy; /* * Usage more or less like tailcall: @@ -10184,7 +10140,7 @@ TclNRInterpCoroutine( int TclNRCoroutineObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -10195,7 +10151,6 @@ TclNRCoroutineObjCmd( Namespace *nsPtr, *altNsPtr, *cxtNsPtr, *inNsPtr = (Namespace *)TclGetCurrentNamespace(interp); Namespace *lookupNsPtr = iPtr->varFramePtr->nsPtr; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "name cmd ?arg ...?"); @@ -10318,13 +10273,12 @@ TclNRCoroutineObjCmd( int TclInfoCoroutineCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { CoroutineData *corPtr = iPtr->execEnvPtr->corPtr; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); -- cgit v0.12 From d38d34e93774eb6c4b854721d8273280033bdc34 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 13:55:07 +0000 Subject: Untangle some MEM_DEBUG ifdeffery. --- generic/tclBinary.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/generic/tclBinary.c b/generic/tclBinary.c index d269fbe..f0fc866 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -352,6 +352,7 @@ Tcl_NewByteArrayObj( *---------------------------------------------------------------------- */ +#ifdef TCL_MEM_DEBUG Tcl_Obj * Tcl_DbNewByteArrayObj( const unsigned char *bytes, /* The array of bytes used to initialize the @@ -363,18 +364,25 @@ Tcl_DbNewByteArrayObj( int line) /* Line number in the source file; used for * debugging. */ { -#ifdef TCL_MEM_DEBUG Tcl_Obj *objPtr; TclDbNewObj(objPtr, file, line); Tcl_SetByteArrayObj(objPtr, bytes, length); return objPtr; +} #else /* if not TCL_MEM_DEBUG */ - (void)file; - (void)line; +Tcl_Obj * +Tcl_DbNewByteArrayObj( + const unsigned char *bytes, /* The array of bytes used to initialize the + * new object. */ + int length, /* Length of the array of bytes, which must be + * >= 0. */ + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) +{ return Tcl_NewByteArrayObj(bytes, length); -#endif /* TCL_MEM_DEBUG */ } +#endif /* TCL_MEM_DEBUG */ /* *--------------------------------------------------------------------------- @@ -549,7 +557,7 @@ Tcl_SetByteArrayLength( static int SetByteArrayFromAny( - Tcl_Interp *dummy, /* Not used. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Obj *objPtr) /* The object to convert to type ByteArray. */ { size_t length; @@ -559,7 +567,6 @@ SetByteArrayFromAny( Tcl_UniChar ch = 0; ByteArray *byteArrayPtr; Tcl_ObjIntRep ir; - (void)dummy; if (TclHasIntRep(objPtr, &properByteArrayType)) { return TCL_OK; @@ -893,7 +900,7 @@ TclInitBinaryCmd( static int BinaryFormatCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -915,7 +922,6 @@ BinaryFormatCmd( const char *errorString; const char *errorValue, *str; int offset, size, length; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "formatString ?arg ...?"); @@ -1399,7 +1405,7 @@ BinaryFormatCmd( int BinaryScanCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1422,7 +1428,6 @@ BinaryScanCmd( Tcl_Obj *valuePtr, *elementPtr; Tcl_HashTable numberCacheHash; Tcl_HashTable *numberCachePtr; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, @@ -2467,7 +2472,7 @@ DeleteScanNumberCache( static int BinaryEncodeHex( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -2476,7 +2481,6 @@ BinaryEncodeHex( unsigned char *data = NULL; unsigned char *cursor = NULL; int offset = 0, count = 0; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "data"); @@ -2512,7 +2516,7 @@ BinaryEncodeHex( static int BinaryDecodeHex( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -2523,7 +2527,6 @@ BinaryDecodeHex( int i, index, value, size, count = 0, cut = 0, strict = 0; enum {OPT_STRICT }; static const char *const optStrings[] = { "-strict", NULL }; - (void)dummy; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "?options? data"); @@ -2632,7 +2635,7 @@ BinaryDecodeHex( static int BinaryEncode64( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -2645,7 +2648,6 @@ BinaryEncode64( int offset, i, index, size, outindex = 0, count = 0; enum { OPT_MAXLEN, OPT_WRAPCHAR }; static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL }; - (void)dummy; if (objc < 2 || objc % 2 != 0) { Tcl_WrongNumArgs(interp, 1, objv, @@ -2739,7 +2741,7 @@ BinaryEncode64( static int BinaryEncodeUu( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -2753,7 +2755,6 @@ BinaryEncodeUu( int wrapcharlen = sizeof(SingleNewline); enum { OPT_MAXLEN, OPT_WRAPCHAR }; static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL }; - (void)dummy; if (objc < 2 || objc % 2 != 0) { Tcl_WrongNumArgs(interp, 1, objv, @@ -2857,7 +2858,7 @@ BinaryEncodeUu( static int BinaryDecodeUu( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -2869,7 +2870,6 @@ BinaryDecodeUu( unsigned char c; enum { OPT_STRICT }; static const char *const optStrings[] = { "-strict", NULL }; - (void)dummy; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "?options? data"); @@ -3021,7 +3021,7 @@ BinaryDecodeUu( static int BinaryDecode64( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -3034,7 +3034,6 @@ BinaryDecode64( int i, index, size, cut = 0, count = 0; enum { OPT_STRICT }; static const char *const optStrings[] = { "-strict", NULL }; - (void)dummy; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "?options? data"); -- cgit v0.12 From 62a2883b434252f5cc7647055f762baf2ad11a1a Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 14:41:02 +0000 Subject: More TCL_UNUSED deployment. --- generic/tclCkalloc.c | 78 ++++++++++++++++------------------------------------ 1 file changed, 23 insertions(+), 55 deletions(-) diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 8746241..c1ff631 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -814,7 +814,7 @@ MemoryCmd( ClientData clientData, Tcl_Interp *interp, int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Obj values of arguments. */ + Tcl_Obj *const objv[]) /* Obj values of arguments. */ { const char *fileName; FILE *fileP; @@ -987,10 +987,10 @@ static int CheckmemCmd(ClientData clientData, static int CheckmemCmd( - ClientData clientData, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter for evaluation. */ int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Obj values of arguments. */ + Tcl_Obj *const objv[]) /* Obj values of arguments. */ { if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "fileName"); @@ -1052,9 +1052,7 @@ char * Tcl_Alloc( unsigned int size) { - char *result; - - result = TclpAlloc(size); + char *result = TclpAlloc(size); /* * Most systems will not alloc(0), instead bumping it to one so that NULL @@ -1078,9 +1076,7 @@ Tcl_DbCkalloc( const char *file, int line) { - char *result; - - result = (char *) TclpAlloc(size); + char *result = TclpAlloc(size); if ((result == NULL) && size) { fflush(stdout); @@ -1104,24 +1100,16 @@ char * Tcl_AttemptAlloc( unsigned int size) { - char *result; - - result = TclpAlloc(size); - return result; + return TclpAlloc(size); } char * Tcl_AttemptDbCkalloc( unsigned int size, - const char *file, - int line) + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) { - char *result; - (void)file; - (void)line; - - result = (char *) TclpAlloc(size); - return result; + return TclpAlloc(size); } /* @@ -1140,9 +1128,7 @@ Tcl_Realloc( char *ptr, unsigned int size) { - char *result; - - result = TclpRealloc(ptr, size); + char *result = TclpRealloc(ptr, size); if ((result == NULL) && size) { Tcl_Panic("unable to realloc %u bytes", size); @@ -1157,9 +1143,7 @@ Tcl_DbCkrealloc( const char *file, int line) { - char *result; - - result = (char *) TclpRealloc(ptr, size); + char *result = TclpRealloc(ptr, size); if ((result == NULL) && size) { fflush(stdout); @@ -1184,25 +1168,17 @@ Tcl_AttemptRealloc( char *ptr, unsigned int size) { - char *result; - - result = TclpRealloc(ptr, size); - return result; + return TclpRealloc(ptr, size); } char * Tcl_AttemptDbCkrealloc( char *ptr, unsigned int size, - const char *file, - int line) + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) { - char *result; - (void)file; - (void)line; - - result = (char *) TclpRealloc(ptr, size); - return result; + return TclpRealloc(ptr, size); } /* @@ -1227,11 +1203,9 @@ Tcl_Free( void Tcl_DbCkfree( char *ptr, - const char *file, - int line) + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) { - (void)file; - (void)line; TclpFree(ptr); } @@ -1248,35 +1222,29 @@ Tcl_DbCkfree( /* ARGSUSED */ void Tcl_InitMemory( - Tcl_Interp *interp) + TCL_UNUSED(Tcl_Interp *) /*interp*/) { - (void)interp; } int Tcl_DumpActiveMemory( - const char *fileName) + TCL_UNUSED(const char *) /*fileName*/) { - (void)fileName; return TCL_OK; } void Tcl_ValidateAllMemory( - const char *file, - int line) + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) { - (void)file; - (void)line; } int TclDumpMemoryInfo( - ClientData clientData, - int flags) + TCL_UNUSED(ClientData), + TCL_UNUSED(int) /*flags*/) { - (void)clientData; - (void)flags; return 1; } -- cgit v0.12 From c0a030fa0b8c99268c3610c1f8c62d457b086fcc Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 16:42:07 +0000 Subject: More TCL_UNUSED deployment --- generic/tclClock.c | 15 ++-- generic/tclCmdAH.c | 205 ++++++++++++++++++----------------------------------- 2 files changed, 73 insertions(+), 147 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 0aa1527..baaa568 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -1645,14 +1645,13 @@ WeekdayOnOrBefore( int ClockGetenvObjCmd( - ClientData clientData, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { const char *varName; const char *varValue; - (void)clientData; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1731,7 +1730,7 @@ ThreadSafeLocalTime( int ClockClicksObjCmd( - ClientData clientData, /* Client data is unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const *objv) /* Parameter values */ @@ -1745,7 +1744,6 @@ ClockClicksObjCmd( int index = CLICKS_NATIVE; Tcl_Time now; Tcl_WideInt clicks = 0; - (void)clientData; switch (objc) { case 1: @@ -1802,13 +1800,12 @@ ClockClicksObjCmd( int ClockMillisecondsObjCmd( - ClientData clientData, /* Client data is unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const *objv) /* Parameter values */ { Tcl_Time now; - (void)clientData; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -1840,12 +1837,11 @@ ClockMillisecondsObjCmd( int ClockMicrosecondsObjCmd( - ClientData clientData, /* Client data is unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const *objv) /* Parameter values */ { - (void)clientData; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; @@ -1992,13 +1988,12 @@ ClockParseformatargsObjCmd( int ClockSecondsObjCmd( - ClientData clientData, /* Client data is unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const *objv) /* Parameter values */ { Tcl_Time now; - (void)clientData; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index f2db757..bd65f04 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -45,21 +45,11 @@ struct ForeachState { static int CheckAccess(Tcl_Interp *interp, Tcl_Obj *pathPtr, int mode); -static int EncodingConvertfromObjCmd(ClientData dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int EncodingConverttoObjCmd(ClientData dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int EncodingDirsObjCmd(ClientData dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int EncodingNamesObjCmd(ClientData dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int EncodingSystemObjCmd(ClientData dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc EncodingConvertfromObjCmd; +static Tcl_ObjCmdProc EncodingConverttoObjCmd; +static Tcl_ObjCmdProc EncodingDirsObjCmd; +static Tcl_ObjCmdProc EncodingNamesObjCmd; +static Tcl_ObjCmdProc EncodingSystemObjCmd; static inline int ForeachAssignments(Tcl_Interp *interp, struct ForeachState *statePtr); static inline void ForeachCleanup(Tcl_Interp *interp, @@ -130,13 +120,11 @@ static Tcl_ObjCmdProc PathTypeCmd; /* ARGSUSED */ int Tcl_BreakObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; @@ -165,7 +153,7 @@ Tcl_BreakObjCmd( /* ARGSUSED */ int Tcl_CaseObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -175,7 +163,6 @@ Tcl_CaseObjCmd( const char *stringPtr, *arg; Tcl_Obj *const *caseObjv; Tcl_Obj *armPtr; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, @@ -302,17 +289,17 @@ Tcl_CaseObjCmd( /* ARGSUSED */ int Tcl_CatchObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRCatchObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRCatchObjCmd, clientData, objc, objv); } int TclNRCatchObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -320,7 +307,6 @@ TclNRCatchObjCmd( Tcl_Obj *varNamePtr = NULL; Tcl_Obj *optionVarNamePtr = NULL; Interp *iPtr = (Interp *) interp; - (void)dummy; if ((objc < 2) || (objc > 4)) { Tcl_WrongNumArgs(interp, 1, objv, @@ -409,14 +395,13 @@ CatchObjCmdCallback( /* ARGSUSED */ int Tcl_CdObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *dir; int result; - (void)dummy; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?dirName?"); @@ -466,13 +451,11 @@ Tcl_CdObjCmd( /* ARGSUSED */ int Tcl_ConcatObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - if (objc >= 2) { Tcl_SetObjResult(interp, Tcl_ConcatObj(objc-1, objv+1)); } @@ -503,13 +486,11 @@ Tcl_ConcatObjCmd( /* ARGSUSED */ int Tcl_ContinueObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; @@ -565,7 +546,7 @@ TclInitEncodingCmd( int EncodingConvertfromObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -575,7 +556,6 @@ EncodingConvertfromObjCmd( Tcl_Encoding encoding; /* Encoding to use */ int length; /* Length of the byte array being converted */ const char *bytesPtr; /* Pointer to the first byte of the array */ - (void)dummy; if (objc == 2) { encoding = Tcl_GetEncoding(interp, NULL); @@ -628,7 +608,7 @@ EncodingConvertfromObjCmd( int EncodingConverttoObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -638,7 +618,6 @@ EncodingConverttoObjCmd( Tcl_Encoding encoding; /* Encoding to use */ int length; /* Length of the string being converted */ const char *stringPtr; /* Pointer to the first byte of the string */ - (void)dummy; /* TODO - ADJUST OBJ INDICES WHEN ENSEMBLIFYING THIS */ @@ -693,13 +672,12 @@ EncodingConverttoObjCmd( int EncodingDirsObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *dirListObj; - (void)dummy; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?dirList?"); @@ -738,13 +716,11 @@ EncodingDirsObjCmd( int EncodingNamesObjCmd( - ClientData dummy, /* Not used. */ - Tcl_Interp* interp, /* Tcl interpreter */ - int objc, /* Number of command line args */ - Tcl_Obj* const objv[]) /* Vector of command line args */ + TCL_UNUSED(ClientData), + Tcl_Interp* interp, /* Tcl interpreter */ + int objc, /* Number of command line args */ + Tcl_Obj* const objv[]) /* Vector of command line args */ { - (void)dummy; - if (objc > 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; @@ -771,13 +747,11 @@ EncodingNamesObjCmd( int EncodingSystemObjCmd( - ClientData dummy, /* Not used. */ - Tcl_Interp* interp, /* Tcl interpreter */ - int objc, /* Number of command line args */ - Tcl_Obj* const objv[]) /* Vector of command line args */ + TCL_UNUSED(ClientData), + Tcl_Interp* interp, /* Tcl interpreter */ + int objc, /* Number of command line args */ + Tcl_Obj* const objv[]) /* Vector of command line args */ { - (void)dummy; - if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?encoding?"); return TCL_ERROR; @@ -811,13 +785,12 @@ EncodingSystemObjCmd( /* ARGSUSED */ int Tcl_ErrorObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *options, *optName; - (void)dummy; if ((objc < 2) || (objc > 4)) { Tcl_WrongNumArgs(interp, 1, objv, "message ?errorInfo? ?errorCode?"); @@ -862,12 +835,10 @@ Tcl_ErrorObjCmd( /* ARGSUSED */ static int EvalCmdErrMsg( - ClientData dummy[], + TCL_UNUSED(ClientData *), Tcl_Interp *interp, int result) { - (void)dummy; - if (result == TCL_ERROR) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (\"eval\" body line %d)", Tcl_GetErrorLine(interp))); @@ -877,17 +848,17 @@ EvalCmdErrMsg( int Tcl_EvalObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNREvalObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNREvalObjCmd, clientData, objc, objv); } int TclNREvalObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -896,7 +867,6 @@ TclNREvalObjCmd( Interp *iPtr = (Interp *) interp; CmdFrame *invoker = NULL; int word = 0; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "arg ?arg ...?"); @@ -948,13 +918,12 @@ TclNREvalObjCmd( /* ARGSUSED */ int Tcl_ExitObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_WideInt value; - (void)dummy; if ((objc != 1) && (objc != 2)) { Tcl_WrongNumArgs(interp, 1, objv, "?returnCode?"); @@ -998,23 +967,22 @@ Tcl_ExitObjCmd( /* ARGSUSED */ int Tcl_ExprObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRExprObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRExprObjCmd, clientData, objc, objv); } int TclNRExprObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *resultPtr, *objPtr; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "arg ?arg ...?"); @@ -1145,14 +1113,13 @@ TclInitFileCmd( static int FileAttrAccessTimeCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_StatBuf buf; struct utimbuf tval; - (void)dummy; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "name ?time?"); @@ -1228,14 +1195,13 @@ FileAttrAccessTimeCmd( static int FileAttrModifyTimeCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_StatBuf buf; struct utimbuf tval; - (void)dummy; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "name ?time?"); @@ -1308,13 +1274,12 @@ FileAttrModifyTimeCmd( static int FileAttrLinkStatCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_StatBuf buf; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "name varName"); @@ -1345,13 +1310,12 @@ FileAttrLinkStatCmd( static int FileAttrStatCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_StatBuf buf; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "name varName"); @@ -1382,13 +1346,12 @@ FileAttrStatCmd( static int FileAttrTypeCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_StatBuf buf; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1421,13 +1384,12 @@ FileAttrTypeCmd( static int FileAttrSizeCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_StatBuf buf; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1459,14 +1421,13 @@ FileAttrSizeCmd( static int FileAttrIsDirectoryCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_StatBuf buf; int value = 0; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1498,13 +1459,11 @@ FileAttrIsDirectoryCmd( static int FileAttrIsExecutableCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; - if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); return TCL_ERROR; @@ -1531,13 +1490,11 @@ FileAttrIsExecutableCmd( static int FileAttrIsExistingCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; - if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); return TCL_ERROR; @@ -1564,14 +1521,13 @@ FileAttrIsExistingCmd( static int FileAttrIsFileCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_StatBuf buf; int value = 0; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1603,7 +1559,7 @@ FileAttrIsFileCmd( static int FileAttrIsOwnedCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1615,7 +1571,6 @@ FileAttrIsOwnedCmd( Tcl_StatBuf buf; #endif int value = 0; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1651,13 +1606,11 @@ FileAttrIsOwnedCmd( static int FileAttrIsReadableCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; - if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); return TCL_ERROR; @@ -1684,13 +1637,11 @@ FileAttrIsReadableCmd( static int FileAttrIsWritableCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; - if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); return TCL_ERROR; @@ -1717,13 +1668,12 @@ FileAttrIsWritableCmd( static int PathDirNameCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *dirPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1757,13 +1707,12 @@ PathDirNameCmd( static int PathExtensionCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *dirPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1797,13 +1746,12 @@ PathExtensionCmd( static int PathRootNameCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *dirPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1837,13 +1785,12 @@ PathRootNameCmd( static int PathTailCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *dirPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1877,13 +1824,12 @@ PathTailCmd( static int PathFilesystemCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *fsInfo; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1919,13 +1865,11 @@ PathFilesystemCmd( static int PathJoinCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; - if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "name ?name ...?"); return TCL_ERROR; @@ -1953,13 +1897,12 @@ PathJoinCmd( static int PathNativeNameCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_DString ds; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1991,13 +1934,12 @@ PathNativeNameCmd( static int PathNormalizeCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *fileName; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -2030,13 +1972,12 @@ PathNormalizeCmd( static int PathSplitCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *res; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -2074,13 +2015,12 @@ PathSplitCmd( static int PathTypeCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *typeName; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -2123,13 +2063,11 @@ PathTypeCmd( static int FilesystemSeparatorCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; - if (objc < 1 || objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?name?"); return TCL_ERROR; @@ -2180,13 +2118,11 @@ FilesystemSeparatorCmd( static int FilesystemVolumesCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; - if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; @@ -2443,24 +2379,23 @@ GetTypeFromMode( /* ARGSUSED */ int Tcl_ForObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRForObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRForObjCmd, clientData, objc, objv); } int TclNRForObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Interp *iPtr = (Interp *) interp; ForIterData *iterPtr; - (void)dummy; if (objc != 5) { Tcl_WrongNumArgs(interp, 1, objv, "start test next command"); @@ -2639,44 +2574,41 @@ ForPostNextCallback( /* ARGSUSED */ int Tcl_ForeachObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRForeachCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRForeachCmd, clientData, objc, objv); } int TclNRForeachCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; - return EachloopCmd(interp, TCL_EACH_KEEP_NONE, objc, objv); } int Tcl_LmapObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRLmapCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRLmapCmd, clientData, objc, objv); } int TclNRLmapCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; return EachloopCmd(interp, TCL_EACH_COLLECT, objc, objv); } @@ -2960,13 +2892,12 @@ ForeachCleanup( /* ARGSUSED */ int Tcl_FormatObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *resultPtr; /* Where result is stored finally. */ - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "formatString ?arg ...?"); -- cgit v0.12 From e84e229fd592f843fc93e20306666034c740cee1 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 18:02:25 +0000 Subject: More TCL_UNUSED(). --- generic/tclCmdIL.c | 182 +++++++++++++-------------------------- generic/tclCmdMZ.c | 147 ++++++++++++-------------------- generic/tclCompCmds.c | 141 +++++++++--------------------- generic/tclCompCmdsGR.c | 144 ++++++++----------------------- generic/tclCompCmdsSZ.c | 222 +++++++++++++----------------------------------- generic/tclCompile.c | 17 ++-- 6 files changed, 254 insertions(+), 599 deletions(-) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 08948ea..f74368a 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -99,49 +99,28 @@ typedef struct { static int DictionaryCompare(const char *left, const char *right); static Tcl_NRPostProc IfConditionCallback; -static int InfoArgsCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoBodyCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoCmdCountCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoCommandsCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoCompleteCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoDefaultCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc InfoArgsCmd; +static Tcl_ObjCmdProc InfoBodyCmd; +static Tcl_ObjCmdProc InfoCmdCountCmd; +static Tcl_ObjCmdProc InfoCommandsCmd; +static Tcl_ObjCmdProc InfoCompleteCmd; +static Tcl_ObjCmdProc InfoDefaultCmd; /* TIP #348 - New 'info' subcommand 'errorstack' */ -static int InfoErrorStackCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc InfoErrorStackCmd; /* TIP #280 - New 'info' subcommand 'frame' */ -static int InfoFrameCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoFunctionsCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoHostnameCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoLevelCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoLibraryCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoLoadedCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoNameOfExecutableCmd(ClientData dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int InfoPatchLevelCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoProcsCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoScriptCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoSharedlibCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoCmdTypeCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int InfoTclVersionCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc InfoFrameCmd; +static Tcl_ObjCmdProc InfoFunctionsCmd; +static Tcl_ObjCmdProc InfoHostnameCmd; +static Tcl_ObjCmdProc InfoLevelCmd; +static Tcl_ObjCmdProc InfoLibraryCmd; +static Tcl_ObjCmdProc InfoLoadedCmd; +static Tcl_ObjCmdProc InfoNameOfExecutableCmd; +static Tcl_ObjCmdProc InfoPatchLevelCmd; +static Tcl_ObjCmdProc InfoProcsCmd; +static Tcl_ObjCmdProc InfoScriptCmd; +static Tcl_ObjCmdProc InfoSharedlibCmd; +static Tcl_ObjCmdProc InfoCmdTypeCmd; +static Tcl_ObjCmdProc InfoTclVersionCmd; static SortElement * MergeLists(SortElement *leftPtr, SortElement *rightPtr, SortInfo *infoPtr); static int SortCompare(SortElement *firstPtr, SortElement *second, @@ -206,23 +185,22 @@ static const EnsembleImplMap defaultInfoMap[] = { int Tcl_IfObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRIfObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRIfObjCmd, clientData, objc, objv); } int TclNRIfObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *boolObj; - (void)dummy; if (objc <= 1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -390,13 +368,12 @@ IfConditionCallback( int Tcl_IncrObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *newValuePtr, *incrPtr; - (void)dummy; if ((objc != 2) && (objc != 3)) { Tcl_WrongNumArgs(interp, 1, objv, "varName ?increment?"); @@ -472,7 +449,7 @@ TclInitInfoCmd( static int InfoArgsCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -482,7 +459,6 @@ InfoArgsCmd( Proc *procPtr; CompiledLocal *localPtr; Tcl_Obj *listObjPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "procname"); @@ -536,7 +512,7 @@ InfoArgsCmd( static int InfoBodyCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -545,7 +521,6 @@ InfoBodyCmd( const char *name, *bytes; Proc *procPtr; int numBytes; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "procname"); @@ -598,13 +573,12 @@ InfoBodyCmd( static int InfoCmdCountCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Interp *iPtr = (Interp *) interp; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -641,7 +615,7 @@ InfoCmdCountCmd( static int InfoCommandsCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -657,7 +631,6 @@ InfoCommandsCmd( int specificNsInPattern = 0;/* Init. to avoid compiler warning. */ Tcl_Command cmd; int i; - (void)dummy; /* * Get the pattern and find the "effective namespace" in which to list @@ -919,13 +892,11 @@ InfoCommandsCmd( static int InfoCompleteCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "command"); return TCL_ERROR; @@ -958,7 +929,7 @@ InfoCompleteCmd( static int InfoDefaultCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -968,7 +939,6 @@ InfoDefaultCmd( Proc *procPtr; CompiledLocal *localPtr; Tcl_Obj *valueObjPtr; - (void)dummy; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "procname arg varname"); @@ -1041,14 +1011,13 @@ InfoDefaultCmd( static int InfoErrorStackCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Interp *target; Interp *iPtr; - (void)dummy; if ((objc != 1) && (objc != 2)) { Tcl_WrongNumArgs(interp, 1, objv, "?interp?"); @@ -1091,14 +1060,13 @@ InfoErrorStackCmd( int TclInfoExistsCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *varName; Var *varPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "varName"); @@ -1137,7 +1105,7 @@ TclInfoExistsCmd( static int InfoFrameCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1147,7 +1115,6 @@ InfoFrameCmd( CmdFrame *framePtr, **cmdFramePtrPtr = &iPtr->cmdFramePtr; CoroutineData *corPtr = iPtr->execEnvPtr->corPtr; int topLevel = 0; - (void)dummy; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?number?"); @@ -1478,14 +1445,13 @@ TclInfoFrame( static int InfoFunctionsCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *script; int code; - (void)dummy; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?pattern?"); @@ -1544,13 +1510,12 @@ InfoFunctionsCmd( static int InfoHostnameCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *name; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -1591,13 +1556,12 @@ InfoHostnameCmd( static int InfoLevelCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Interp *iPtr = (Interp *) interp; - (void)dummy; if (objc == 1) { /* Just "info level" */ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(iPtr->varFramePtr->level)); @@ -1666,13 +1630,12 @@ InfoLevelCmd( static int InfoLibraryCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *libDirName; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -1714,13 +1677,12 @@ InfoLibraryCmd( static int InfoLoadedCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *interpName, *packageName; - (void)dummy; if (objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "?interp? ?packageName?"); @@ -1763,13 +1725,11 @@ InfoLoadedCmd( static int InfoNameOfExecutableCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; @@ -1801,13 +1761,12 @@ InfoNameOfExecutableCmd( static int InfoPatchLevelCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *patchlevel; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -1849,7 +1808,7 @@ InfoPatchLevelCmd( static int InfoProcsCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1866,7 +1825,6 @@ InfoProcsCmd( Tcl_HashEntry *entryPtr; Tcl_HashSearch search; Command *cmdPtr, *realCmdPtr; - (void)dummy; /* * Get the pattern and find the "effective namespace" in which to list @@ -2037,13 +1995,12 @@ InfoProcsCmd( static int InfoScriptCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Interp *iPtr = (Interp *) interp; - (void)dummy; if ((objc != 1) && (objc != 2)) { Tcl_WrongNumArgs(interp, 1, objv, "?filename?"); @@ -2086,13 +2043,11 @@ InfoScriptCmd( static int InfoSharedlibCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; @@ -2126,13 +2081,12 @@ InfoSharedlibCmd( static int InfoTclVersionCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *version; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -2170,13 +2124,12 @@ InfoTclVersionCmd( static int InfoCmdTypeCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Command command; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "commandName"); @@ -2222,14 +2175,13 @@ InfoCmdTypeCmd( int Tcl_JoinObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { int length, listLen; Tcl_Obj *resObjPtr = NULL, *joinObjPtr, **elemPtrs; - (void)dummy; if ((objc < 2) || (objc > 3)) { Tcl_WrongNumArgs(interp, 1, objv, "list ?joinString?"); @@ -2308,7 +2260,7 @@ Tcl_JoinObjCmd( int Tcl_LassignObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2317,7 +2269,6 @@ Tcl_LassignObjCmd( Tcl_Obj **listObjv; /* The contents of the list. */ int listObjc; /* The length of the list. */ int code = TCL_OK; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "list ?varName ...?"); @@ -2383,13 +2334,12 @@ Tcl_LassignObjCmd( int Tcl_LindexObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *elemPtr; /* Pointer to the element being extracted. */ - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "list ?index ...?"); @@ -2442,14 +2392,13 @@ Tcl_LindexObjCmd( int Tcl_LinsertObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *listPtr; int index, len, result; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "list index ?element ...?"); @@ -2525,13 +2474,12 @@ Tcl_LinsertObjCmd( int Tcl_ListObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { - (void)dummy; /* * If there are no list elements, the result is an empty object. * Otherwise set the interpreter's result object to be a list object. @@ -2562,14 +2510,13 @@ Tcl_ListObjCmd( int Tcl_LlengthObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int listLen, result; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "list"); @@ -2609,7 +2556,7 @@ Tcl_LlengthObjCmd( int Tcl_LpopObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) @@ -2618,7 +2565,6 @@ Tcl_LpopObjCmd( int listLen, result; Tcl_Obj *elemPtr, *stored; Tcl_Obj *listPtr, **elemPtrs; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "listvar ?index?"); @@ -2703,14 +2649,13 @@ Tcl_LpopObjCmd( int Tcl_LrangeObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int listLen, first, last, result; - (void)dummy; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "list first last"); @@ -2772,7 +2717,7 @@ LremoveIndexCompare( int Tcl_LremoveObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2780,7 +2725,6 @@ Tcl_LremoveObjCmd( int i, idxc; int listLen, *idxv, prevIdx, first, num; Tcl_Obj *listObj; - (void)dummy; /* * Parse the arguments. @@ -2892,7 +2836,7 @@ Tcl_LremoveObjCmd( int Tcl_LrepeatObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) @@ -2900,7 +2844,6 @@ Tcl_LrepeatObjCmd( { int elementCount, i, totalElems; Tcl_Obj *listPtr, **dataArray = NULL; - (void)dummy; /* * Check arguments for legality: @@ -3002,14 +2945,13 @@ Tcl_LrepeatObjCmd( int Tcl_LreplaceObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *listPtr; int first, last, listLen, numToDelete, result; - (void)dummy; if (objc < 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -3104,14 +3046,13 @@ Tcl_LreplaceObjCmd( int Tcl_LreverseObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { Tcl_Obj **elemv; int elemc, i, j; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "list"); @@ -3184,7 +3125,7 @@ Tcl_LreverseObjCmd( int Tcl_LsearchObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ @@ -3221,7 +3162,6 @@ Tcl_LsearchObjCmd( EXACT, GLOB, REGEXP, SORTED }; enum modes mode; - (void)dummy; mode = GLOB; dataType = ASCII; @@ -3937,14 +3877,13 @@ Tcl_LsearchObjCmd( int Tcl_LsetObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { Tcl_Obj *listPtr; /* Pointer to the list being altered. */ Tcl_Obj *finalValuePtr; /* Value finally assigned to the variable. */ - (void)dummy; /* * Check parameter count. @@ -4023,7 +3962,7 @@ Tcl_LsetObjCmd( int Tcl_LsortObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ @@ -4053,7 +3992,6 @@ Tcl_LsortObjCmd( LSORT_INCREASING, LSORT_INDEX, LSORT_INDICES, LSORT_INTEGER, LSORT_NOCASE, LSORT_REAL, LSORT_STRIDE, LSORT_UNIQUE }; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "?-option value ...? list"); diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 136eecb..2f5d399 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -82,13 +82,12 @@ const char tclDefaultTrimSet[] = int Tcl_PwdObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *retVal; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -123,7 +122,7 @@ Tcl_PwdObjCmd( int Tcl_RegexpObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -143,7 +142,6 @@ Tcl_RegexpObjCmd( REGEXP_EXPANDED,REGEXP_LINE, REGEXP_LINESTOP,REGEXP_LINEANCHOR, REGEXP_NOCASE, REGEXP_START, REGEXP_LAST }; - (void)dummy; indices = 0; about = 0; @@ -484,7 +482,7 @@ Tcl_RegexpObjCmd( int Tcl_RegsubObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -506,7 +504,6 @@ Tcl_RegsubObjCmd( REGSUB_LINESTOP, REGSUB_LINEANCHOR, REGSUB_NOCASE, REGSUB_START, REGSUB_LAST }; - (void)dummy; cflags = TCL_REG_ADVANCED; all = 0; @@ -1005,13 +1002,12 @@ Tcl_RegsubObjCmd( int Tcl_RenameObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *oldName, *newName; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "oldName newName"); @@ -1042,7 +1038,7 @@ Tcl_RenameObjCmd( int Tcl_ReturnObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1057,7 +1053,6 @@ Tcl_ReturnObjCmd( int explicitResult = (0 == (objc % 2)); int numOptionWords = objc - 1 - explicitResult; - (void)dummy; if (TCL_ERROR == TclMergeReturnOptions(interp, numOptionWords, objv+1, &returnOpts, &code, &level)) { @@ -1090,17 +1085,17 @@ Tcl_ReturnObjCmd( int Tcl_SourceObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRSourceObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRSourceObjCmd, clientData, objc, objv); } int TclNRSourceObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1110,7 +1105,6 @@ TclNRSourceObjCmd( int result; void **pkgFiles = NULL; void *names = NULL; - (void)dummy; if (objc < 2 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "?-encoding name? fileName"); @@ -1175,7 +1169,7 @@ TclNRSourceObjCmd( int Tcl_SplitObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1187,7 +1181,6 @@ Tcl_SplitObjCmd( const char *end; int splitCharLen, stringLen; Tcl_Obj *listPtr, *objPtr; - (void)dummy; if (objc == 2) { splitChars = " \n\t\r"; @@ -1324,13 +1317,12 @@ Tcl_SplitObjCmd( static int StringFirstCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int start = 0; - (void)dummy; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -1370,13 +1362,12 @@ StringFirstCmd( static int StringLastCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int last = INT_MAX - 1; - (void)dummy; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -1416,13 +1407,12 @@ StringLastCmd( static int StringIndexCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int length, index; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "string charIndex"); @@ -1487,7 +1477,7 @@ StringIndexCmd( static int StringInsertCmd( - ClientData dummy, /* Not used */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ @@ -1495,7 +1485,6 @@ StringInsertCmd( int length; /* String length */ int index; /* Insert index */ Tcl_Obj *outObj; /* Output object */ - (void)dummy; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "string index insertString"); @@ -1545,7 +1534,7 @@ StringInsertCmd( static int StringIsCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1579,7 +1568,6 @@ StringIsCmd( enum isOptions { OPT_STRICT, OPT_FAILIDX }; - (void)dummy; if (objc < 3 || objc > 6) { Tcl_WrongNumArgs(interp, 1, objv, @@ -1985,7 +1973,7 @@ UniCharIsHexDigit( static int StringMapCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1995,7 +1983,6 @@ StringMapCmd( Tcl_Obj **mapElemv, *sourceObj, *resultPtr; Tcl_UniChar *ustring1, *ustring2, *p, *end; int (*strCmpFn)(const Tcl_UniChar*, const Tcl_UniChar*, unsigned long); - (void)dummy; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "?-nocase? charMap string"); @@ -2257,13 +2244,12 @@ StringMapCmd( static int StringMatchCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int nocase = 0; - (void)dummy; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "?-nocase? pattern string"); @@ -2310,13 +2296,12 @@ StringMatchCmd( static int StringRangeCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int length, first, last; - (void)dummy; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "string first last"); @@ -2367,14 +2352,13 @@ StringRangeCmd( static int StringReptCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int count; Tcl_Obj *resultPtr; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "string count"); @@ -2424,13 +2408,12 @@ StringReptCmd( static int StringRplcCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int first, last, length, end; - (void)dummy; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 1, objv, "string first last ?string?"); @@ -2501,13 +2484,11 @@ StringRplcCmd( static int StringRevCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "string"); return TCL_ERROR; @@ -2538,7 +2519,7 @@ StringRevCmd( static int StringStartCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2546,7 +2527,6 @@ StringStartCmd( Tcl_UniChar ch = 0; const char *p, *string; int cur, index, length, numChars; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "string index"); @@ -2600,7 +2580,7 @@ StringStartCmd( static int StringEndCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2608,7 +2588,6 @@ StringEndCmd( Tcl_UniChar ch = 0; const char *p, *end, *string; int cur, index, length, numChars; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "string index"); @@ -2663,7 +2642,7 @@ StringEndCmd( static int StringEqualCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2676,7 +2655,6 @@ StringEqualCmd( const char *string2; int length, i, match, nocase = 0, reqlength = -1; - (void)dummy; if (objc < 3 || objc > 6) { str_cmp_args: @@ -2739,7 +2717,7 @@ StringEqualCmd( static int StringCmpCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2751,7 +2729,6 @@ StringCmpCmd( */ int match, nocase, reqlength, status; - (void)dummy; status = TclStringCmpOpts(interp, objc, objv, &nocase, &reqlength); if (status != TCL_OK) { @@ -2828,13 +2805,12 @@ TclStringCmpOpts( static int StringCatCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *objResultPtr; - (void)dummy; if (objc < 2) { /* @@ -2874,13 +2850,12 @@ StringCatCmd( */ static int StringBytesCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int length; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "string"); @@ -2912,13 +2887,11 @@ StringBytesCmd( static int StringLenCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "string"); return TCL_ERROR; @@ -2948,7 +2921,7 @@ StringLenCmd( static int StringLowerCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2956,7 +2929,6 @@ StringLowerCmd( int length1, length2; const char *string1; char *string2; - (void)dummy; if (objc < 2 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "string ?first? ?last?"); @@ -3034,7 +3006,7 @@ StringLowerCmd( static int StringUpperCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3042,7 +3014,6 @@ StringUpperCmd( int length1, length2; const char *string1; char *string2; - (void)dummy; if (objc < 2 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "string ?first? ?last?"); @@ -3120,7 +3091,7 @@ StringUpperCmd( static int StringTitleCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3128,7 +3099,6 @@ StringTitleCmd( int length1, length2; const char *string1; char *string2; - (void)dummy; if (objc < 2 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "string ?first? ?last?"); @@ -3206,14 +3176,13 @@ StringTitleCmd( static int StringTrimCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *string1, *string2; int triml, trimr, length1, length2; - (void)dummy; if (objc == 3) { string2 = TclGetStringFromObj(objv[2], &length2); @@ -3254,14 +3223,13 @@ StringTrimCmd( static int StringTrimLCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *string1, *string2; int trim, length1, length2; - (void)dummy; if (objc == 3) { string2 = TclGetStringFromObj(objv[2], &length2); @@ -3301,14 +3269,13 @@ StringTrimLCmd( static int StringTrimRCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *string1, *string2; int trim, length1, length2; - (void)dummy; if (objc == 3) { string2 = TclGetStringFromObj(objv[2], &length2); @@ -3445,23 +3412,22 @@ TclSubstOptions( int Tcl_SubstObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRSubstObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRSubstObjCmd, clientData, objc, objv); } int TclNRSubstObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int flags; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, @@ -3494,16 +3460,16 @@ TclNRSubstObjCmd( int Tcl_SwitchObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRSwitchObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRSwitchObjCmd, clientData, objc, objv); } int TclNRSwitchObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3536,7 +3502,6 @@ TclNRSwitchObjCmd( }; typedef int (*strCmpFn_t)(const char *, const char *); strCmpFn_t strCmpFn = TclUtfCmp; - (void)dummy; mode = OPT_EXACT; foundmode = 0; @@ -4028,14 +3993,13 @@ SwitchPostProc( /* ARGSUSED */ int Tcl_ThrowObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *options; int len; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "type message"); @@ -4091,7 +4055,7 @@ Tcl_ThrowObjCmd( int Tcl_TimeObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -4106,7 +4070,6 @@ Tcl_TimeObjCmd( #else Tcl_WideInt start, stop; #endif - (void)dummy; if (objc == 2) { count = 1; @@ -4190,7 +4153,7 @@ Tcl_TimeObjCmd( int Tcl_TimeRateObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -4225,7 +4188,6 @@ Tcl_TimeRateObjCmd( }; NRE_callback *rootPtr; ByteCode *codePtr = NULL; - (void)dummy; for (i = 1; i < objc - 1; i++) { int index; @@ -4734,17 +4696,17 @@ Tcl_TimeRateObjCmd( int Tcl_TryObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRTryObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRTryObjCmd, clientData, objc, objv); } int TclNRTryObjCmd( - ClientData clientData, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -4757,7 +4719,6 @@ TclNRTryObjCmd( enum Handlers { TryFinally, TryOn, TryTrap }; - (void)clientData; /* * Parse the arguments. The handlers are passed to subsequent callbacks as @@ -4948,7 +4909,7 @@ TryPostBody( int result) { Tcl_Obj *resultObj, *options, *handlersObj, *finallyObj, *cmdObj, **objv; - int i, dummy, code, objc; + int i, code, objc; int numHandlers = 0; handlersObj = (Tcl_Obj *)data[0]; @@ -4999,8 +4960,9 @@ TryPostBody( Tcl_ListObjGetElements(NULL, handlersObj, &numHandlers, &handlers); for (i=0 ; i 0) { + Tcl_ListObjLength(NULL, info[3], &numElems); + if (numElems> 0) { Tcl_Obj *varName; Tcl_ListObjIndex(NULL, info[3], 0, &varName); @@ -5073,7 +5035,7 @@ TryPostBody( goto handlerFailed; } Tcl_DecrRefCount(resultObj); - if (dummy > 1) { + if (numElems> 1) { Tcl_ListObjIndex(NULL, info[3], 1, &varName); if (Tcl_ObjSetVar2(interp, varName, NULL, options, TCL_LEAVE_ERR_MSG) == NULL) { @@ -5311,23 +5273,22 @@ TryPostFinal( int Tcl_WhileObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRWhileObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRWhileObjCmd, clientData, objc, objv); } int TclNRWhileObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { ForIterData *iterPtr; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "test command"); diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 35501d2..e38be07 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -21,28 +21,16 @@ * Prototypes for procedures defined later in this file: */ -static ClientData DupDictUpdateInfo(ClientData clientData); -static void FreeDictUpdateInfo(ClientData clientData); -static void PrintDictUpdateInfo(ClientData clientData, - Tcl_Obj *appendObj, ByteCode *codePtr, - unsigned int pcOffset); -static void DisassembleDictUpdateInfo(ClientData clientData, - Tcl_Obj *dictObj, ByteCode *codePtr, - unsigned int pcOffset); -static ClientData DupForeachInfo(ClientData clientData); -static void FreeForeachInfo(ClientData clientData); -static void PrintForeachInfo(ClientData clientData, - Tcl_Obj *appendObj, ByteCode *codePtr, - unsigned int pcOffset); -static void DisassembleForeachInfo(ClientData clientData, - Tcl_Obj *dictObj, ByteCode *codePtr, - unsigned int pcOffset); -static void PrintNewForeachInfo(ClientData clientData, - Tcl_Obj *appendObj, ByteCode *codePtr, - unsigned int pcOffset); -static void DisassembleNewForeachInfo(ClientData clientData, - Tcl_Obj *dictObj, ByteCode *codePtr, - unsigned int pcOffset); +static AuxDataDupProc DupDictUpdateInfo; +static AuxDataFreeProc FreeDictUpdateInfo; +static AuxDataPrintProc PrintDictUpdateInfo; +static AuxDataPrintProc DisassembleDictUpdateInfo; +static AuxDataDupProc DupForeachInfo; +static AuxDataFreeProc FreeForeachInfo; +static AuxDataPrintProc PrintForeachInfo; +static AuxDataPrintProc DisassembleForeachInfo; +static AuxDataPrintProc PrintNewForeachInfo; +static AuxDataPrintProc DisassembleNewForeachInfo; static int CompileEachloopCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, Command *cmdPtr, CompileEnv *envPtr, int collect); @@ -260,14 +248,12 @@ TclCompileArrayExistsCmd( Tcl_Interp *interp, /* Used for looking up stuff. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; int isScalar, localIndex; - (void)cmdPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -523,17 +509,14 @@ TclCompileArrayUnsetCmd( int TclCompileBreakCmd( - Tcl_Interp *dummy, /* Used for error reporting. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { ExceptionRange *rangePtr; ExceptionAux *auxPtr; - (void)dummy; - (void)cmdPtr; if (parsePtr->numWords != 1) { return TCL_ERROR; @@ -586,8 +569,7 @@ TclCompileCatchCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { JumpFixup jumpFixup; @@ -595,7 +577,6 @@ TclCompileCatchCmd( int resultIndex, optsIndex, range, dropScript = 0; DefineLineInformation; /* TIP #280 */ int depth = TclGetStackDepth(envPtr); - (void)cmdPtr; /* * If syntax does not match what we expect for [catch], do not compile. @@ -769,16 +750,13 @@ TclCompileCatchCmd( int TclCompileClockClicksCmd( - Tcl_Interp* dummy, /* Tcl interpreter */ + TCL_UNUSED(Tcl_Interp *), Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token* tokenPtr; - (void)dummy; - (void)cmdPtr; switch (parsePtr->numWords) { case 1: @@ -835,15 +813,13 @@ TclCompileClockClicksCmd( int TclCompileClockReadingCmd( - Tcl_Interp* dummy, /* Tcl interpreter */ + TCL_UNUSED(Tcl_Interp *), Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ Command *cmdPtr, /* Points to defintion of command being * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - (void)dummy; - if (parsePtr->numWords != 1) { return TCL_ERROR; } @@ -876,15 +852,13 @@ TclCompileConcatCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Obj *objPtr, *listObj; Tcl_Token *tokenPtr; int i; - (void)cmdPtr; /* TODO: Consider compiling expansion case. */ if (parsePtr->numWords == 1) { @@ -961,17 +935,14 @@ TclCompileConcatCmd( int TclCompileContinueCmd( - Tcl_Interp *dummy, /* Used for error reporting. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { ExceptionRange *rangePtr; ExceptionAux *auxPtr; - (void)dummy; - (void)cmdPtr; /* * There should be no argument after the "continue". @@ -1029,15 +1000,13 @@ TclCompileDictSetCmd( Tcl_Interp *interp, /* Used for looking up stuff. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; int i, dictVarIndex; DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; - (void)cmdPtr; /* * There must be at least one argument after the command. @@ -1156,14 +1125,12 @@ TclCompileDictGetCmd( Tcl_Interp *interp, /* Used for looking up stuff. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; int i; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; /* * There must be at least two arguments after the command (the single-arg @@ -1194,14 +1161,12 @@ TclCompileDictGetWithDefaultCmd( Tcl_Interp *interp, /* Used for looking up stuff. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; int i; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; /* * There must be at least three arguments after the command. @@ -1227,14 +1192,12 @@ TclCompileDictExistsCmd( Tcl_Interp *interp, /* Used for looking up stuff. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; int i; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; /* * There must be at least two arguments after the command (the single-arg @@ -2325,13 +2288,11 @@ static void PrintDictUpdateInfo( ClientData clientData, Tcl_Obj *appendObj, - ByteCode *codePtr, - unsigned int pcOffset) + TCL_UNUSED(ByteCode *), + TCL_UNUSED(unsigned int)) { DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData; int i; - (void)codePtr; - (void)pcOffset; for (i=0 ; ilength ; i++) { if (i) { @@ -2345,14 +2306,12 @@ static void DisassembleDictUpdateInfo( ClientData clientData, Tcl_Obj *dictObj, - ByteCode *codePtr, - unsigned int pcOffset) + TCL_UNUSED(ByteCode *), + TCL_UNUSED(unsigned int)) { DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData; int i; Tcl_Obj *variables = Tcl_NewObj(); - (void)codePtr; - (void)pcOffset; for (i=0 ; ilength ; i++) { Tcl_ListObjAppendElement(NULL, variables, @@ -2385,8 +2344,7 @@ TclCompileErrorCmd( Tcl_Interp *interp, /* Used for context. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { /* @@ -2395,7 +2353,6 @@ TclCompileErrorCmd( Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; if (parsePtr->numWords < 2 || parsePtr->numWords > 4) { return TCL_ERROR; @@ -2460,12 +2417,10 @@ TclCompileExprCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *firstWordPtr; - (void)cmdPtr; if (parsePtr->numWords == 1) { return TCL_ERROR; @@ -2506,8 +2461,7 @@ TclCompileForCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *startTokenPtr, *testTokenPtr, *nextTokenPtr, *bodyTokenPtr; @@ -2515,7 +2469,6 @@ TclCompileForCmd( int bodyCodeOffset, nextCodeOffset, jumpDist; int bodyRange, nextRange; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; if (parsePtr->numWords != 5) { return TCL_ERROR; @@ -2718,8 +2671,7 @@ CompileEachloopCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr, /* Holds resulting instructions. */ int collect) /* Select collecting or accumulating mode * (TCL_EACH_*) */ @@ -2734,7 +2686,6 @@ CompileEachloopCmd( int numWords, numLists, i, j, code = TCL_OK; Tcl_Obj *varListObj = NULL; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; /* * If the foreach command isn't in a procedure, don't compile it inline: @@ -3017,14 +2968,12 @@ static void PrintForeachInfo( ClientData clientData, Tcl_Obj *appendObj, - ByteCode *codePtr, - unsigned int pcOffset) + TCL_UNUSED(ByteCode *), + TCL_UNUSED(unsigned int)) { ForeachInfo *infoPtr = (ForeachInfo *)clientData; ForeachVarList *varsPtr; int i, j; - (void)codePtr; - (void)pcOffset; Tcl_AppendToObj(appendObj, "data=[", -1); @@ -3059,14 +3008,12 @@ static void PrintNewForeachInfo( ClientData clientData, Tcl_Obj *appendObj, - ByteCode *codePtr, - unsigned int pcOffset) + TCL_UNUSED(ByteCode *), + TCL_UNUSED(unsigned int)) { ForeachInfo *infoPtr = (ForeachInfo *)clientData; ForeachVarList *varsPtr; int i, j; - (void)codePtr; - (void)pcOffset; Tcl_AppendPrintfToObj(appendObj, "jumpOffset=%+d, vars=", infoPtr->loopCtTemp); @@ -3091,15 +3038,13 @@ static void DisassembleForeachInfo( ClientData clientData, Tcl_Obj *dictObj, - ByteCode *codePtr, - unsigned int pcOffset) + TCL_UNUSED(ByteCode *), + TCL_UNUSED(unsigned int)) { ForeachInfo *infoPtr = (ForeachInfo *)clientData; ForeachVarList *varsPtr; int i, j; Tcl_Obj *objPtr, *innerPtr; - (void)codePtr; - (void)pcOffset; /* * Data stores. @@ -3140,15 +3085,13 @@ static void DisassembleNewForeachInfo( ClientData clientData, Tcl_Obj *dictObj, - ByteCode *codePtr, - unsigned int pcOffset) + TCL_UNUSED(ByteCode *), + TCL_UNUSED(unsigned int)) { ForeachInfo *infoPtr = (ForeachInfo *)clientData; ForeachVarList *varsPtr; int i, j; Tcl_Obj *objPtr, *innerPtr; - (void)codePtr; - (void)pcOffset; /* * Jump offset. @@ -3198,8 +3141,7 @@ TclCompileFormatCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ @@ -3207,7 +3149,6 @@ TclCompileFormatCmd( Tcl_Obj **objv, *formatObj, *tmpObj; const char *bytes, *start; int i, j, len; - (void)cmdPtr; /* * Don't handle any guaranteed-error cases. diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 513aa7d..59eebae 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -86,14 +86,12 @@ TclCompileGlobalCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr; int localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; /* TODO: Consider support for compiling expanded args. */ numWords = parsePtr->numWords; @@ -169,8 +167,7 @@ TclCompileIfCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { JumpFixupArray jumpFalseFixupArray; @@ -189,7 +186,6 @@ TclCompileIfCmd( int boolVal; /* Value of static condition. */ int compileScripts = 1; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; /* * Only compile the "if" command if all arguments are simple words, in @@ -473,14 +469,12 @@ TclCompileIncrCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr, *incrTokenPtr; int isScalar, localIndex, haveImmValue, immValue; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; if ((parsePtr->numWords != 2) && (parsePtr->numWords != 3)) { return TCL_ERROR; @@ -643,15 +637,12 @@ TclCompileInfoCommandsCmd( int TclCompileInfoCoroutineCmd( - Tcl_Interp *dummy, /* Used for error reporting. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - (void)dummy; - (void)cmdPtr; /* * Only compile [info coroutine] without arguments. */ @@ -673,14 +664,12 @@ TclCompileInfoExistsCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; int isScalar, localIndex; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -723,11 +712,9 @@ TclCompileInfoLevelCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - (void)cmdPtr; /* * Only compile [info level] without arguments or with a single argument. */ @@ -759,13 +746,11 @@ TclCompileInfoObjectClassCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); - (void)cmdPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -780,13 +765,11 @@ TclCompileInfoObjectIsACmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); - (void)cmdPtr; /* * We only handle [info object isa object ]. The first three @@ -817,13 +800,11 @@ TclCompileInfoObjectNamespaceCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); - (void)cmdPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -856,14 +837,12 @@ TclCompileLappendCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr, *valueTokenPtr; int isScalar, localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; /* TODO: Consider support for compiling expanded args. */ numWords = parsePtr->numWords; @@ -973,14 +952,12 @@ TclCompileLassignCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; int isScalar, localIndex, numWords, idx; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; numWords = parsePtr->numWords; @@ -1078,14 +1055,12 @@ TclCompileLindexCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *idxTokenPtr, *valTokenPtr; int i, idx, numWords = parsePtr->numWords; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; /* * Quit if too few args. @@ -1170,15 +1145,13 @@ TclCompileListCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *valueTokenPtr; int i, numWords, concat, build; Tcl_Obj *listObj, *objPtr; - (void)cmdPtr; if (parsePtr->numWords == 1) { /* @@ -1285,13 +1258,11 @@ TclCompileLlengthCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -1319,14 +1290,12 @@ TclCompileLrangeCmd( Tcl_Interp *interp, /* Tcl interpreter for context. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the * command. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { Tcl_Token *tokenPtr, *listTokenPtr; DefineLineInformation; /* TIP #280 */ int idx1, idx2; - (void)cmdPtr; if (parsePtr->numWords != 4) { return TCL_ERROR; @@ -1381,14 +1350,12 @@ TclCompileLinsertCmd( Tcl_Interp *interp, /* Tcl interpreter for context. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the * command. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { Tcl_Token *tokenPtr, *listTokenPtr; DefineLineInformation; /* TIP #280 */ int idx, i; - (void)cmdPtr; if (parsePtr->numWords < 3) { return TCL_ERROR; @@ -1485,15 +1452,13 @@ TclCompileLreplaceCmd( Tcl_Interp *interp, /* Tcl interpreter for context. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the * command. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { Tcl_Token *tokenPtr, *listTokenPtr; DefineLineInformation; /* TIP #280 */ int idx1, idx2, i; int emptyPrefix=1, suffixStart = 0; - (void)cmdPtr; if (parsePtr->numWords < 4) { return TCL_ERROR; @@ -1650,8 +1615,7 @@ TclCompileLsetCmd( Tcl_Interp *interp, /* Tcl interpreter for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the * command. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { int tempDepth; /* Depth used for emitting one part of the @@ -1662,7 +1626,6 @@ TclCompileLsetCmd( int isScalar; /* Flag == 1 if scalar, 0 if array. */ int i; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; /* * Check argument count. @@ -1795,15 +1758,12 @@ TclCompileLsetCmd( int TclCompileNamespaceCurrentCmd( - Tcl_Interp *dummy, /* Used for error reporting. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - (void)dummy; - (void)cmdPtr; /* * Only compile [namespace current] without arguments. */ @@ -1825,13 +1785,11 @@ TclCompileNamespaceCodeCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -1876,13 +1834,11 @@ TclCompileNamespaceOriginCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -1899,14 +1855,12 @@ TclCompileNamespaceQualifiersCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); DefineLineInformation; /* TIP #280 */ int off; - (void)cmdPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -1936,14 +1890,12 @@ TclCompileNamespaceTailCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); DefineLineInformation; /* TIP #280 */ JumpFixup jumpFixup; - (void)cmdPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -1974,14 +1926,12 @@ TclCompileNamespaceUpvarCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; int localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; if (envPtr->procPtr == NULL) { return TCL_ERROR; @@ -2036,14 +1986,12 @@ TclCompileNamespaceWhichCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr, *opt; int idx; - (void)cmdPtr; if (parsePtr->numWords < 2 || parsePtr->numWords > 3) { return TCL_ERROR; @@ -2101,8 +2049,7 @@ TclCompileRegexpCmd( Tcl_Interp *interp, /* Tcl interpreter for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the * command. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the @@ -2110,7 +2057,6 @@ TclCompileRegexpCmd( int i, len, nocase, exact, sawLast, simple; const char *str; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; /* * We are only interested in compiling simple regexp cases. Currently @@ -2267,8 +2213,7 @@ TclCompileRegsubCmd( Tcl_Interp *interp, /* Tcl interpreter for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the * command. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { /* @@ -2297,7 +2242,6 @@ TclCompileRegsubCmd( Tcl_DString pattern; const char *bytes; int len, exact, quantified, result = TCL_ERROR; - (void)cmdPtr; if (parsePtr->numWords < 5 || parsePtr->numWords > 6) { return TCL_ERROR; @@ -2443,8 +2387,7 @@ TclCompileReturnCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { /* @@ -2458,7 +2401,6 @@ TclCompileReturnCmd( Tcl_Obj *returnOpts, **objv; Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr); DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; /* * Check for special case which can always be compiled: @@ -2696,15 +2638,13 @@ TclCompileUpvarCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; int localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ Tcl_Obj *objPtr; - (void)cmdPtr; if (envPtr->procPtr == NULL) { return TCL_ERROR; @@ -2804,14 +2744,12 @@ TclCompileVariableCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr, *valueTokenPtr; int localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; numWords = parsePtr->numWords; if (numWords < 2) { @@ -2887,7 +2825,7 @@ TclCompileVariableCmd( static int IndexTailVarIfKnown( - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), Tcl_Token *varTokenPtr, /* Token representing the variable name */ CompileEnv *envPtr) /* Holds resulting instructions. */ { @@ -2896,7 +2834,6 @@ IndexTailVarIfKnown( int len, n = varTokenPtr->numComponents; Tcl_Token *lastTokenPtr; int full, localIndex; - (void)dummy; /* * Determine if the tail is (a) known at compile time, and (b) not an @@ -2980,14 +2917,12 @@ TclCompileObjectNextCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = parsePtr->tokenPtr; int i; - (void)cmdPtr; if (parsePtr->numWords > 255) { return TCL_ERROR; @@ -3006,14 +2941,12 @@ TclCompileObjectNextToCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = parsePtr->tokenPtr; int i; - (void)cmdPtr; if (parsePtr->numWords < 2 || parsePtr->numWords > 255) { return TCL_ERROR; @@ -3029,15 +2962,12 @@ TclCompileObjectNextToCmd( int TclCompileObjectSelfCmd( - Tcl_Interp *dummy, /* Used for error reporting. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - (void)dummy; - (void)cmdPtr; /* * We only handle [self] and [self object] (which is the same operation). * These are the only very common operations on [self] for which diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index ac8ca48..34f0fab 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -23,14 +23,10 @@ * Prototypes for procedures defined later in this file: */ -static ClientData DupJumptableInfo(ClientData clientData); -static void FreeJumptableInfo(ClientData clientData); -static void PrintJumptableInfo(ClientData clientData, - Tcl_Obj *appendObj, ByteCode *codePtr, - unsigned int pcOffset); -static void DisassembleJumptableInfo(ClientData clientData, - Tcl_Obj *dictObj, ByteCode *codePtr, - unsigned int pcOffset); +static AuxDataDupProc DupJumptableInfo; +static AuxDataFreeProc FreeJumptableInfo; +static AuxDataPrintProc PrintJumptableInfo; +static AuxDataPrintProc DisassembleJumptableInfo; static int CompileAssociativeBinaryOpCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, const char *identity, int instruction, CompileEnv *envPtr); @@ -130,14 +126,12 @@ TclCompileSetCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr, *valueTokenPtr; int isAssignment, isScalar, localIndex, numWords; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; numWords = parsePtr->numWords; if ((numWords != 2) && (numWords != 3)) { @@ -225,15 +219,13 @@ TclCompileStringCatCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { int i, numWords = parsePtr->numWords, numArgs; Tcl_Token *wordTokenPtr; Tcl_Obj *obj, *folded; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; /* Trivial case, no arg */ @@ -298,13 +290,11 @@ TclCompileStringCmpCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - (void)cmdPtr; /* * We don't support any flags; the bytecode isn't that sophisticated. @@ -331,13 +321,11 @@ TclCompileStringEqualCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - (void)cmdPtr; /* * We don't support any flags; the bytecode isn't that sophisticated. @@ -364,13 +352,11 @@ TclCompileStringFirstCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - (void)cmdPtr; /* * We don't support any flags; the bytecode isn't that sophisticated. @@ -397,13 +383,11 @@ TclCompileStringLastCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - (void)cmdPtr; /* * We don't support any flags; the bytecode isn't that sophisticated. @@ -430,13 +414,11 @@ TclCompileStringIndexCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - (void)cmdPtr; if (parsePtr->numWords != 3) { return TCL_ERROR; @@ -459,14 +441,12 @@ TclCompileStringInsertCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ int idx; - (void)cmdPtr; if (parsePtr->numWords != 4) { return TCL_ERROR; @@ -886,14 +866,12 @@ TclCompileStringLenCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; Tcl_Obj *objPtr; - (void)cmdPtr; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -990,14 +968,12 @@ TclCompileStringRangeCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *stringTokenPtr, *fromTokenPtr, *toTokenPtr; int idx1, idx2; - (void)cmdPtr; if (parsePtr->numWords != 4) { return TCL_ERROR; @@ -1067,14 +1043,12 @@ TclCompileStringReplaceCmd( Tcl_Interp *interp, /* Tcl interpreter for context. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the * command. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds the resulting instructions. */ { Tcl_Token *tokenPtr, *valueTokenPtr; DefineLineInformation; /* TIP #280 */ int first, last; - (void)cmdPtr; if (parsePtr->numWords < 4 || parsePtr->numWords > 5) { return TCL_ERROR; @@ -1267,13 +1241,11 @@ TclCompileStringTrimLCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - (void)cmdPtr; if (parsePtr->numWords != 2 && parsePtr->numWords != 3) { return TCL_ERROR; @@ -1296,13 +1268,11 @@ TclCompileStringTrimRCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - (void)cmdPtr; if (parsePtr->numWords != 2 && parsePtr->numWords != 3) { return TCL_ERROR; @@ -1325,13 +1295,11 @@ TclCompileStringTrimCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - (void)cmdPtr; if (parsePtr->numWords != 2 && parsePtr->numWords != 3) { return TCL_ERROR; @@ -1475,8 +1443,7 @@ TclCompileSubstCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { int numArgs = parsePtr->numWords - 1; @@ -1486,7 +1453,6 @@ TclCompileSubstCmd( Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr); int code = TCL_ERROR; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; if (numArgs == 0) { return TCL_ERROR; @@ -1809,8 +1775,7 @@ TclCompileSwitchCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; /* Pointer to tokens in command. */ @@ -1831,7 +1796,6 @@ TclCompileSwitchCmd( int result = TCL_ERROR; DefineLineInformation; /* TIP #280 */ int *clNext = envPtr->clNext; - (void)cmdPtr; /* * Only handle the following versions: @@ -2613,7 +2577,7 @@ static void PrintJumptableInfo( ClientData clientData, Tcl_Obj *appendObj, - ByteCode *codePtr, + TCL_UNUSED(ByteCode *), unsigned int pcOffset) { JumptableInfo *jtPtr = (JumptableInfo *)clientData; @@ -2621,7 +2585,6 @@ 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)) { @@ -2643,8 +2606,8 @@ static void DisassembleJumptableInfo( ClientData clientData, Tcl_Obj *dictObj, - ByteCode *codePtr, - unsigned int pcOffset) + TCL_UNUSED(ByteCode *), + TCL_UNUSED(unsigned int)) { JumptableInfo *jtPtr = (JumptableInfo *)clientData; Tcl_Obj *mapping = Tcl_NewObj(); @@ -2652,8 +2615,6 @@ 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)) { @@ -2688,14 +2649,12 @@ TclCompileTailcallCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = parsePtr->tokenPtr; int i; - (void)cmdPtr; if (parsePtr->numWords < 2 || parsePtr->numWords > 256 || envPtr->procPtr == NULL) { @@ -2736,8 +2695,7 @@ TclCompileThrowCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ @@ -2745,7 +2703,6 @@ TclCompileThrowCmd( Tcl_Token *codeToken, *msgToken; Tcl_Obj *objPtr; int codeKnown, codeIsList, codeIsValid, len; - (void)cmdPtr; if (numWords != 3) { return TCL_ERROR; @@ -2841,8 +2798,7 @@ TclCompileTryCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { int numWords = parsePtr->numWords, numHandlers, result = TCL_ERROR; @@ -2851,7 +2807,6 @@ TclCompileTryCmd( Tcl_Obj **matchClauses = NULL; int *matchCodes=NULL, *resultVarIndices=NULL, *optionVarIndices=NULL; int i; - (void)cmdPtr; if (numWords < 2) { return TCL_ERROR; @@ -3652,14 +3607,12 @@ TclCompileUnsetCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { 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. */ @@ -3791,8 +3744,7 @@ TclCompileWhileCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *testTokenPtr, *bodyTokenPtr; @@ -3802,7 +3754,6 @@ TclCompileWhileCmd( * infinite loop. */ Tcl_Obj *boolObj; DefineLineInformation; /* TIP #280 */ - (void)cmdPtr; if (parsePtr->numWords != 3) { return TCL_ERROR; @@ -3970,12 +3921,9 @@ TclCompileYieldCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { - (void)cmdPtr; - if (parsePtr->numWords < 1 || parsePtr->numWords > 2) { return TCL_ERROR; } @@ -4015,14 +3963,12 @@ TclCompileYieldToCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); int i; - (void)cmdPtr; if (parsePtr->numWords < 2) { return TCL_ERROR; @@ -4266,11 +4212,9 @@ int TclCompileInvertOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileUnaryOpCmd(interp, parsePtr, INST_BITNOT, envPtr); } @@ -4278,11 +4222,9 @@ int TclCompileNotOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileUnaryOpCmd(interp, parsePtr, INST_LNOT, envPtr); } @@ -4290,11 +4232,9 @@ int TclCompileAddOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileAssociativeBinaryOpCmd(interp, parsePtr, "0", INST_ADD, envPtr); } @@ -4303,11 +4243,9 @@ int TclCompileMulOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileAssociativeBinaryOpCmd(interp, parsePtr, "1", INST_MULT, envPtr); } @@ -4316,11 +4254,9 @@ int TclCompileAndOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileAssociativeBinaryOpCmd(interp, parsePtr, "-1", INST_BITAND, envPtr); } @@ -4329,11 +4265,9 @@ int TclCompileOrOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileAssociativeBinaryOpCmd(interp, parsePtr, "0", INST_BITOR, envPtr); } @@ -4342,11 +4276,9 @@ int TclCompileXorOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileAssociativeBinaryOpCmd(interp, parsePtr, "0", INST_BITXOR, envPtr); } @@ -4355,8 +4287,7 @@ int TclCompilePowOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { /* @@ -4367,7 +4298,6 @@ TclCompilePowOpCmd( Tcl_Token *tokenPtr = parsePtr->tokenPtr; DefineLineInformation; /* TIP #280 */ int words; - (void)cmdPtr; for (words=1 ; wordsnumWords ; words++) { tokenPtr = TokenAfter(tokenPtr); @@ -4387,11 +4317,9 @@ int TclCompileLshiftOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_LSHIFT, envPtr); } @@ -4399,11 +4327,9 @@ int TclCompileRshiftOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_RSHIFT, envPtr); } @@ -4411,11 +4337,9 @@ int TclCompileModOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_MOD, envPtr); } @@ -4423,11 +4347,9 @@ int TclCompileNeqOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_NEQ, envPtr); } @@ -4435,11 +4357,9 @@ int TclCompileStrneqOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_STR_NEQ, envPtr); } @@ -4447,11 +4367,9 @@ int TclCompileInOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_LIST_IN, envPtr); } @@ -4459,11 +4377,9 @@ int TclCompileNiOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileStrictlyBinaryOpCmd(interp, parsePtr, INST_LIST_NOT_IN, envPtr); } @@ -4472,11 +4388,9 @@ int TclCompileLessOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_LT, envPtr); } @@ -4484,11 +4398,9 @@ int TclCompileLeqOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_LE, envPtr); } @@ -4496,11 +4408,9 @@ int TclCompileGreaterOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_GT, envPtr); } @@ -4508,11 +4418,9 @@ int TclCompileGeqOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_GE, envPtr); } @@ -4520,11 +4428,9 @@ int TclCompileEqOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_EQ, envPtr); } @@ -4532,11 +4438,9 @@ int TclCompileStreqOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_STR_EQ, envPtr); } @@ -4544,11 +4448,9 @@ int TclCompileStrLtOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_STR_LT, envPtr); } @@ -4556,11 +4458,9 @@ int TclCompileStrLeOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_STR_LE, envPtr); } @@ -4568,11 +4468,9 @@ int TclCompileStrGtOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_STR_GT, envPtr); } @@ -4580,11 +4478,9 @@ int TclCompileStrGeOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { - (void)cmdPtr; return CompileComparisonOpCmd(interp, parsePtr, INST_STR_GE, envPtr); } @@ -4592,14 +4488,12 @@ int TclCompileMinusOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { Tcl_Token *tokenPtr = parsePtr->tokenPtr; DefineLineInformation; /* TIP #280 */ int words; - (void)cmdPtr; /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords == 1) { @@ -4639,14 +4533,12 @@ int TclCompileDivOpCmd( Tcl_Interp *interp, Tcl_Parse *parsePtr, - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) { Tcl_Token *tokenPtr = parsePtr->tokenPtr; DefineLineInformation; /* TIP #280 */ int words; - (void)cmdPtr; /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords == 1) { diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 7ed24ae..5d4555e 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -697,8 +697,7 @@ static void EnterCmdStartData(CompileEnv *envPtr, static void FreeByteCodeInternalRep(Tcl_Obj *objPtr); static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr); static int GetCmdLocEncodingSize(CompileEnv *envPtr); -static int IsCompactibleCompileEnv(Tcl_Interp *interp, - CompileEnv *envPtr); +static int IsCompactibleCompileEnv(CompileEnv *envPtr); static void PreventCycle(Tcl_Obj *objPtr, CompileEnv *envPtr); #ifdef TCL_COMPILE_STATS static void RecordByteCodeStats(ByteCode *codePtr); @@ -851,7 +850,7 @@ TclSetByteCodeFromAny( if (Tcl_GetMaster(interp) == NULL && !Tcl_LimitTypeEnabled(interp, TCL_LIMIT_COMMANDS|TCL_LIMIT_TIME) - && IsCompactibleCompileEnv(interp, &compEnv)) { + && IsCompactibleCompileEnv(&compEnv)) { TclFreeCompileEnv(&compEnv); iPtr->compiledProcPtr = procPtr; TclInitCompileEnv(interp, &compEnv, stringPtr, length, @@ -962,11 +961,9 @@ SetByteCodeFromAny( static void DupByteCodeInternalRep( - Tcl_Obj *srcPtr, /* Object with internal rep to copy. */ - Tcl_Obj *copyPtr) /* Object with internal rep to set. */ + TCL_UNUSED(Tcl_Obj *) /*srcPtr*/, + TCL_UNUSED(Tcl_Obj *) /*copyPtr*/) { - (void)srcPtr; - (void)copyPtr; return; } @@ -1176,12 +1173,10 @@ CleanupByteCode( static int IsCompactibleCompileEnv( - Tcl_Interp *dummy, CompileEnv *envPtr) { unsigned char *pc; int size; - (void)dummy; /* * Special: procedures in the '::tcl' namespace (or its children) are @@ -2740,13 +2735,11 @@ TclCompileNoOp( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ + TCL_UNUSED(Command *), CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; int i; - (void)cmdPtr; tokenPtr = parsePtr->tokenPtr; for (i = 1; i < parsePtr->numWords; i++) { -- cgit v0.12 From 3db7dab605a517136ec1ab8f425bf66e81f7a68d Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 18:31:49 +0000 Subject: more of the same --- generic/tclConfig.c | 16 ++--- generic/tclDate.c | 3 +- generic/tclDictObj.c | 172 ++++++++++++++++++++------------------------------- 3 files changed, 74 insertions(+), 117 deletions(-) diff --git a/generic/tclConfig.c b/generic/tclConfig.c index e7e521a..3bdcd38 100644 --- a/generic/tclConfig.c +++ b/generic/tclConfig.c @@ -41,13 +41,10 @@ typedef struct QCCD { * Static functions in this file: */ -static int QueryConfigObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - struct Tcl_Obj *const *objv); -static void QueryConfigDelete(ClientData clientData); +static Tcl_ObjCmdProc QueryConfigObjCmd; +static Tcl_CmdDeleteProc QueryConfigDelete; +static Tcl_InterpDeleteProc ConfigDictDeleteProc; static Tcl_Obj * GetConfigDict(Tcl_Interp *interp); -static void ConfigDictDeleteProc(ClientData clientData, - Tcl_Interp *interp); /* *---------------------------------------------------------------------- @@ -392,12 +389,9 @@ GetConfigDict( static void ConfigDictDeleteProc( ClientData clientData, /* Pointer to Tcl_Obj. */ - Tcl_Interp *dummy) /* Interpreter being deleted. */ + TCL_UNUSED(Tcl_Interp *)) { - Tcl_Obj *pDB = (Tcl_Obj *)clientData; - (void)dummy; - - Tcl_DecrRefCount(pDB); + Tcl_DecrRefCount((Tcl_Obj *)clientData); } /* diff --git a/generic/tclDate.c b/generic/tclDate.c index d31badd..341dd0f 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2744,7 +2744,7 @@ TclDatelex( int TclClockOldscanObjCmd( - void *dummy, /* Unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Count of paraneters */ Tcl_Obj *const *objv) /* Parameters */ @@ -2754,7 +2754,6 @@ TclClockOldscanObjCmd( DateInfo dateInfo; DateInfo* info = &dateInfo; int status; - (void)dummy; if (objc != 5) { Tcl_WrongNumArgs(interp, 1, objv, diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 88a7876..f63d60d 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -23,62 +23,44 @@ struct Dict; * Prototypes for functions defined later in this file: */ -static void DeleteDict(struct Dict *dict); -static int DictAppendCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictCreateCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictExistsCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictFilterCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictGetCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictGetDefCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictIncrCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictInfoCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictKeysCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictLappendCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictMergeCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictRemoveCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictReplaceCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictSetCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictSizeCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictUnsetCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictUpdateCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictValuesCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int DictWithCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static void DupDictInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); -static void FreeDictInternalRep(Tcl_Obj *dictPtr); -static void InvalidateDictChain(Tcl_Obj *dictObj); -static int SetDictFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); -static void UpdateStringOfDict(Tcl_Obj *dictPtr); -static Tcl_HashEntry * AllocChainEntry(Tcl_HashTable *tablePtr,void *keyPtr); -static inline void InitChainTable(struct Dict *dict); -static inline void DeleteChainTable(struct Dict *dict); -static inline Tcl_HashEntry *CreateChainEntry(struct Dict *dict, - Tcl_Obj *keyPtr, int *newPtr); -static inline int DeleteChainEntry(struct Dict *dict, Tcl_Obj *keyPtr); -static Tcl_NRPostProc FinalizeDictUpdate; -static Tcl_NRPostProc FinalizeDictWith; -static Tcl_ObjCmdProc DictForNRCmd; -static Tcl_ObjCmdProc DictMapNRCmd; -static Tcl_NRPostProc DictForLoopCallback; -static Tcl_NRPostProc DictMapLoopCallback; +static void DeleteDict(struct Dict *dict); +static Tcl_ObjCmdProc DictAppendCmd; +static Tcl_ObjCmdProc DictCreateCmd; +static Tcl_ObjCmdProc DictExistsCmd; +static Tcl_ObjCmdProc DictFilterCmd; +static Tcl_ObjCmdProc DictGetCmd; +static Tcl_ObjCmdProc DictGetDefCmd; +static Tcl_ObjCmdProc DictIncrCmd; +static Tcl_ObjCmdProc DictInfoCmd; +static Tcl_ObjCmdProc DictKeysCmd; +static Tcl_ObjCmdProc DictLappendCmd; +static Tcl_ObjCmdProc DictMergeCmd; +static Tcl_ObjCmdProc DictRemoveCmd; +static Tcl_ObjCmdProc DictReplaceCmd; +static Tcl_ObjCmdProc DictSetCmd; +static Tcl_ObjCmdProc DictSizeCmd; +static Tcl_ObjCmdProc DictUnsetCmd; +static Tcl_ObjCmdProc DictUpdateCmd; +static Tcl_ObjCmdProc DictValuesCmd; +static Tcl_ObjCmdProc DictWithCmd; +static Tcl_DupInternalRepProc DupDictInternalRep; +static Tcl_FreeInternalRepProc FreeDictInternalRep; +static void InvalidateDictChain(Tcl_Obj *dictObj); +static Tcl_SetFromAnyProc SetDictFromAny; +static Tcl_UpdateStringProc UpdateStringOfDict; +static Tcl_AllocHashEntryProc AllocChainEntry; +static inline void InitChainTable(struct Dict *dict); +static inline void DeleteChainTable(struct Dict *dict); +static inline Tcl_HashEntry * CreateChainEntry(struct Dict *dict, + Tcl_Obj *keyPtr, int *newPtr); +static inline int DeleteChainEntry(struct Dict *dict, + Tcl_Obj *keyPtr); +static Tcl_NRPostProc FinalizeDictUpdate; +static Tcl_NRPostProc FinalizeDictWith; +static Tcl_ObjCmdProc DictForNRCmd; +static Tcl_ObjCmdProc DictMapNRCmd; +static Tcl_NRPostProc DictForLoopCallback; +static Tcl_NRPostProc DictMapLoopCallback; /* * Table of dict subcommand names and implementations. @@ -240,12 +222,11 @@ typedef struct { static Tcl_HashEntry * AllocChainEntry( - Tcl_HashTable *tablePtr, + TCL_UNUSED(Tcl_HashTable *), void *keyPtr) { Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr; ChainEntry *cPtr; - (void)tablePtr; cPtr = (ChainEntry *)ckalloc(sizeof(ChainEntry)); cPtr->entry.key.objPtr = objPtr; @@ -1462,12 +1443,12 @@ Tcl_NewDictObj(void) *---------------------------------------------------------------------- */ +#ifdef TCL_MEM_DEBUG Tcl_Obj * Tcl_DbNewDictObj( const char *file, int line) { -#ifdef TCL_MEM_DEBUG Tcl_Obj *dictPtr; Dict *dict; @@ -1480,12 +1461,16 @@ Tcl_DbNewDictObj( dict->refCount = 1; DictSetIntRep(dictPtr, dict); return dictPtr; +} #else /* !TCL_MEM_DEBUG */ - (void)file; - (void)line; +Tcl_Obj * +Tcl_DbNewDictObj( + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) +{ return Tcl_NewDictObj(); -#endif } +#endif /***** START OF FUNCTIONS IMPLEMENTING TCL COMMANDS *****/ @@ -1509,14 +1494,13 @@ Tcl_DbNewDictObj( static int DictCreateCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Tcl_Obj *dictObj; int i; - (void)dummy; /* * Must have an even number of arguments; note that number of preceding @@ -1560,14 +1544,13 @@ DictCreateCmd( static int DictGetCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Tcl_Obj *dictPtr, *valuePtr = NULL; int result; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?key ...?"); @@ -1654,7 +1637,7 @@ DictGetCmd( static int DictGetDefCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -1662,7 +1645,6 @@ DictGetDefCmd( Tcl_Obj *dictPtr, *keyPtr, *valuePtr, *defaultPtr; Tcl_Obj *const *keyPath; int numKeys; - (void)dummy; if (objc < 4) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?key ...? key default"); @@ -1720,14 +1702,13 @@ DictGetDefCmd( static int DictReplaceCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Tcl_Obj *dictPtr; int i; - (void)dummy; if ((objc < 2) || (objc & 1)) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?key value ...?"); @@ -1769,14 +1750,13 @@ DictReplaceCmd( static int DictRemoveCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Tcl_Obj *dictPtr; int i; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?key ...?"); @@ -1818,7 +1798,7 @@ DictRemoveCmd( static int DictMergeCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -1827,7 +1807,6 @@ DictMergeCmd( int allocatedDict = 0; int i, done; Tcl_DictSearch search; - (void)dummy; if (objc == 1) { /* @@ -1906,14 +1885,13 @@ DictMergeCmd( static int DictKeysCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Tcl_Obj *listPtr; const char *pattern = NULL; - (void)dummy; if (objc!=2 && objc!=3) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?pattern?"); @@ -1986,7 +1964,7 @@ DictKeysCmd( static int DictValuesCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -1995,7 +1973,6 @@ DictValuesCmd( Tcl_DictSearch search; int done; const char *pattern; - (void)dummy; if (objc!=2 && objc!=3) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary ?pattern?"); @@ -2047,13 +2024,12 @@ DictValuesCmd( static int DictSizeCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { int result, size; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary"); @@ -2086,13 +2062,12 @@ DictSizeCmd( static int DictExistsCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Tcl_Obj *dictPtr, *valuePtr; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary key ?key ...?"); @@ -2129,14 +2104,13 @@ DictExistsCmd( static int DictInfoCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Dict *dict; char *statsStr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary"); @@ -2174,14 +2148,13 @@ DictInfoCmd( static int DictIncrCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { int code = TCL_OK; Tcl_Obj *dictPtr, *valuePtr = NULL; - (void)dummy; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?increment?"); @@ -2295,14 +2268,13 @@ DictIncrCmd( static int DictLappendCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Tcl_Obj *dictPtr, *valuePtr, *resultPtr; int i, allocatedDict = 0, allocatedValue = 0; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?value ...?"); @@ -2383,14 +2355,13 @@ DictLappendCmd( static int DictAppendCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Tcl_Obj *dictPtr, *valuePtr, *resultPtr; int allocatedDict = 0; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?value ...?"); @@ -2486,7 +2457,7 @@ DictAppendCmd( static int DictForNRCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -2496,7 +2467,6 @@ DictForNRCmd( Tcl_Obj **varv, *keyObj, *valueObj; Tcl_DictSearch *searchPtr; int varc, done; - (void)dummy; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -2682,7 +2652,7 @@ DictForLoopCallback( static int DictMapNRCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -2691,7 +2661,6 @@ DictMapNRCmd( Tcl_Obj **varv, *keyObj, *valueObj; DictMapStorage *storagePtr; int varc, done; - (void)dummy; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -2895,14 +2864,13 @@ DictMapLoopCallback( static int DictSetCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Tcl_Obj *dictPtr, *resultPtr; int result, allocatedDict = 0; - (void)dummy; if (objc < 4) { Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?key ...? value"); @@ -2956,14 +2924,13 @@ DictSetCmd( static int DictUnsetCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Tcl_Obj *dictPtr, *resultPtr; int result, allocatedDict = 0; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?key ...?"); @@ -3016,7 +2983,7 @@ DictUnsetCmd( static int DictFilterCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -3033,7 +3000,6 @@ DictFilterCmd( Tcl_DictSearch search; int index, varc, done, result, satisfied; const char *pattern; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary filterType ?arg ...?"); @@ -3302,7 +3268,7 @@ DictFilterCmd( static int DictUpdateCmd( - ClientData clientData, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -3310,7 +3276,6 @@ DictUpdateCmd( Interp *iPtr = (Interp *) interp; Tcl_Obj *dictPtr, *objPtr; int i, dummy; - (void)clientData; if (objc < 5 || !(objc & 1)) { Tcl_WrongNumArgs(interp, 1, objv, @@ -3461,14 +3426,13 @@ FinalizeDictUpdate( static int DictWithCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Interp *iPtr = (Interp *) interp; Tcl_Obj *dictPtr, *keysPtr, *pathPtr; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "dictVarName ?key ...? script"); -- cgit v0.12 From e870d650fdbd1f2a1e76764531a10e81f4509cea Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 19:29:59 +0000 Subject: more unused arguments --- generic/tclDisassemble.c | 9 +-- generic/tclEncoding.c | 185 +++++++++++++---------------------------------- 2 files changed, 53 insertions(+), 141 deletions(-) diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index 83642f0..e30499f 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -21,8 +21,7 @@ * Prototypes for procedures defined later in this file: */ -static Tcl_Obj * DisassembleByteCodeAsDicts(Tcl_Interp *interp, - Tcl_Obj *objPtr); +static Tcl_Obj * DisassembleByteCodeAsDicts(Tcl_Obj *objPtr); static Tcl_Obj * DisassembleByteCodeObj(Tcl_Obj *objPtr); static int FormatInstruction(ByteCode *codePtr, const unsigned char *pc, Tcl_Obj *bufferObj); @@ -131,7 +130,7 @@ GetLocationInformation( void TclPrintByteCodeObj( - Tcl_Interp *interp, /* Used only for getting location info. */ + TCL_UNUSED(Tcl_Interp *), /* Stuck with this in internal stubs */ Tcl_Obj *objPtr) /* The bytecode object to disassemble. */ { Tcl_Obj *bufPtr = DisassembleByteCodeObj(objPtr); @@ -950,7 +949,6 @@ PrintSourceToObj( static Tcl_Obj * DisassembleByteCodeAsDicts( - Tcl_Interp *dummy, /* Not used. */ Tcl_Obj *objPtr) /* The bytecode-holding value to take apart */ { ByteCode *codePtr; @@ -959,7 +957,6 @@ DisassembleByteCodeAsDicts( unsigned char *pc, *opnd, *codeOffPtr, *codeLenPtr, *srcOffPtr, *srcLenPtr; int codeOffset, codeLength, sourceOffset, sourceLength; int i, val, line; - (void)dummy; ByteCodeGetIntRep(objPtr, &tclByteCodeType, codePtr); @@ -1622,7 +1619,7 @@ Tcl_DisassembleObjCmd( } if (clientData) { Tcl_SetObjResult(interp, - DisassembleByteCodeAsDicts(interp, codeObjPtr)); + DisassembleByteCodeAsDicts(codeObjPtr)); } else { Tcl_SetObjResult(interp, DisassembleByteCodeObj(codeObjPtr)); diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index c888962..b02be21 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -195,85 +195,41 @@ static unsigned short emptyPage[256]; * Functions used only in this module. */ -static int BinaryProc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, int dstLen, - int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr); -static void DupEncodingIntRep(Tcl_Obj *srcPtr, Tcl_Obj *dupPtr); -static void EscapeFreeProc(ClientData clientData); -static int EscapeFromUtfProc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, int dstLen, - int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr); -static int EscapeToUtfProc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, int dstLen, - int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr); -static void FillEncodingFileMap(void); -static void FreeEncoding(Tcl_Encoding encoding); -static void FreeEncodingIntRep(Tcl_Obj *objPtr); -static Encoding * GetTableEncoding(EscapeEncodingData *dataPtr, - int state); -static Tcl_Encoding LoadEncodingFile(Tcl_Interp *interp, const char *name); -static Tcl_Encoding LoadTableEncoding(const char *name, int type, - Tcl_Channel chan); -static Tcl_Encoding LoadEscapeEncoding(const char *name, Tcl_Channel chan); -static Tcl_Channel OpenEncodingFileChannel(Tcl_Interp *interp, - const char *name); -static void TableFreeProc(ClientData clientData); -static int TableFromUtfProc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, int dstLen, - int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr); -static int TableToUtfProc(ClientData clientData, const char *src, - int srcLen, int flags, Tcl_EncodingState *statePtr, - char *dst, int dstLen, int *srcReadPtr, - int *dstWrotePtr, int *dstCharsPtr); -static size_t unilen(const char *src); -static int Utf16ToUtfProc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, int dstLen, - int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr); -static int UtfToUtf16Proc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, int dstLen, - int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr); -static int UtfToUcs2Proc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, int dstLen, - int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr); -static int UtfToUtfProc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, int dstLen, - int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr, int pureNullMode); -static int UtfIntToUtfExtProc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, int dstLen, - int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr); -static int UtfExtToUtfIntProc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, int dstLen, - int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr); -static int Iso88591FromUtfProc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, int dstLen, - int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr); -static int Iso88591ToUtfProc(ClientData clientData, - const char *src, int srcLen, int flags, - Tcl_EncodingState *statePtr, char *dst, - int dstLen, int *srcReadPtr, int *dstWrotePtr, - int *dstCharsPtr); +static Tcl_EncodingConvertProc BinaryProc; +static Tcl_DupInternalRepProc DupEncodingIntRep; +static Tcl_EncodingFreeProc EscapeFreeProc; +static Tcl_EncodingConvertProc EscapeFromUtfProc; +static Tcl_EncodingConvertProc EscapeToUtfProc; +static void FillEncodingFileMap(void); +static void FreeEncoding(Tcl_Encoding encoding); +static Tcl_FreeInternalRepProc FreeEncodingIntRep; +static Encoding * GetTableEncoding(EscapeEncodingData *dataPtr, + int state); +static Tcl_Encoding LoadEncodingFile(Tcl_Interp *interp, + const char *name); +static Tcl_Encoding LoadTableEncoding(const char *name, int type, + Tcl_Channel chan); +static Tcl_Encoding LoadEscapeEncoding(const char *name, + Tcl_Channel chan); +static Tcl_Channel OpenEncodingFileChannel(Tcl_Interp *interp, + const char *name); +static Tcl_EncodingFreeProc TableFreeProc; +static Tcl_EncodingConvertProc TableFromUtfProc; +static Tcl_EncodingConvertProc TableToUtfProc; +static size_t unilen(const char *src); +static Tcl_EncodingConvertProc Utf16ToUtfProc; +static Tcl_EncodingConvertProc UtfToUtf16Proc; +static Tcl_EncodingConvertProc UtfToUcs2Proc; +static int UtfToUtfProc(ClientData clientData, + const char *src, int srcLen, int flags, + Tcl_EncodingState *statePtr, char *dst, + int dstLen, int *srcReadPtr, + int *dstWrotePtr, int *dstCharsPtr, + int pureNullMode); +static Tcl_EncodingConvertProc UtfIntToUtfExtProc; +static Tcl_EncodingConvertProc UtfExtToUtfIntProc; +static Tcl_EncodingConvertProc Iso88591FromUtfProc; +static Tcl_EncodingConvertProc Iso88591ToUtfProc; /* * A Tcl_ObjType for holding a cached Tcl_Encoding in the twoPtrValue.ptr1 field @@ -1226,7 +1182,7 @@ Tcl_ExternalToUtfDString( int Tcl_ExternalToUtf( - Tcl_Interp *dummy, /* Interp for error return, if not NULL. */ + TCL_UNUSED(Tcl_Interp *), /* TODO: Re-examine this. */ Tcl_Encoding encoding, /* The encoding for the source string, or NULL * for the default system encoding. */ const char *src, /* Source string in specified encoding. */ @@ -1260,7 +1216,6 @@ Tcl_ExternalToUtf( int charLimited = (flags & TCL_ENCODING_CHAR_LIMIT) && dstCharsPtr; int maxChars = INT_MAX; Tcl_EncodingState state; - (void)dummy; if (encoding == NULL) { encoding = systemEncoding; @@ -1418,7 +1373,7 @@ Tcl_UtfToExternalDString( int Tcl_UtfToExternal( - Tcl_Interp *dummy, /* Interp for error return, if not NULL. */ + TCL_UNUSED(Tcl_Interp *), /* TODO: Re-examine this. */ Tcl_Encoding encoding, /* The encoding for the converted string, or * NULL for the default system encoding. */ const char *src, /* Source string in UTF-8. */ @@ -1449,7 +1404,6 @@ Tcl_UtfToExternal( const Encoding *encodingPtr; int result, srcRead, dstWrote, dstChars; Tcl_EncodingState state; - (void)dummy; if (encoding == NULL) { encoding = systemEncoding; @@ -2157,15 +2111,11 @@ LoadEscapeEncoding( static int BinaryProc( - ClientData clientData, /* Not used. */ + TCL_UNUSED(ClientData), const char *src, /* Source string (unknown encoding). */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Place for conversion routine to store state - * information used during a piecewise - * conversion. Contents of statePtr are - * initialized and/or reset by conversion - * routine under control of flags argument. */ + TCL_UNUSED(Tcl_EncodingState *), char *dst, /* Output buffer in which converted string is * stored. */ int dstLen, /* The maximum length of output buffer in @@ -2180,8 +2130,6 @@ BinaryProc( * output buffer. */ { int result; - (void)clientData; - (void)statePtr; result = TCL_OK; dstLen -= TCL_UTF_MAX - 1; @@ -2223,7 +2171,7 @@ BinaryProc( static int UtfIntToUtfExtProc( - ClientData clientData, /* Not used. */ + ClientData clientData, const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ @@ -2272,7 +2220,7 @@ UtfIntToUtfExtProc( static int UtfExtToUtfIntProc( - ClientData clientData, /* Not used. */ + ClientData clientData, const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ @@ -2321,7 +2269,7 @@ UtfExtToUtfIntProc( static int UtfToUtfProc( - ClientData clientData, /* Not used. */ + TCL_UNUSED(ClientData), const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ @@ -2353,7 +2301,6 @@ UtfToUtfProc( const char *dstStart, *dstEnd; int result, numChars, charLimit = INT_MAX; Tcl_UniChar *chPtr = (Tcl_UniChar *) statePtr; - (void)clientData; if (flags & TCL_ENCODING_START) { *statePtr = 0; @@ -2460,11 +2407,7 @@ Utf16ToUtfProc( const char *src, /* Source string in Unicode. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Place for conversion routine to store state - * information used during a piecewise - * conversion. Contents of statePtr are - * initialized and/or reset by conversion - * routine under control of flags argument. */ + TCL_UNUSED(Tcl_EncodingState *), char *dst, /* Output buffer in which converted string is * stored. */ int dstLen, /* The maximum length of output buffer in @@ -2485,7 +2428,6 @@ Utf16ToUtfProc( const char *dstEnd, *dstStart; int result, numChars, charLimit = INT_MAX; unsigned short ch; - (void)statePtr; if (flags & TCL_ENCODING_CHAR_LIMIT) { charLimit = *dstCharsPtr; @@ -2680,11 +2622,7 @@ UtfToUcs2Proc( const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Place for conversion routine to store state - * information used during a piecewise - * conversion. Contents of statePtr are - * initialized and/or reset by conversion - * routine under control of flags argument. */ + TCL_UNUSED(Tcl_EncodingState *), char *dst, /* Output buffer in which converted string is * stored. */ int dstLen, /* The maximum length of output buffer in @@ -2707,7 +2645,6 @@ UtfToUcs2Proc( int len; #endif Tcl_UniChar ch = 0; - (void)statePtr; srcStart = src; srcEnd = src + srcLen; @@ -2790,11 +2727,7 @@ TableToUtfProc( const char *src, /* Source string in specified encoding. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Place for conversion routine to store state - * information used during a piecewise - * conversion. Contents of statePtr are - * initialized and/or reset by conversion - * routine under control of flags argument. */ + TCL_UNUSED(Tcl_EncodingState *), char *dst, /* Output buffer in which converted string is * stored. */ int dstLen, /* The maximum length of output buffer in @@ -2818,7 +2751,6 @@ TableToUtfProc( const unsigned short *const *toUnicode; const unsigned short *pageZero; TableEncodingData *dataPtr = (TableEncodingData *)clientData; - (void)statePtr; if (flags & TCL_ENCODING_CHAR_LIMIT) { charLimit = *dstCharsPtr; @@ -2904,11 +2836,7 @@ TableFromUtfProc( const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Place for conversion routine to store state - * information used during a piecewise - * conversion. Contents of statePtr are - * initialized and/or reset by conversion - * routine under control of flags argument. */ + TCL_UNUSED(Tcl_EncodingState *), char *dst, /* Output buffer in which converted string is * stored. */ int dstLen, /* The maximum length of output buffer in @@ -2931,7 +2859,6 @@ TableFromUtfProc( int result, len, word, numChars; TableEncodingData *dataPtr = (TableEncodingData *)clientData; const unsigned short *const *fromUnicode; - (void)statePtr; result = TCL_OK; @@ -3026,15 +2953,11 @@ TableFromUtfProc( static int Iso88591ToUtfProc( - ClientData clientData, /* Ignored. */ + TCL_UNUSED(ClientData), const char *src, /* Source string in specified encoding. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Place for conversion routine to store state - * information used during a piecewise - * conversion. Contents of statePtr are - * initialized and/or reset by conversion - * routine under control of flags argument. */ + TCL_UNUSED(Tcl_EncodingState *), char *dst, /* Output buffer in which converted string is * stored. */ int dstLen, /* The maximum length of output buffer in @@ -3054,8 +2977,6 @@ Iso88591ToUtfProc( const char *srcStart, *srcEnd; const char *dstEnd, *dstStart; int result, numChars, charLimit = INT_MAX; - (void)clientData; - (void)statePtr; if (flags & TCL_ENCODING_CHAR_LIMIT) { charLimit = *dstCharsPtr; @@ -3112,15 +3033,11 @@ Iso88591ToUtfProc( static int Iso88591FromUtfProc( - ClientData clientData, /* Ignored. */ + TCL_UNUSED(ClientData), const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Place for conversion routine to store state - * information used during a piecewise - * conversion. Contents of statePtr are - * initialized and/or reset by conversion - * routine under control of flags argument. */ + TCL_UNUSED(Tcl_EncodingState *), char *dst, /* Output buffer in which converted string is * stored. */ int dstLen, /* The maximum length of output buffer in @@ -3141,8 +3058,6 @@ Iso88591FromUtfProc( const char *dstStart, *dstEnd; int result = TCL_OK, numChars; Tcl_UniChar ch = 0; - (void)clientData; - (void)statePtr; srcStart = src; srcEnd = src + srcLen; -- cgit v0.12 From 3f741fda0387c3b85fd1d5c3d0a1a4876f455386 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 19:58:14 +0000 Subject: (no comment) --- generic/tclEnsemble.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 654f33e..b9c71a0 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -151,7 +151,7 @@ NewNsObj( int TclNamespaceEnsembleCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -164,7 +164,6 @@ TclNamespaceEnsembleCmd( Tcl_Obj *listObj; const char *simpleName; int index, done; - (void)dummy; if (nsPtr == NULL || nsPtr->flags & NS_DYING) { if (!Tcl_InterpDeleted(interp)) { @@ -1988,11 +1987,10 @@ NsEnsembleImplementationCmdNR( int TclClearRootEnsemble( - ClientData dummy[], + TCL_UNUSED(ClientData *), Tcl_Interp *interp, int result) { - (void)dummy; TclResetRewriteEnsemble(interp, 1); return result; } @@ -2096,12 +2094,11 @@ TclResetRewriteEnsemble( static int FreeER( ClientData data[], - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), int result) { Tcl_Obj **tmp = (Tcl_Obj **) data[0]; Tcl_Obj **store = (Tcl_Obj **) data[1]; - (void)dummy; ckfree(store); ckfree(tmp); -- cgit v0.12 From e72ebf58a150fcbf041ed40495472805d08d8ce1 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 20:01:56 +0000 Subject: (no comment) --- generic/tclEnv.c | 3 +-- generic/tclEvent.c | 17 ++++++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/generic/tclEnv.c b/generic/tclEnv.c index d7f8d5f..86df16d 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -579,7 +579,7 @@ TclGetEnv( /* ARGSUSED */ static char * EnvTraceProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter whose "env" variable is being * modified. */ const char *name1, /* Better be "env". */ @@ -587,7 +587,6 @@ EnvTraceProc( * whole array is being deleted (UTF-8). */ int flags) /* Indicates what's happening. */ { - (void)dummy; /* * For array traces, let TclSetupEnv do all the work. */ diff --git a/generic/tclEvent.c b/generic/tclEvent.c index fbc2bf3..d9f868c 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -311,7 +311,7 @@ HandleBgErrors( int TclDefaultBgErrorHandlerObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -320,7 +320,6 @@ TclDefaultBgErrorHandlerObjCmd( Tcl_Obj *tempObjv[2]; int result, code, level; Tcl_InterpState saved; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "msg options"); @@ -598,11 +597,10 @@ TclGetBgErrorHandler( static void BgErrorDeleteProc( void *clientData, /* Pointer to ErrAssocData structure. */ - Tcl_Interp *dummy) /* Interpreter being deleted. */ + TCL_UNUSED(Tcl_Interp *)) { ErrAssocData *assocPtr = (ErrAssocData *)clientData; BgError *errPtr; - (void)dummy; while (assocPtr->firstBgPtr != NULL) { errPtr = assocPtr->firstBgPtr; @@ -1401,14 +1399,13 @@ TclInThreadExit(void) /* ARGSUSED */ int Tcl_VwaitObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int done, foundEvent; const char *nameString; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1466,14 +1463,13 @@ Tcl_VwaitObjCmd( /* ARGSUSED */ static char * VwaitVarProc( - void *clientData, /* Pointer to integer to set to 1. */ + void *clientData, /* Pointer to integer to set to 1. */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ - int flags) /* Information about what happened. */ + TCL_UNUSED(int) /*flags*/) /* Information about what happened. */ { int *donePtr = (int *)clientData; - (void)flags; *donePtr = 1; Tcl_UntraceVar2(interp, name1, name2, TCL_TRACE_WRITES|TCL_TRACE_UNSETS, @@ -1501,7 +1497,7 @@ VwaitVarProc( /* ARGSUSED */ int Tcl_UpdateObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1510,7 +1506,6 @@ Tcl_UpdateObjCmd( int flags = 0; /* Initialized to avoid compiler warning. */ static const char *const updateOptions[] = {"idletasks", NULL}; enum updateOptions {OPT_IDLETASKS}; - (void)dummy; if (objc == 1) { flags = TCL_ALL_EVENTS|TCL_DONT_WAIT; -- cgit v0.12 From 9bfe3724215a96c07d1f1067c75389798f54a8c5 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 20:15:24 +0000 Subject: more --- generic/tclExecute.c | 24 ++++++++++++++---------- generic/tclFCmd.c | 27 +++++++++------------------ generic/tclFileName.c | 13 ++++++++----- 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index e757230..169aece 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -798,6 +798,7 @@ ReleaseDictIterator( *---------------------------------------------------------------------- */ +#if defined(TCL_COMPILE_STATS) || defined(TCL_COMPILE_DEBUG) static void InitByteCodeExecution( Tcl_Interp *interp) /* Interpreter for which the Tcl variable @@ -810,12 +811,19 @@ InitByteCodeExecution( Tcl_Panic("InitByteCodeExecution: can't create link for tcl_traceExec variable"); } #endif -#ifndef TCL_COMPILE_STATS - (void)interp; -#else +#ifdef TCL_COMPILE_STATS Tcl_CreateObjCommand(interp, "evalstats", EvalStatsCmd, NULL, NULL); #endif /* TCL_COMPILE_STATS */ } + +#else + +static void +InitByteCodeExecution( + TCL_UNUSED(Tcl_Interp *)) +{ +} +#endif /* *---------------------------------------------------------------------- @@ -1358,13 +1366,11 @@ Tcl_ExprObj( static int CopyCallback( ClientData data[], - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), int result) { Tcl_Obj **resultPtrPtr = (Tcl_Obj **)data[0]; Tcl_Obj *resultPtr = (Tcl_Obj *)data[1]; - (void)dummy; - (void)dummy; if (result == TCL_OK) { *resultPtrPtr = resultPtr; @@ -1555,11 +1561,9 @@ CompileExprObj( static void DupExprCodeInternalRep( - Tcl_Obj *srcPtr, - Tcl_Obj *copyPtr) + TCL_UNUSED(Tcl_Obj *), + TCL_UNUSED(Tcl_Obj *)) { - (void)srcPtr; - (void)copyPtr; return; } diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index bfb5b36..3babd43 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c @@ -47,13 +47,12 @@ static int FileForceOption(Tcl_Interp *interp, int TclFileRenameCmd( - ClientData dummy, /* Unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interp for error reporting or recursive * calls in the case of a tricky rename. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */ { - (void)dummy; return FileCopyRename(interp, objc, objv, 0); } @@ -77,13 +76,12 @@ TclFileRenameCmd( int TclFileCopyCmd( - ClientData dummy, /* Unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Used for error reporting or recursive calls * in the case of a tricky copy. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */ { - (void)dummy; return FileCopyRename(interp, objc, objv, 1); } @@ -216,7 +214,7 @@ FileCopyRename( int TclFileMakeDirsCmd( - ClientData dummy, /* Unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Used for error reporting. */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */ @@ -226,7 +224,6 @@ TclFileMakeDirsCmd( Tcl_Obj *split = NULL; Tcl_Obj *target = NULL; Tcl_StatBuf statBuf; - (void)dummy; result = TCL_OK; for (i = 1; i < objc; i++) { @@ -341,7 +338,7 @@ TclFileMakeDirsCmd( int TclFileDeleteCmd( - ClientData dummy, /* Unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Used for error reporting */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */ @@ -349,7 +346,6 @@ TclFileDeleteCmd( int i, force, result; Tcl_Obj *errfile; Tcl_Obj *errorBuffer = NULL; - (void)dummy; i = FileForceOption(interp, objc - 1, objv + 1, &force); if (i < 0) { @@ -950,7 +946,7 @@ FileBasename( int TclFileAttrsCmd( - ClientData dummy, /* Unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The interpreter for error reporting. */ int objc, /* Number of command line arguments. */ Tcl_Obj *const objv[]) /* The command line objects. */ @@ -961,7 +957,6 @@ TclFileAttrsCmd( Tcl_Obj *objStrings = NULL; int numObjStrings = -1; Tcl_Obj *filePtr; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "name ?-option value ...?"); @@ -1167,14 +1162,13 @@ TclFileAttrsCmd( int TclFileLinkCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *contents; int index; - (void)dummy; if (objc < 2 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "?-linktype? linkname ?target?"); @@ -1319,13 +1313,12 @@ TclFileLinkCmd( int TclFileReadLinkCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *contents; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -1371,7 +1364,7 @@ TclFileReadLinkCmd( int TclFileTemporaryCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1385,7 +1378,6 @@ TclFileTemporaryCmd( /* Pieces of template. Each piece is NULL if * it is omitted. The platform temporary file * engine might ignore some pieces. */ - (void)dummy; if (objc < 1 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "?nameVar? ?template?"); @@ -1531,7 +1523,7 @@ TclFileTemporaryCmd( int TclFileTempDirCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1542,7 +1534,6 @@ TclFileTempDirCmd( /* Pieces of template. Each piece is NULL if * it is omitted. The platform temporary file * engine might ignore some pieces. */ - (void)dummy; if (objc < 1 || objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?template?"); diff --git a/generic/tclFileName.c b/generic/tclFileName.c index ee2321d..a069ff1 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -1220,7 +1220,7 @@ DoTildeSubst( /* ARGSUSED */ int Tcl_GlobObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1241,7 +1241,6 @@ Tcl_GlobObjCmd( }; enum pathDirOptions {PATH_NONE = -1 , PATH_GENERAL = 0, PATH_DIR = 1}; Tcl_GlobTypeData *globTypes = NULL; - (void)dummy; globFlags = 0; join = 0; @@ -2634,21 +2633,25 @@ Tcl_GetBlocksFromStat( #endif } +#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE unsigned Tcl_GetBlockSizeFromStat( const Tcl_StatBuf *statPtr) { -#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE return statPtr->st_blksize; +} #else - (void)statPtr; +unsigned +Tcl_GetBlockSizeFromStat( + TCL_UNUSED(const Tcl_StatBuf *)) +{ /* * Not a great guess, but will do... */ return GUESSED_BLOCK_SIZE; -#endif } +#endif /* * Local Variables: -- cgit v0.12 From b88a8f3dd92fcd8d7af61da8e6f9b56964ae0c3d Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 20:23:01 +0000 Subject: more --- generic/tclHash.c | 23 +++++++---------------- generic/tclHistory.c | 3 +-- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/generic/tclHash.c b/generic/tclHash.c index 10e3027..e48c816 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -798,13 +798,12 @@ HashArrayKey( static Tcl_HashEntry * AllocStringEntry( - Tcl_HashTable *tablePtr, /* Hash table. */ + TCL_UNUSED(Tcl_HashTable *), void *keyPtr) /* Key to store in the hash table entry. */ { const char *string = (const char *) keyPtr; Tcl_HashEntry *hPtr; size_t size, allocsize; - (void)tablePtr; allocsize = size = strlen(string) + 1; if (size < sizeof(hPtr->key)) { @@ -864,13 +863,12 @@ CompareStringKeys( static TCL_HASH_TYPE HashStringKey( - Tcl_HashTable *tablePtr, /* Hash table. */ + TCL_UNUSED(Tcl_HashTable *), void *keyPtr) /* Key from which to compute hash value. */ { const char *string = (const char *)keyPtr; TCL_HASH_TYPE result; char c; - (void)tablePtr; /* * I tried a zillion different hash functions and asked many other people @@ -932,11 +930,9 @@ HashStringKey( /* ARGSUSED */ static Tcl_HashEntry * BogusFind( - Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ - const char *key) /* Key to use to find matching entry. */ + TCL_UNUSED(Tcl_HashTable *), + TCL_UNUSED(const char *)) { - (void)tablePtr; - (void)key; Tcl_Panic("called %s on deleted table", "Tcl_FindHashEntry"); return NULL; } @@ -961,15 +957,10 @@ BogusFind( /* ARGSUSED */ static Tcl_HashEntry * BogusCreate( - Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ - const char *key, /* Key to use to find or create matching - * entry. */ - int *newPtr) /* Store info here telling whether a new entry - * was created. */ + TCL_UNUSED(Tcl_HashTable *), + TCL_UNUSED(const char *), + TCL_UNUSED(int *)) { - (void)tablePtr; - (void)key; - (void)newPtr; Tcl_Panic("called %s on deleted table", "Tcl_CreateHashEntry"); return NULL; } diff --git a/generic/tclHistory.c b/generic/tclHistory.c index 5408432..3a52a20 100644 --- a/generic/tclHistory.c +++ b/generic/tclHistory.c @@ -211,10 +211,9 @@ Tcl_RecordAndEvalObj( static void DeleteHistoryObjs( ClientData clientData, - Tcl_Interp *dummy) + TCL_UNUSED(Tcl_Interp *)) { HistoryObjs *histObjsPtr = (HistoryObjs *)clientData; - (void)dummy; TclDecrRefCount(histObjsPtr->historyObj); TclDecrRefCount(histObjsPtr->addObj); -- cgit v0.12 From 2cd124a28ea369d484197163cccb49acedc5e288 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 20:32:47 +0000 Subject: Remove SetIndexFromAny(), a useless routine that can only be reached via unsupported shenanigans. --- generic/tclIndexObj.c | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index 30c33f1..ba02453 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -22,7 +22,6 @@ static int GetIndexFromObjList(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Obj *tableObjPtr, const char *msg, int flags, int *indexPtr); -static int SetIndexFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static void UpdateStringOfIndex(Tcl_Obj *objPtr); static void DupIndex(Tcl_Obj *srcPtr, Tcl_Obj *dupPtr); static void FreeIndex(Tcl_Obj *objPtr); @@ -48,7 +47,7 @@ static const Tcl_ObjType indexType = { FreeIndex, /* freeIntRepProc */ DupIndex, /* dupIntRepProc */ UpdateStringOfIndex, /* updateStringProc */ - SetIndexFromAny /* setFromAnyProc */ + NULL /* setFromAnyProc */ }; /* @@ -397,39 +396,6 @@ Tcl_GetIndexFromObjStruct( /* *---------------------------------------------------------------------- * - * SetIndexFromAny -- - * - * This function is called to convert a Tcl object to index internal - * form. However, this doesn't make sense (need to have a table of - * keywords in order to do the conversion) so the function always - * generates an error. - * - * Results: - * The return value is always TCL_ERROR, and an error message is left in - * interp's result if interp isn't NULL. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -static int -SetIndexFromAny( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ - register Tcl_Obj *objPtr) /* The object to convert. */ -{ - if (interp) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't convert value to index except via Tcl_GetIndexFromObj API", - -1)); - } - return TCL_ERROR; -} - -/* - *---------------------------------------------------------------------- - * * UpdateStringOfIndex -- * * This function is called to convert a Tcl object from index internal -- cgit v0.12 From d599e21dbc8d6e121ada72b9f664f9f5ca05227c Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 20:46:51 +0000 Subject: more unused arguments --- generic/tclIndexObj.c | 9 +++------ generic/tclInterp.c | 22 ++++++++-------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index c1440dd..5aa4d42 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -540,7 +540,7 @@ TclInitPrefixCmd( static int PrefixMatchObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -556,7 +556,6 @@ PrefixMatchObjCmd( enum matchOptions { PRFMATCH_ERROR, PRFMATCH_EXACT, PRFMATCH_MESSAGE }; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "?options? table string"); @@ -665,7 +664,7 @@ PrefixMatchObjCmd( static int PrefixAllObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -673,7 +672,6 @@ PrefixAllObjCmd( int tableObjc, result, t, length, elemLength; const char *string, *elemString; Tcl_Obj **tableObjv, *resultPtr; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "table string"); @@ -723,7 +721,7 @@ PrefixAllObjCmd( static int PrefixLongestObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -731,7 +729,6 @@ PrefixLongestObjCmd( int tableObjc, result, i, t, length, elemLength, resultLength; const char *string, *elemString, *resultString; Tcl_Obj **tableObjv; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "table string"); diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 0d53476..5b0cd62 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -222,15 +222,12 @@ static int AliasDelete(Tcl_Interp *interp, static int AliasDescribe(Tcl_Interp *interp, Tcl_Interp *slaveInterp, Tcl_Obj *objPtr); static int AliasList(Tcl_Interp *interp, Tcl_Interp *slaveInterp); -static int AliasNRCmd(ClientData dummy, - Tcl_Interp *currentInterp, int objc, - Tcl_Obj *const objv[]); -static void AliasObjCmdDeleteProc(ClientData clientData); +static Tcl_ObjCmdProc AliasNRCmd; +static Tcl_CmdDeleteProc AliasObjCmdDeleteProc; static Tcl_Interp * GetInterp(Tcl_Interp *interp, Tcl_Obj *pathPtr); static Tcl_Interp * GetInterp2(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static void InterpInfoDeleteProc(ClientData clientData, - Tcl_Interp *interp); +static Tcl_InterpDeleteProc InterpInfoDeleteProc; static int SlaveBgerror(Tcl_Interp *interp, Tcl_Interp *slaveInterp, int objc, Tcl_Obj *const objv[]); @@ -254,7 +251,7 @@ static int SlaveInvokeHidden(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int SlaveMarkTrusted(Tcl_Interp *interp, Tcl_Interp *slaveInterp); -static void SlaveObjCmdDeleteProc(ClientData clientData); +static Tcl_CmdDeleteProc SlaveObjCmdDeleteProc; static int SlaveRecursionLimit(Tcl_Interp *interp, Tcl_Interp *slaveInterp, int objc, Tcl_Obj *const objv[]); @@ -525,7 +522,7 @@ TclInterpInit( static void InterpInfoDeleteProc( - ClientData dummy, /* Ignored. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp) /* Interp being deleted. All commands for * slave interps should already be deleted. */ { @@ -533,7 +530,6 @@ InterpInfoDeleteProc( Slave *slavePtr; Master *masterPtr; Target *targetPtr; - (void)dummy; interpInfoPtr = (InterpInfo *) ((Interp *) interp)->interpInfo; @@ -605,7 +601,7 @@ InterpInfoDeleteProc( /* ARGSUSED */ int Tcl_InterpObjCmd( - ClientData clientData, /* Unused. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -615,7 +611,7 @@ Tcl_InterpObjCmd( static int NRInterpCmd( - ClientData dummy, /* Unused. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -639,7 +635,6 @@ NRInterpCmd( OPT_INVOKEHID, OPT_LIMIT, OPT_MARKTRUSTED,OPT_RECLIMIT, OPT_SLAVES, OPT_SHARE, OPT_TARGET, OPT_TRANSFER }; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "cmd ?arg ...?"); @@ -4239,11 +4234,10 @@ DeleteScriptLimitCallback( static void CallScriptLimitCallback( ClientData clientData, - Tcl_Interp *dummy) /* Interpreter which failed the limit */ + TCL_UNUSED(Tcl_Interp *)) { ScriptLimitCallback *limitCBPtr = (ScriptLimitCallback *)clientData; int code; - (void)dummy; if (Tcl_InterpDeleted(limitCBPtr->interp)) { return; -- cgit v0.12 From a619fad748e59645edddc28028b34018cb9b3035 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 20:57:28 +0000 Subject: more --- generic/tclIO.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 3eca7cc..edb0f1e 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -201,7 +201,7 @@ static int FlushChannel(Tcl_Interp *interp, Channel *chanPtr, int calledFromAsyncFlush); static int TclGetsObjBinary(Tcl_Channel chan, Tcl_Obj *objPtr); static Tcl_Encoding GetBinaryEncoding(void); -static void FreeBinaryEncoding(ClientData clientData); +static Tcl_ExitProc FreeBinaryEncoding; static Tcl_HashTable * GetChannelTable(Tcl_Interp *interp); static int GetInput(Channel *chanPtr); static void PeekAhead(Channel *chanPtr, char **dstEndPtr, @@ -1515,12 +1515,11 @@ TclGetChannelFromObj( * channel was opened? Will contain an ORed * combination of TCL_READABLE and * TCL_WRITABLE, if non-NULL. */ - int flags) + TCL_UNUSED(int) /*flags*/) { ChannelState *statePtr; ResolvedChanName *resPtr = NULL; Tcl_Channel chan; - (void)flags; if (interp == NULL) { return TCL_ERROR; @@ -5228,10 +5227,9 @@ TclGetsObjBinary( static void FreeBinaryEncoding( - ClientData dummy) /* Not used */ + TCL_UNUSED(ClientData)) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if (tsdPtr->binaryEncoding != NULL) { Tcl_FreeEncoding(tsdPtr->binaryEncoding); @@ -8930,20 +8928,19 @@ CreateScriptRecord( void TclChannelEventScriptInvoker( ClientData clientData, /* The script+interp record. */ - int mask) /* Not used. */ + TCL_UNUSED(int) /*mask*/) { - Tcl_Interp *interp; /* Interpreter in which to eval the script. */ - Channel *chanPtr; /* The channel for which this handler is - * registered. */ - EventScriptRecord *esPtr; /* The event script + interpreter to eval it + EventScriptRecord *esPtr = (EventScriptRecord *)clientData; + /* The event script + interpreter to eval it * in. */ + Channel *chanPtr = esPtr->chanPtr; + /* The channel for which this handler is + * registered. */ + Tcl_Interp *interp = esPtr->interp; + /* Interpreter in which to eval the script. */ + int mask = esPtr->mask; int result; /* Result of call to eval script. */ - esPtr = (EventScriptRecord *)clientData; - chanPtr = esPtr->chanPtr; - mask = esPtr->mask; - interp = esPtr->interp; - /* * We must preserve the interpreter so we can report errors on it later. * Note that we do not need to preserve the channel because that is done @@ -8994,7 +8991,7 @@ TclChannelEventScriptInvoker( /* ARGSUSED */ int Tcl_FileEventObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter in which the channel for which * to create the handler is found. */ int objc, /* Number of arguments. */ @@ -9008,7 +9005,6 @@ Tcl_FileEventObjCmd( int mask; static const char *const modeOptions[] = {"readable", "writable", NULL}; static const int maskArray[] = {TCL_READABLE, TCL_WRITABLE}; - (void)dummy; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 1, objv, "channelId event ?script?"); -- cgit v0.12 From 81e31a16d82ff906b74f9b726637a3f146b77a4d Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 21:22:28 +0000 Subject: More unused arguments through the IO code. --- generic/tclIOCmd.c | 80 ++++++++++++++++++--------------------------------- generic/tclIORChan.c | 23 ++++++--------- generic/tclIORTrans.c | 15 ++++------ generic/tclIOUtil.c | 21 ++++---------- 4 files changed, 47 insertions(+), 92 deletions(-) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 70206be..916936b 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -36,18 +36,14 @@ static Tcl_ThreadDataKey dataKey; * Static functions for this file: */ -static void FinalizeIOCmdTSD(ClientData clientData); -static Tcl_TcpAcceptProc AcceptCallbackProc; -static int ChanPendingObjCmd(ClientData unused, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int ChanTruncateObjCmd(ClientData dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static void RegisterTcpServerInterpCleanup(Tcl_Interp *interp, - AcceptCallback *acceptCallbackPtr); -static void TcpAcceptCallbacksDeleteProc(ClientData clientData, - Tcl_Interp *interp); +static Tcl_ExitProc FinalizeIOCmdTSD; +static Tcl_TcpAcceptProc AcceptCallbackProc; +static Tcl_ObjCmdProc ChanPendingObjCmd; +static Tcl_ObjCmdProc ChanTruncateObjCmd; +static void RegisterTcpServerInterpCleanup( + Tcl_Interp *interp, + AcceptCallback *acceptCallbackPtr); +static Tcl_InterpDeleteProc TcpAcceptCallbacksDeleteProc; static void TcpServerCloseProc(ClientData callbackData); static void UnregisterTcpServerInterpCleanupProc( Tcl_Interp *interp, @@ -71,10 +67,9 @@ static void UnregisterTcpServerInterpCleanupProc( static void FinalizeIOCmdTSD( - ClientData dummy) /* Not used. */ + TCL_UNUSED(ClientData)) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if (tsdPtr->stdoutObjPtr != NULL) { Tcl_DecrRefCount(tsdPtr->stdoutObjPtr); @@ -103,7 +98,7 @@ FinalizeIOCmdTSD( /* ARGSUSED */ int Tcl_PutsObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -114,7 +109,6 @@ Tcl_PutsObjCmd( int newline; /* Add a newline at end? */ int result; /* Result of puts operation. */ int mode; /* Mode in which channel is opened. */ - (void)dummy; switch (objc) { case 2: /* [puts $x] */ @@ -231,7 +225,7 @@ Tcl_PutsObjCmd( /* ARGSUSED */ int Tcl_FlushObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -239,7 +233,6 @@ Tcl_FlushObjCmd( Tcl_Obj *chanObjPtr; Tcl_Channel chan; /* The channel to flush on. */ int mode; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "channelId"); @@ -297,7 +290,7 @@ Tcl_FlushObjCmd( /* ARGSUSED */ int Tcl_GetsObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -307,7 +300,6 @@ Tcl_GetsObjCmd( int mode; /* Mode in which channel is opened. */ Tcl_Obj *linePtr, *chanObjPtr; int code = TCL_OK; - (void)dummy; if ((objc != 2) && (objc != 3)) { Tcl_WrongNumArgs(interp, 1, objv, "channelId ?varName?"); @@ -383,7 +375,7 @@ Tcl_GetsObjCmd( /* ARGSUSED */ int Tcl_ReadObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -394,7 +386,6 @@ Tcl_ReadObjCmd( int charactersRead; /* How many characters were read? */ int mode; /* Mode in which channel is opened. */ Tcl_Obj *resultPtr, *chanObjPtr; - (void)dummy; if ((objc != 2) && (objc != 3)) { Interp *iPtr; @@ -528,7 +519,7 @@ Tcl_ReadObjCmd( /* ARGSUSED */ int Tcl_SeekObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -542,7 +533,6 @@ Tcl_SeekObjCmd( "start", "current", "end", NULL }; static const int modeArray[] = {SEEK_SET, SEEK_CUR, SEEK_END}; - (void)dummy; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 1, objv, "channelId offset ?origin?"); @@ -605,7 +595,7 @@ Tcl_SeekObjCmd( /* ARGSUSED */ int Tcl_TellObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -613,7 +603,6 @@ Tcl_TellObjCmd( Tcl_Channel chan; /* The channel to tell on. */ Tcl_WideInt newLoc; int code; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "channelId"); @@ -669,7 +658,7 @@ Tcl_TellObjCmd( /* ARGSUSED */ int Tcl_CloseObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -679,7 +668,6 @@ Tcl_CloseObjCmd( "read", "write", NULL }; static const int dirArray[] = {TCL_CLOSE_READ, TCL_CLOSE_WRITE}; - (void)dummy; if ((objc != 2) && (objc != 3)) { Tcl_WrongNumArgs(interp, 1, objv, "channelId ?direction?"); @@ -779,7 +767,7 @@ Tcl_CloseObjCmd( /* ARGSUSED */ int Tcl_FconfigureObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -787,7 +775,6 @@ Tcl_FconfigureObjCmd( const char *optionName, *valueName; Tcl_Channel chan; /* The channel to set a mode on. */ int i; /* Iterate over arg-value pairs. */ - (void)dummy; if ((objc < 2) || (((objc % 2) == 1) && (objc != 3))) { Tcl_WrongNumArgs(interp, 1, objv, "channelId ?-option value ...?"); @@ -856,13 +843,12 @@ Tcl_FconfigureObjCmd( /* ARGSUSED */ int Tcl_EofObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "channelId"); @@ -897,7 +883,7 @@ Tcl_EofObjCmd( /* ARGSUSED */ int Tcl_ExecObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -915,7 +901,6 @@ Tcl_ExecObjCmd( enum options { EXEC_IGNORESTDERR, EXEC_KEEPNEWLINE, EXEC_LAST }; - (void)dummy; /* * Check for any leading option arguments. @@ -1066,14 +1051,13 @@ Tcl_ExecObjCmd( /* ARGSUSED */ int Tcl_FblockedObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; int mode; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "channelId"); @@ -1114,7 +1098,7 @@ Tcl_FblockedObjCmd( /* ARGSUSED */ int Tcl_OpenObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1122,7 +1106,6 @@ Tcl_OpenObjCmd( int pipeline, prot; const char *modeString, *what; Tcl_Channel chan; - (void)dummy; if ((objc < 2) || (objc > 4)) { Tcl_WrongNumArgs(interp, 1, objv, "fileName ?access? ?permissions?"); @@ -1241,12 +1224,11 @@ static void TcpAcceptCallbacksDeleteProc( ClientData clientData, /* Data which was passed when the assocdata * was registered. */ - Tcl_Interp *dummy) /* Interpreter being deleted - not used. */ + TCL_UNUSED(Tcl_Interp *)) { Tcl_HashTable *hTblPtr = (Tcl_HashTable *)clientData; Tcl_HashEntry *hPtr; Tcl_HashSearch hSearch; - (void)dummy; for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch); hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) { @@ -1492,7 +1474,7 @@ TcpServerCloseProc( int Tcl_SocketObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1511,7 +1493,6 @@ Tcl_SocketObjCmd( const char *host, *port, *myaddr = NULL; Tcl_Obj *script = NULL; Tcl_Channel chan; - (void)dummy; if (TclpHasSockets(interp) != TCL_OK) { return TCL_ERROR; @@ -1735,7 +1716,7 @@ Tcl_SocketObjCmd( int Tcl_FcopyObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1746,7 +1727,6 @@ Tcl_FcopyObjCmd( Tcl_Obj *cmdPtr; static const char *const switches[] = { "-size", "-command", NULL }; enum { FcopySize, FcopyCommand }; - (void)dummy; if ((objc < 3) || (objc > 7) || (objc == 4) || (objc == 6)) { Tcl_WrongNumArgs(interp, 1, objv, @@ -1832,7 +1812,7 @@ Tcl_FcopyObjCmd( /* ARGSUSED */ static int ChanPendingObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1841,7 +1821,6 @@ ChanPendingObjCmd( int index, mode; static const char *const options[] = {"input", "output", NULL}; enum options {PENDING_INPUT, PENDING_OUTPUT}; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "mode channelId"); @@ -1895,14 +1874,13 @@ ChanPendingObjCmd( static int ChanTruncateObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; Tcl_WideInt length; - (void)dummy; if ((objc < 2) || (objc > 3)) { Tcl_WrongNumArgs(interp, 1, objv, "channelId ?length?"); @@ -1969,7 +1947,7 @@ ChanTruncateObjCmd( static int ChanPipeObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1977,7 +1955,6 @@ ChanPipeObjCmd( Tcl_Channel rchan, wchan; const char *channelNames[2]; Tcl_Obj *resultPtr; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); @@ -2021,12 +1998,11 @@ ChanPipeObjCmd( int TclChannelNamesCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; if (objc < 1 || objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?pattern?"); return TCL_ERROR; diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 42d1e8a..8a5675a 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -425,7 +425,7 @@ static void SrcExitProc(ClientData clientData); static void ForwardSetObjError(ForwardParam *p, Tcl_Obj *objPtr); static ReflectedChannelMap * GetThreadReflectedChannelMap(void); -static void DeleteThreadReflectedChannelMap(ClientData clientData); +static Tcl_ExitProc DeleteThreadReflectedChannelMap; #endif /* TCL_THREADS */ @@ -452,8 +452,7 @@ static int InvokeTclMethod(ReflectedChannel *rcPtr, Tcl_Obj *argTwoObj, Tcl_Obj **resultObjPtr); static ReflectedChannelMap * GetReflectedChannelMap(Tcl_Interp *interp); -static void DeleteReflectedChannelMap(ClientData clientData, - Tcl_Interp *interp); +static Tcl_InterpDeleteProc DeleteReflectedChannelMap; static int ErrnoReturn(ReflectedChannel *rcPtr, Tcl_Obj *resObj); static void MarkDead(ReflectedChannel *rcPtr); @@ -498,7 +497,7 @@ static const char *msg_dstlost = "-code 1 -level 0 -errorcode NONE -errorinfo int TclChanCreateObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -524,7 +523,6 @@ TclChanCreateObjCmd( * this interp. */ Tcl_HashEntry *hPtr; /* Entry in the above map */ int isNew; /* Placeholder. */ - (void)dummy; /* * Syntax: chan create MODE CMDPREFIX @@ -780,7 +778,7 @@ typedef struct { static int ReflectEventRun( Tcl_Event *ev, - int flags) + TCL_UNUSED(int) /*flags*/) { /* OWNER thread * @@ -790,7 +788,6 @@ ReflectEventRun( */ ReflectEvent *e = (ReflectEvent *) ev; - (void)flags; Tcl_NotifyChannel(e->rcPtr->chan, e->events); return 1; @@ -819,7 +816,7 @@ ReflectEventDelete( int TclChanPostEventObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -848,7 +845,6 @@ TclChanPostEventObjCmd( ReflectedChannelMap *rcmPtr;/* Map of reflected channels with handlers in * this interp. */ Tcl_HashEntry *hPtr; /* Entry in the above map */ - (void)dummy; /* * Number of arguments... @@ -2519,8 +2515,7 @@ GetReflectedChannelMap( if (rcmPtr == NULL) { rcmPtr = (ReflectedChannelMap *)ckalloc(sizeof(ReflectedChannelMap)); Tcl_InitHashTable(&rcmPtr->map, TCL_STRING_KEYS); - Tcl_SetAssocData(interp, RCMKEY, - (Tcl_InterpDeleteProc *) DeleteReflectedChannelMap, rcmPtr); + Tcl_SetAssocData(interp, RCMKEY, DeleteReflectedChannelMap, rcmPtr); } return rcmPtr; } @@ -2746,14 +2741,13 @@ GetThreadReflectedChannelMap(void) static void DeleteThreadReflectedChannelMap( - ClientData dummy) /* The per-thread data structure. */ + TCL_UNUSED(ClientData)) { Tcl_HashSearch hSearch; /* Search variable. */ Tcl_HashEntry *hPtr; /* Search variable. */ Tcl_ThreadId self = Tcl_GetCurrentThread(); ReflectedChannelMap *rcmPtr; /* The map */ ForwardingResult *resultPtr; - (void)dummy; /* * The origin thread for one or more reflected channels is gone. @@ -2971,7 +2965,7 @@ ForwardOpToHandlerThread( static int ForwardProc( Tcl_Event *evGPtr, - int mask) + TCL_UNUSED(int) /* mask */) { /* * HANDLER thread. @@ -3000,7 +2994,6 @@ ForwardProc( ReflectedChannelMap *rcmPtr;/* Map of reflected channels with handlers in * this interp. */ Tcl_HashEntry *hPtr; /* Entry in the above map */ - (void)mask; /* * Ignore the event if no one is waiting for its result anymore. diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 82fce33..9a82cdb 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -503,7 +503,7 @@ static int TransformLimit(ReflectedTransform *rtPtr, int TclChanPushObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -530,7 +530,6 @@ TclChanPushObjCmd( * in this interp. */ Tcl_HashEntry *hPtr; /* Entry in the above map */ int isNew; /* Placeholder. */ - (void)dummy; /* * Syntax: chan push CHANNEL CMDPREFIX @@ -749,7 +748,7 @@ TclChanPushObjCmd( int TclChanPopObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -767,7 +766,6 @@ TclChanPopObjCmd( const char *chanId; /* Tcl level channel handle */ Tcl_Channel chan; /* Channel associated to the handle */ int mode; /* Channel r/w mode */ - (void)dummy; /* * Number of arguments... @@ -1755,7 +1753,7 @@ static ReflectedTransform * NewReflectedTransform( Tcl_Interp *interp, Tcl_Obj *cmdpfxObj, - int mode, + TCL_UNUSED(int) /*mode*/, Tcl_Obj *handleObj, Tcl_Channel parentChan) { @@ -1763,7 +1761,6 @@ NewReflectedTransform( int listc; Tcl_Obj **listv; int i; - (void)mode; rtPtr = (ReflectedTransform *)ckalloc(sizeof(ReflectedTransform)); @@ -2311,14 +2308,13 @@ GetThreadReflectedTransformMap(void) static void DeleteThreadReflectedTransformMap( - ClientData dummy) /* The per-thread data structure. */ + TCL_UNUSED(ClientData)) { Tcl_HashSearch hSearch; /* Search variable. */ Tcl_HashEntry *hPtr; /* Search variable. */ Tcl_ThreadId self = Tcl_GetCurrentThread(); ReflectedTransformMap *rtmPtr; /* The map */ ForwardingResult *resultPtr; - (void)dummy; /* * The origin thread for one or more reflected channels is gone. @@ -2506,7 +2502,7 @@ ForwardOpToOwnerThread( static int ForwardProc( Tcl_Event *evGPtr, - int mask) + TCL_UNUSED(int) /*mask*/) { /* * Notes regarding access to the referenced data. @@ -2531,7 +2527,6 @@ ForwardProc( /* Map of reflected channels with handlers in * this interp. */ Tcl_HashEntry *hPtr; /* Entry in the above map */ - (void)mask; /* * Ignore the event if no one is waiting for its result anymore. diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 6179637..4a79962 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -1228,15 +1228,12 @@ FsAddMountsToGlobResult( void Tcl_FSMountsChanged( - const Tcl_Filesystem *fsPtr) -{ + TCL_UNUSED(const Tcl_Filesystem *) /*fsPtr*/) /* * fsPtr is currently unused. In the future it might invalidate files for * a particular filesystem, or take some other more advanced action. */ - - (void)fsPtr; - +{ /* * Increment the filesystem epoch to invalidate every existing cached * internal representation. @@ -2314,11 +2311,9 @@ Tcl_FSUtime( static const char *const * NativeFileAttrStrings( - Tcl_Obj *pathPtr, - Tcl_Obj **objPtrRef) + TCL_UNUSED(Tcl_Obj *), + TCL_UNUSED(Tcl_Obj **)) { - (void)pathPtr; - (void)objPtrRef; return tclpFileAttrStrings; } @@ -3020,14 +3015,11 @@ Tcl_FSLoadFile( Tcl_LoadHandle *handlePtr, /* A place to store the token for the loaded * object. Can be passed to * (*unloadProcPtr)() to unload the file. */ - Tcl_FSUnloadFileProc **unloadProcPtr) - /* A place to store a pointer to the function - * that unloads the object. */ + TCL_UNUSED(Tcl_FSUnloadFileProc **)) { const char *symbols[3]; void *procPtrs[2]; int res; - (void)unloadProcPtr; symbols[0] = sym1; symbols[1] = sym2; @@ -4686,10 +4678,9 @@ Tcl_FSPathSeparator( static Tcl_Obj * NativeFilesystemSeparator( - Tcl_Obj *pathPtr) + TCL_UNUSED(Tcl_Obj *) /*pathPtr*/) { const char *separator = NULL; /* lint */ - (void)pathPtr; switch (tclPlatform) { case TCL_PLATFORM_UNIX: -- cgit v0.12 From fa6d9198c094233c80a546ae164d9773fd2d6bf4 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 6 Mar 2020 23:44:14 +0000 Subject: more --- generic/tclLink.c | 12 ++-- generic/tclListObj.c | 8 +-- generic/tclLoad.c | 9 +-- generic/tclMain.c | 3 +- generic/tclNamesp.c | 163 +++++++++++++++++---------------------------------- 5 files changed, 66 insertions(+), 129 deletions(-) diff --git a/generic/tclLink.c b/generic/tclLink.c index 9ed7f51..23a0ebe 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -628,12 +628,11 @@ IsSpecial( static int SetInvalidRealFromAny( - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), Tcl_Obj *objPtr) { const char *str; const char *endPtr; - (void)dummy; str = TclGetString(objPtr); if ((objPtr->length == 1) && (str[0] == '.')) { @@ -746,8 +745,11 @@ static char * LinkTraceProc( ClientData clientData, /* Contains information about the link. */ Tcl_Interp *interp, /* Interpreter containing Tcl variable. */ - const char *name1, /* First part of variable name. */ - const char *name2, /* Second part of variable name. */ + TCL_UNUSED(const char *) /*name1*/, + TCL_UNUSED(const char *) /*name2*/, + /* Links can only be made to global variables, + * so we can find them with need to resolve + * caller-supplied name in caller context. */ int flags) /* Miscellaneous additional information. */ { Link *linkPtr = (Link *)clientData; @@ -763,8 +765,6 @@ LinkTraceProc( int objc; Tcl_Obj **objv; int i; - (void)name1; - (void)name2; /* * If the variable is being unset, then just re-create it (with a trace) diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 5de2eac..2877796 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -336,13 +336,9 @@ Tcl_Obj * Tcl_DbNewListObj( int objc, /* Count of objects referenced by objv. */ Tcl_Obj *const objv[], /* An array of pointers to Tcl objects. */ - const char *file, /* The name of the source file calling this - * function; used for debugging. */ - int line) /* Line number in the source file; used for - * debugging. */ + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) { - (void)file; - (void)line; return Tcl_NewListObj(objc, objv); } #endif /* TCL_MEM_DEBUG */ diff --git a/generic/tclLoad.c b/generic/tclLoad.c index d690902..738f65b 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -115,7 +115,7 @@ static void LoadCleanupProc(ClientData clientData, int Tcl_LoadObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -140,7 +140,6 @@ Tcl_LoadObjCmd( enum options { LOAD_GLOBAL, LOAD_LAZY, LOAD_LAST }; - (void)dummy; while (objc > 2) { if (TclGetString(objv[1])[0] != '-') { @@ -543,7 +542,7 @@ Tcl_LoadObjCmd( int Tcl_UnloadObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -563,7 +562,6 @@ Tcl_UnloadObjCmd( enum options { UNLOAD_NOCOMPLAIN, UNLOAD_KEEPLIB, UNLOAD_LAST }; - (void)dummy; for (i = 1; i < objc; i++) { if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, @@ -1154,10 +1152,9 @@ static void LoadCleanupProc( ClientData clientData, /* Pointer to first InterpPackage structure * for interp. */ - Tcl_Interp *dummy) /* Interpreter that is being deleted. */ + TCL_UNUSED(Tcl_Interp *)) { InterpPackage *ipPtr, *nextPtr; - (void)dummy; ipPtr = (InterpPackage *)clientData; while (ipPtr != NULL) { diff --git a/generic/tclMain.c b/generic/tclMain.c index b882afc..faa0d31 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -735,14 +735,13 @@ TclFullFinalizationRequested(void) static void StdinProc( ClientData clientData, /* The state of interactive cmd line */ - int mask) /* Not used. */ + TCL_UNUSED(int) /*mask*/) { int code, length; InteractiveState *isPtr = (InteractiveState *)clientData; Tcl_Channel chan = isPtr->input; Tcl_Obj *commandPtr = isPtr->commandPtr; Tcl_Interp *interp = isPtr->interp; - (void)mask; if (Tcl_IsShared(commandPtr)) { Tcl_DecrRefCount(commandPtr); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 14cea8b..c39c48b 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -92,47 +92,27 @@ static int GetNamespaceFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr); static int InvokeImportedNRCmd(ClientData clientData, Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]); -static int NamespaceChildrenCmd(ClientData dummy, - Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]); -static int NamespaceCodeCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int NamespaceCurrentCmd(ClientData dummy, - Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]); -static int NamespaceDeleteCmd(ClientData dummy,Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int NamespaceEvalCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int NRNamespaceEvalCmd(ClientData dummy, - Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]); -static int NamespaceExistsCmd(ClientData dummy,Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int NamespaceExportCmd(ClientData dummy,Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int NamespaceForgetCmd(ClientData dummy,Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc NamespaceChildrenCmd; +static Tcl_ObjCmdProc NamespaceCodeCmd; +static Tcl_ObjCmdProc NamespaceCurrentCmd; +static Tcl_ObjCmdProc NamespaceDeleteCmd; +static Tcl_ObjCmdProc NamespaceEvalCmd; +static Tcl_ObjCmdProc NRNamespaceEvalCmd; +static Tcl_ObjCmdProc NamespaceExistsCmd; +static Tcl_ObjCmdProc NamespaceExportCmd; +static Tcl_ObjCmdProc NamespaceForgetCmd; static void NamespaceFree(Namespace *nsPtr); -static int NamespaceImportCmd(ClientData dummy,Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int NamespaceInscopeCmd(ClientData dummy, - Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]); -static int NRNamespaceInscopeCmd(ClientData dummy, - Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]); -static int NamespaceOriginCmd(ClientData dummy,Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int NamespaceParentCmd(ClientData dummy,Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int NamespacePathCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int NamespaceQualifiersCmd(ClientData dummy, - Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]); -static int NamespaceTailCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int NamespaceUpvarCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int NamespaceUnknownCmd(ClientData dummy, - Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]); -static int NamespaceWhichCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc NamespaceImportCmd; +static Tcl_ObjCmdProc NamespaceInscopeCmd; +static Tcl_ObjCmdProc NRNamespaceInscopeCmd; +static Tcl_ObjCmdProc NamespaceOriginCmd; +static Tcl_ObjCmdProc NamespaceParentCmd; +static Tcl_ObjCmdProc NamespacePathCmd; +static Tcl_ObjCmdProc NamespaceQualifiersCmd; +static Tcl_ObjCmdProc NamespaceTailCmd; +static Tcl_ObjCmdProc NamespaceUpvarCmd; +static Tcl_ObjCmdProc NamespaceUnknownCmd; +static Tcl_ObjCmdProc NamespaceWhichCmd; static int SetNsNameFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static void UnlinkNsPath(Namespace *nsPtr); @@ -514,16 +494,12 @@ TclPopStackFrame( static char * EstablishErrorCodeTraces( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, - const char *name1, - const char *name2, - int flags) + TCL_UNUSED(const char *) /*name1*/, + TCL_UNUSED(const char *) /*name2*/, + TCL_UNUSED(int) /*flags*/) { - (void)dummy; - (void)name1; - (void)name2; - (void)flags; Tcl_TraceVar2(interp, "errorCode", NULL, TCL_GLOBAL_ONLY|TCL_TRACE_READS, ErrorCodeRead, NULL); Tcl_TraceVar2(interp, "errorCode", NULL, TCL_GLOBAL_ONLY|TCL_TRACE_UNSETS, @@ -550,17 +526,13 @@ EstablishErrorCodeTraces( static char * ErrorCodeRead( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, - const char *name1, - const char *name2, - int flags) + TCL_UNUSED(const char *) /*name1*/, + TCL_UNUSED(const char *) /*name2*/, + TCL_UNUSED(int) /*flags*/) { Interp *iPtr = (Interp *) interp; - (void)dummy; - (void)name1; - (void)name2; - (void)flags; if (Tcl_InterpDeleted(interp) || !(iPtr->flags & ERR_LEGACY_COPY)) { return NULL; @@ -596,17 +568,12 @@ ErrorCodeRead( static char * EstablishErrorInfoTraces( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, - const char *name1, - const char *name2, - int flags) + TCL_UNUSED(const char *) /*name1*/, + TCL_UNUSED(const char *) /*name2*/, + TCL_UNUSED(int) /*flags*/) { - (void)dummy; - (void)name1; - (void)name2; - (void)flags; - Tcl_TraceVar2(interp, "errorInfo", NULL, TCL_GLOBAL_ONLY|TCL_TRACE_READS, ErrorInfoRead, NULL); Tcl_TraceVar2(interp, "errorInfo", NULL, TCL_GLOBAL_ONLY|TCL_TRACE_UNSETS, @@ -633,17 +600,13 @@ EstablishErrorInfoTraces( static char * ErrorInfoRead( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, - const char *name1, - const char *name2, - int flags) + TCL_UNUSED(const char *) /*name1*/, + TCL_UNUSED(const char *) /*name2*/, + TCL_UNUSED(int) /*flags*/) { Interp *iPtr = (Interp *) interp; - (void)dummy; - (void)name1; - (void)name2; - (void)flags; if (Tcl_InterpDeleted(interp) || !(iPtr->flags & ERR_LEGACY_COPY)) { return NULL; @@ -3015,7 +2978,7 @@ TclInitNamespaceCmd( static int NamespaceChildrenCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3028,7 +2991,6 @@ NamespaceChildrenCmd( Tcl_HashEntry *entryPtr; Tcl_HashSearch search; Tcl_Obj *listPtr, *elemPtr; - (void)dummy; /* * Get a pointer to the specified namespace, or the current namespace. @@ -3145,7 +3107,7 @@ NamespaceChildrenCmd( static int NamespaceCodeCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3154,7 +3116,6 @@ NamespaceCodeCmd( Tcl_Obj *listPtr, *objPtr; const char *arg; int length; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "arg"); @@ -3227,13 +3188,12 @@ NamespaceCodeCmd( static int NamespaceCurrentCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Namespace *currNsPtr; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -3291,7 +3251,7 @@ NamespaceCurrentCmd( static int NamespaceDeleteCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3299,7 +3259,6 @@ NamespaceDeleteCmd( Tcl_Namespace *namespacePtr; const char *name; int i; - (void)dummy; if (objc < 1) { Tcl_WrongNumArgs(interp, 1, objv, "?name name...?"); @@ -3380,7 +3339,7 @@ NamespaceEvalCmd( static int NRNamespaceEvalCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3392,7 +3351,6 @@ NRNamespaceEvalCmd( CallFrame *framePtr, **framePtrPtr; Tcl_Obj *objPtr; int result; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "name arg ?arg...?"); @@ -3513,13 +3471,12 @@ NsEval_Callback( static int NamespaceExistsCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Namespace *namespacePtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -3569,13 +3526,12 @@ NamespaceExistsCmd( static int NamespaceExportCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int firstArg, i; - (void)dummy; if (objc < 1) { Tcl_WrongNumArgs(interp, 1, objv, "?-clear? ?pattern pattern...?"); @@ -3651,14 +3607,13 @@ NamespaceExportCmd( static int NamespaceForgetCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *pattern; int i, result; - (void)dummy; if (objc < 1) { Tcl_WrongNumArgs(interp, 1, objv, "?pattern pattern...?"); @@ -3717,7 +3672,7 @@ NamespaceForgetCmd( static int NamespaceImportCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3726,7 +3681,6 @@ NamespaceImportCmd( const char *string, *pattern; int i, result; int firstArg; - (void)dummy; if (objc < 1) { Tcl_WrongNumArgs(interp, 1, objv, "?-force? ?pattern pattern...?"); @@ -3833,7 +3787,7 @@ NamespaceInscopeCmd( static int NRNamespaceInscopeCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3842,7 +3796,6 @@ NRNamespaceInscopeCmd( CallFrame *framePtr, **framePtrPtr; int i; Tcl_Obj *cmdObjPtr; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "name arg ?arg...?"); @@ -3931,14 +3884,13 @@ NRNamespaceInscopeCmd( static int NamespaceOriginCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Command command, origCommand; Tcl_Obj *resultPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); @@ -3993,13 +3945,12 @@ NamespaceOriginCmd( static int NamespaceParentCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Namespace *nsPtr; - (void)dummy; if (objc == 1) { nsPtr = TclGetCurrentNamespace(interp); @@ -4052,7 +4003,7 @@ NamespaceParentCmd( static int NamespacePathCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -4061,7 +4012,6 @@ NamespacePathCmd( int i, nsObjc, result = TCL_ERROR; Tcl_Obj **nsObjv; Tcl_Namespace **namespaceList = NULL; - (void)dummy; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?pathList?"); @@ -4278,14 +4228,13 @@ TclInvalidateNsPath( static int NamespaceQualifiersCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *name, *p; int length; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "string"); @@ -4347,7 +4296,7 @@ NamespaceQualifiersCmd( static int NamespaceUnknownCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -4355,7 +4304,6 @@ NamespaceUnknownCmd( Tcl_Namespace *currNsPtr; Tcl_Obj *resultPtr; int rc; - (void)dummy; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?script?"); @@ -4535,13 +4483,12 @@ Tcl_SetNamespaceUnknownHandler( static int NamespaceTailCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *name, *p; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "string"); @@ -4594,7 +4541,7 @@ NamespaceTailCmd( static int NamespaceUpvarCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -4603,7 +4550,6 @@ NamespaceUpvarCmd( Tcl_Namespace *nsPtr, *savedNsPtr; Var *otherPtr, *arrayPtr; const char *myName; - (void)dummy; if (objc < 2 || (objc & 1)) { Tcl_WrongNumArgs(interp, 1, objv, "ns ?otherVar myVar ...?"); @@ -4669,7 +4615,7 @@ NamespaceUpvarCmd( static int NamespaceWhichCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -4679,7 +4625,6 @@ NamespaceWhichCmd( }; int lookupType = 0; Tcl_Obj *resultPtr; - (void)dummy; if (objc < 2 || objc > 3) { badArgs: -- cgit v0.12 From b8ffa18096ee9a37d5105ec6c48c0b6eeea7dbc4 Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 7 Mar 2020 00:41:42 +0000 Subject: Unused arguments in the OO source code files. --- generic/tclOO.c | 30 ++++++------------ generic/tclOOBasic.c | 39 ++++++++--------------- generic/tclOOCall.c | 9 ++---- generic/tclOODefineCmds.c | 72 ++++++++++++++--------------------------- generic/tclOOInfo.c | 81 ++++++++++++++++------------------------------- generic/tclOOMethod.c | 54 ++++++++++++------------------- 6 files changed, 98 insertions(+), 187 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index 2d09f3a..322daff 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -77,13 +77,10 @@ static inline void InitClassPath(Tcl_Interp * interp, Class *clsPtr); static void InitClassSystemRoots(Tcl_Interp *interp, Foundation *fPtr); static int InitFoundation(Tcl_Interp *interp); -static void KillFoundation(ClientData clientData, - Tcl_Interp *interp); +static Tcl_InterpDeleteProc KillFoundation; static void MyDeleted(ClientData clientData); static void ObjectNamespaceDeleted(ClientData clientData); -static void ObjectRenamedTrace(ClientData clientData, - Tcl_Interp *interp, const char *oldName, - const char *newName, int flags); +static Tcl_CommandTraceProc ObjectRenamedTrace; static inline void RemoveClass(Class **list, int num, int idx); static inline void RemoveObject(Object **list, int num, int idx); static inline void SquelchCachedName(Object *oPtr); @@ -569,13 +566,11 @@ DeletedHelpersNamespace( static void KillFoundation( - ClientData dummy, /* Pointer to the OO system foundation - * structure. */ - Tcl_Interp *interp) /* The interpreter containing the OO system - * foundation. */ + TCL_UNUSED(ClientData), + Tcl_Interp *interp) /* The interpreter containing the OO system + * foundation. */ { Foundation *fPtr = GetFoundation(interp); - (void)dummy; TclDecrRefCount(fPtr->unknownMethodNameObj); TclDecrRefCount(fPtr->constructorName); @@ -819,15 +814,12 @@ MyClassDeleted( static void ObjectRenamedTrace( ClientData clientData, /* The object being deleted. */ - Tcl_Interp *interp, /* The interpreter containing the object. */ - const char *oldName, /* What the object was (last) called. */ - const char *newName, /* What it's getting renamed to. (unused) */ + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(const char *) /*oldName*/, + TCL_UNUSED(const char *) /*newName*/, int flags) /* Why was the object deleted? */ { Object *oPtr = (Object *)clientData; - (void)interp; - (void)oldName; - (void)newName; /* * If this is a rename and not a delete of the object, we just flush the @@ -2765,10 +2757,9 @@ TclOOObjectCmdCore( static int FinalizeObjectCall( ClientData data[], - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), int result) { - (void)dummy; /* * Dispose of the call chain, which drops the lock on the object's * structure. @@ -2927,11 +2918,10 @@ TclNRObjectContextInvokeNext( static int FinalizeNext( ClientData data[], - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), int result) { CallContext *contextPtr = (CallContext *)data[0]; - (void)dummy; /* * Restore the call chain context index as we've finished the inner invoke diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index 5420c80..9f7b526 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -76,7 +76,7 @@ FinalizeConstruction( int TclOO_Class_Constructor( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -84,7 +84,6 @@ TclOO_Class_Constructor( { Object *oPtr = (Object *) Tcl_ObjectContextObject(context); Tcl_Obj **invoke, *nameObj; - (void)dummy; if (objc-1 > Tcl_ObjectContextSkippedArgs(context)) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -175,7 +174,7 @@ DecrRefsPostClassConstructor( int TclOO_Class_Create( - ClientData dummy, /* Ignored. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter in which to create the object; * also used for error reporting. */ Tcl_ObjectContext context, /* The object/call context. */ @@ -185,7 +184,6 @@ TclOO_Class_Create( Object *oPtr = (Object *) Tcl_ObjectContextObject(context); const char *objName; int len; - (void)dummy; /* * Sanity check; should not be possible to invoke this method on a @@ -241,7 +239,7 @@ TclOO_Class_Create( int TclOO_Class_CreateNs( - ClientData dummy, /* Ignored. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter in which to create the object; * also used for error reporting. */ Tcl_ObjectContext context, /* The object/call context. */ @@ -251,7 +249,6 @@ TclOO_Class_CreateNs( Object *oPtr = (Object *) Tcl_ObjectContextObject(context); const char *objName, *nsName; int len; - (void)dummy; /* * Sanity check; should not be possible to invoke this method on a @@ -315,7 +312,7 @@ TclOO_Class_CreateNs( int TclOO_Class_New( - ClientData dummy, /* Ignored. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter in which to create the object; * also used for error reporting. */ Tcl_ObjectContext context, /* The object/call context. */ @@ -323,7 +320,6 @@ TclOO_Class_New( Tcl_Obj *const *objv) /* The actual arguments. */ { Object *oPtr = (Object *) Tcl_ObjectContextObject(context); - (void)dummy; /* * Sanity check; should not be possible to invoke this method on a @@ -360,7 +356,7 @@ TclOO_Class_New( int TclOO_Object_Destroy( - ClientData dummy, /* Ignored. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter in which to create the object; * also used for error reporting. */ Tcl_ObjectContext context, /* The object/call context. */ @@ -369,7 +365,6 @@ TclOO_Object_Destroy( { Object *oPtr = (Object *) Tcl_ObjectContextObject(context); CallContext *contextPtr; - (void)dummy; if (objc != Tcl_ObjectContextSkippedArgs(context)) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -422,7 +417,7 @@ AfterNRDestructor( int TclOO_Object_Eval( - ClientData dummy, /* Ignored. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter in which to create the object; * also used for error reporting. */ Tcl_ObjectContext context, /* The object/call context. */ @@ -435,7 +430,6 @@ TclOO_Object_Eval( CallFrame *framePtr, **framePtrPtr = &framePtr; Tcl_Obj *scriptPtr; CmdFrame *invoker; - (void)dummy; if (objc-1 < skip) { Tcl_WrongNumArgs(interp, skip, objv, "arg ?arg ...?"); @@ -524,7 +518,7 @@ FinalizeEval( int TclOO_Object_Unknown( - ClientData dummy, /* Ignored. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter in which to create the object; * also used for error reporting. */ Tcl_ObjectContext context, /* The object/call context. */ @@ -539,7 +533,6 @@ TclOO_Object_Unknown( int numMethodNames, i, skip = Tcl_ObjectContextSkippedArgs(context); CallFrame *framePtr = ((Interp *) interp)->varFramePtr; Tcl_Obj *errorMsg; - (void)dummy; /* * If no method name, generate an error asking for a method name. (Only by @@ -631,7 +624,7 @@ TclOO_Object_Unknown( int TclOO_Object_LinkVar( - ClientData dummy, /* Ignored. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter in which to create the object; * also used for error reporting. */ Tcl_ObjectContext context, /* The object/call context. */ @@ -642,7 +635,6 @@ TclOO_Object_LinkVar( Tcl_Object object = Tcl_ObjectContextObject(context); Namespace *savedNsPtr; int i; - (void)dummy; if (objc-Tcl_ObjectContextSkippedArgs(context) < 0) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -734,7 +726,7 @@ TclOO_Object_LinkVar( int TclOO_Object_VarName( - ClientData dummy, /* Ignored. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter in which to create the object; * also used for error reporting. */ Tcl_ObjectContext context, /* The object/call context. */ @@ -745,7 +737,6 @@ TclOO_Object_VarName( Tcl_Obj *varNamePtr, *argPtr; CallFrame *framePtr = ((Interp *) interp)->varFramePtr; const char *arg; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context)+1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -873,7 +864,7 @@ TclOO_Object_VarName( int TclOONextObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -881,7 +872,6 @@ TclOONextObjCmd( Interp *iPtr = (Interp *) interp; CallFrame *framePtr = iPtr->varFramePtr; Tcl_ObjectContext context; - (void)dummy; /* * Start with sanity checks on the calling context to make sure that we @@ -910,7 +900,7 @@ TclOONextObjCmd( int TclOONextToObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -922,7 +912,6 @@ TclOONextToObjCmd( int i; Tcl_Object object; const char *methodType; - (void)dummy; /* * Start with sanity checks on the calling context to make sure that we @@ -1044,7 +1033,7 @@ NextRestoreFrame( int TclOOSelfObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -1062,7 +1051,6 @@ TclOOSelfObjCmd( CallContext *contextPtr; Tcl_Obj *result[3]; int index; - (void)dummy; #define CurrentlyInvoked(contextPtr) \ ((contextPtr)->callPtr->chain[(contextPtr)->index]) @@ -1282,13 +1270,12 @@ TclOOSelfObjCmd( int TclOOCopyObjectCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Tcl_Object oPtr, o2Ptr; - (void)dummy; if (objc < 2 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index 41f5334..9191989 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -376,11 +376,10 @@ TclOOInvokeContext( static int SetFilterFlags( ClientData data[], - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), int result) { CallContext *contextPtr = (CallContext *)data[0]; - (void)dummy; contextPtr->oPtr->flags |= FILTER_HANDLING; return result; @@ -389,11 +388,10 @@ SetFilterFlags( static int ResetFilterFlags( ClientData data[], - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), int result) { CallContext *contextPtr = (CallContext *)data[0]; - (void)dummy; contextPtr->oPtr->flags &= ~FILTER_HANDLING; return result; @@ -402,12 +400,11 @@ ResetFilterFlags( static int FinalizeMethodRefs( ClientData data[], - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), int result) { CallContext *contextPtr = (CallContext *)data[0]; int i; - (void)dummy; for (i = 0 ; i < contextPtr->callPtr->numChain ; i++) { TclOODelMethodRef(contextPtr->callPtr->chain[i].mPtr); diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index 14ec496..76cf4ed 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -695,7 +695,7 @@ RenameDeleteMethod( int TclOOUnknownDefinition( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -705,7 +705,6 @@ TclOOUnknownDefinition( Tcl_HashEntry *hPtr; int soughtLen; const char *soughtStr, *matchedStr = NULL; - (void)dummy; if (objc < 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -1093,7 +1092,7 @@ MagicDefinitionInvoke( int TclOODefineObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -1101,7 +1100,6 @@ TclOODefineObjCmd( Tcl_Namespace *nsPtr; Object *oPtr; int result; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "className arg ?arg ...?"); @@ -1170,7 +1168,7 @@ TclOODefineObjCmd( int TclOOObjDefObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -1178,7 +1176,6 @@ TclOOObjDefObjCmd( Tcl_Namespace *nsPtr; Object *oPtr; int result; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "objectName arg ?arg ...?"); @@ -1240,7 +1237,7 @@ TclOOObjDefObjCmd( int TclOODefineSelfObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -1248,7 +1245,6 @@ TclOODefineSelfObjCmd( Tcl_Namespace *nsPtr; Object *oPtr; int result, isPrivate; - (void)dummy; oPtr = (Object *) TclOOGetDefineCmdContext(interp); if (oPtr == NULL) { @@ -1312,13 +1308,12 @@ TclOODefineSelfObjCmd( int TclOODefineObjSelfObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { Object *oPtr; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -1420,7 +1415,7 @@ TclOODefinePrivateObjCmd( int TclOODefineClassObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -1429,7 +1424,6 @@ TclOODefineClassObjCmd( Class *clsPtr; Foundation *fPtr = TclOOGetFoundation(interp); int wasClass, willBeClass; - (void)dummy; /* * Parse the context to get the object to operate on. @@ -1530,7 +1524,7 @@ TclOODefineClassObjCmd( int TclOODefineConstructorObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -1539,7 +1533,6 @@ TclOODefineConstructorObjCmd( Class *clsPtr; Tcl_Method method; int bodyLength; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "arguments body"); @@ -1600,7 +1593,7 @@ TclOODefineConstructorObjCmd( int TclOODefineDefnNsObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -1614,7 +1607,6 @@ TclOODefineDefnNsObjCmd( Object *oPtr; Tcl_Namespace *nsPtr; Tcl_Obj *nsNamePtr, **storagePtr; - (void)dummy; oPtr = (Object *) TclOOGetDefineCmdContext(interp); if (oPtr == NULL) { @@ -1743,7 +1735,7 @@ TclOODefineDeleteMethodObjCmd( int TclOODefineDestructorObjCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -1752,7 +1744,6 @@ TclOODefineDestructorObjCmd( Class *clsPtr; Tcl_Method method; int bodyLength; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "body"); @@ -2323,7 +2314,7 @@ TclOODefineSlots( static int ClassFilterGet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2332,7 +2323,6 @@ ClassFilterGet( Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); Tcl_Obj *resultObj, *filterObj; int i; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2358,7 +2348,7 @@ ClassFilterGet( static int ClassFilterSet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2367,7 +2357,6 @@ ClassFilterSet( Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); int filterc; Tcl_Obj **filterv; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2405,7 +2394,7 @@ ClassFilterSet( static int ClassMixinGet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2415,7 +2404,6 @@ ClassMixinGet( Tcl_Obj *resultObj; Class *mixinPtr; int i; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2443,7 +2431,7 @@ ClassMixinGet( static int ClassMixinSet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2453,7 +2441,6 @@ ClassMixinSet( int mixinc, i; Tcl_Obj **mixinv; Class **mixins; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2513,7 +2500,7 @@ ClassMixinSet( static int ClassSuperGet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2523,7 +2510,6 @@ ClassSuperGet( Tcl_Obj *resultObj; Class *superPtr; int i; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2550,7 +2536,7 @@ ClassSuperGet( static int ClassSuperSet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2560,7 +2546,6 @@ ClassSuperSet( int superc, i, j; Tcl_Obj **superv; Class **superclasses, *superPtr; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2682,7 +2667,7 @@ ClassSuperSet( static int ClassVarsGet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2691,7 +2676,6 @@ ClassVarsGet( Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); Tcl_Obj *resultObj; int i; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2727,7 +2711,7 @@ ClassVarsGet( static int ClassVarsSet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2737,7 +2721,6 @@ ClassVarsSet( int varc; Tcl_Obj **varv; int i; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2799,7 +2782,7 @@ ClassVarsSet( static int ObjFilterGet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2808,7 +2791,6 @@ ObjFilterGet( Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); Tcl_Obj *resultObj, *filterObj; int i; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2828,7 +2810,7 @@ ObjFilterGet( static int ObjFilterSet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2837,7 +2819,6 @@ ObjFilterSet( Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); int filterc; Tcl_Obj **filterv; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2869,7 +2850,7 @@ ObjFilterSet( static int ObjMixinGet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2879,7 +2860,6 @@ ObjMixinGet( Tcl_Obj *resultObj; Class *mixinPtr; int i; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2902,7 +2882,7 @@ ObjMixinGet( static int ObjMixinSet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2913,7 +2893,6 @@ ObjMixinSet( Tcl_Obj **mixinv; Class **mixins; int i; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2957,7 +2936,7 @@ ObjMixinSet( static int ObjVarsGet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -2966,7 +2945,6 @@ ObjVarsGet( Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); Tcl_Obj *resultObj; int i; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -2996,7 +2974,7 @@ ObjVarsGet( static int ObjVarsSet( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -3005,7 +2983,6 @@ ObjVarsSet( Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); int varc, i; Tcl_Obj **varv; - (void)dummy; if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, @@ -3062,7 +3039,7 @@ ObjVarsSet( static int ResolveClass( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, Tcl_ObjectContext context, int objc, @@ -3071,7 +3048,6 @@ ResolveClass( int idx = Tcl_ObjectContextSkippedArgs(context); Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); Class *clsPtr; - (void)dummy; /* * Check if were called wrongly. The definition context isn't used... diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c index 580a8d5..3758d55 100644 --- a/generic/tclOOInfo.c +++ b/generic/tclOOInfo.c @@ -171,13 +171,12 @@ GetClassFromObj( static int InfoObjectClassCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Object *oPtr; - (void)dummy; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "objName ?className?"); @@ -229,7 +228,7 @@ InfoObjectClassCmd( static int InfoObjectDefnCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -239,7 +238,6 @@ InfoObjectDefnCmd( Proc *procPtr; CompiledLocal *localPtr; Tcl_Obj *resultObjs[2]; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "objName methodName"); @@ -304,7 +302,7 @@ InfoObjectDefnCmd( static int InfoObjectFiltersCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -312,7 +310,6 @@ InfoObjectFiltersCmd( int i; Tcl_Obj *filterObj, *resultObj; Object *oPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "objName"); @@ -344,7 +341,7 @@ InfoObjectFiltersCmd( static int InfoObjectForwardCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -352,7 +349,6 @@ InfoObjectForwardCmd( Object *oPtr; Tcl_HashEntry *hPtr; Tcl_Obj *prefixObj; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "objName methodName"); @@ -402,7 +398,7 @@ InfoObjectForwardCmd( static int InfoObjectIsACmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -415,7 +411,6 @@ InfoObjectIsACmd( }; Object *oPtr, *o2Ptr; int idx, i, result = 0; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "category objName ?arg ...?"); @@ -522,7 +517,7 @@ InfoObjectIsACmd( static int InfoObjectMethodsCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -545,7 +540,6 @@ InfoObjectMethodsCmd( SCOPE_PRIVATE, SCOPE_PUBLIC, SCOPE_UNEXPORTED, SCOPE_LOCALPRIVATE }; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "objName ?-option value ...?"); @@ -643,7 +637,7 @@ InfoObjectMethodsCmd( static int InfoObjectMethodTypeCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -651,7 +645,6 @@ InfoObjectMethodTypeCmd( Object *oPtr; Tcl_HashEntry *hPtr; Method *mPtr; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "objName methodName"); @@ -701,7 +694,7 @@ InfoObjectMethodTypeCmd( static int InfoObjectMixinsCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -710,7 +703,6 @@ InfoObjectMixinsCmd( Object *oPtr; Tcl_Obj *resultObj; int i; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "objName"); @@ -745,13 +737,12 @@ InfoObjectMixinsCmd( static int InfoObjectIdCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Object *oPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "objName"); @@ -778,13 +769,12 @@ InfoObjectIdCmd( static int InfoObjectNsCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Object *oPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "objName"); @@ -812,7 +802,7 @@ InfoObjectNsCmd( static int InfoObjectVariablesCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -820,7 +810,6 @@ InfoObjectVariablesCmd( Object *oPtr; Tcl_Obj *resultObj; int i, isPrivate = 0; - (void)dummy; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "objName ?-private?"); @@ -867,7 +856,7 @@ InfoObjectVariablesCmd( static int InfoObjectVarsCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -877,7 +866,6 @@ InfoObjectVarsCmd( FOREACH_HASH_DECLS; VarInHash *vihPtr; Tcl_Obj *nameObj, *resultObj; - (void)dummy; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "objName ?pattern?"); @@ -929,7 +917,7 @@ InfoObjectVarsCmd( static int InfoClassConstrCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -938,7 +926,6 @@ InfoClassConstrCmd( CompiledLocal *localPtr; Tcl_Obj *resultObjs[2]; Class *clsPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "className"); @@ -991,7 +978,7 @@ InfoClassConstrCmd( static int InfoClassDefnCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1001,7 +988,6 @@ InfoClassDefnCmd( CompiledLocal *localPtr; Tcl_Obj *resultObjs[2]; Class *clsPtr; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "className methodName"); @@ -1060,7 +1046,7 @@ InfoClassDefnCmd( static int InfoClassDefnNsCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1073,7 +1059,6 @@ InfoClassDefnNsCmd( int kind = 0; Tcl_Obj *nsNamePtr; Class *clsPtr; - (void)dummy; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "className ?kind?"); @@ -1111,14 +1096,13 @@ InfoClassDefnNsCmd( static int InfoClassDestrCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Proc *procPtr; Class *clsPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "className"); @@ -1156,7 +1140,7 @@ InfoClassDestrCmd( static int InfoClassFiltersCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1164,7 +1148,6 @@ InfoClassFiltersCmd( int i; Tcl_Obj *filterObj, *resultObj; Class *clsPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "className"); @@ -1195,7 +1178,7 @@ InfoClassFiltersCmd( static int InfoClassForwardCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1203,7 +1186,6 @@ InfoClassForwardCmd( Tcl_HashEntry *hPtr; Tcl_Obj *prefixObj; Class *clsPtr; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "className methodName"); @@ -1247,7 +1229,7 @@ InfoClassForwardCmd( static int InfoClassInstancesCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1257,7 +1239,6 @@ InfoClassInstancesCmd( int i; const char *pattern = NULL; Tcl_Obj *resultObj; - (void)dummy; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "className ?pattern?"); @@ -1296,7 +1277,7 @@ InfoClassInstancesCmd( static int InfoClassMethodsCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1317,7 +1298,6 @@ InfoClassMethodsCmd( enum Scopes { SCOPE_PRIVATE, SCOPE_PUBLIC, SCOPE_UNEXPORTED }; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "className ?-option value ...?"); @@ -1413,7 +1393,7 @@ InfoClassMethodsCmd( static int InfoClassMethodTypeCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1421,7 +1401,6 @@ InfoClassMethodTypeCmd( Tcl_HashEntry *hPtr; Method *mPtr; Class *clsPtr; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "className methodName"); @@ -1466,7 +1445,7 @@ InfoClassMethodTypeCmd( static int InfoClassMixinsCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1474,7 +1453,6 @@ InfoClassMixinsCmd( Class *clsPtr, *mixinPtr; Tcl_Obj *resultObj; int i; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "className"); @@ -1509,7 +1487,7 @@ InfoClassMixinsCmd( static int InfoClassSubsCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1518,7 +1496,6 @@ InfoClassSubsCmd( Tcl_Obj *resultObj; int i; const char *pattern = NULL; - (void)dummy; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "className ?pattern?"); @@ -1565,7 +1542,7 @@ InfoClassSubsCmd( static int InfoClassSupersCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1573,7 +1550,6 @@ InfoClassSupersCmd( Class *clsPtr, *superPtr; Tcl_Obj *resultObj; int i; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "className"); @@ -1605,7 +1581,7 @@ InfoClassSupersCmd( static int InfoClassVariablesCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1613,7 +1589,6 @@ InfoClassVariablesCmd( Class *clsPtr; Tcl_Obj *resultObj; int i, isPrivate = 0; - (void)dummy; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "className ?-private?"); @@ -1660,14 +1635,13 @@ InfoClassVariablesCmd( static int InfoObjectCallCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Object *oPtr; CallContext *contextPtr; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "objName methodName"); @@ -1707,14 +1681,13 @@ InfoObjectCallCmd( static int InfoClassCallCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Class *clsPtr; CallChain *callPtr; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "className methodName"); diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index 01e2c00..b1b3d8e 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -80,12 +80,9 @@ static void DeleteProcedureMethodRecord(ProcedureMethod *pmPtr); static void DeleteProcedureMethod(void *clientData); static int CloneProcedureMethod(Tcl_Interp *interp, void *clientData, void **newClientData); -static void MethodErrorHandler(Tcl_Interp *interp, - Tcl_Obj *procNameObj); -static void ConstructorErrorHandler(Tcl_Interp *interp, - Tcl_Obj *procNameObj); -static void DestructorErrorHandler(Tcl_Interp *interp, - Tcl_Obj *procNameObj); +static ProcErrorProc MethodErrorHandler; +static ProcErrorProc ConstructorErrorHandler; +static ProcErrorProc DestructorErrorHandler; static Tcl_Obj * RenderDeclarerName(void *clientData); static int InvokeForwardMethod(void *clientData, Tcl_Interp *interp, Tcl_ObjectContext context, @@ -93,13 +90,8 @@ static int InvokeForwardMethod(void *clientData, static void DeleteForwardMethod(void *clientData); static int CloneForwardMethod(Tcl_Interp *interp, void *clientData, void **newClientData); -static int ProcedureMethodVarResolver(Tcl_Interp *interp, - const char *varName, Tcl_Namespace *contextNs, - int flags, Tcl_Var *varPtr); -static int ProcedureMethodCompiledVarResolver(Tcl_Interp *interp, - const char *varName, int length, - Tcl_Namespace *contextNs, - Tcl_ResolvedVarInfo **rPtrPtr); +static Tcl_ResolveVarProc ProcedureMethodVarResolver; +static Tcl_ResolveCompiledVarProc ProcedureMethodCompiledVarResolver; /* * The types of methods defined by the core OO system. @@ -135,7 +127,7 @@ static const Tcl_MethodType fwdMethodType = { Tcl_Method Tcl_NewInstanceMethod( - Tcl_Interp *dummy, /* Unused. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Object object, /* The object that has the method attached to * it. */ Tcl_Obj *nameObj, /* The name of the method. May be NULL; if so, @@ -146,14 +138,13 @@ Tcl_NewInstanceMethod( /* The type of method this is, which defines * how to invoke, delete and clone the * method. */ - void *clientData) /* Some data associated with the particular + void *clientData) /* Some data associated with the particular * method to be created. */ { Object *oPtr = (Object *) object; Method *mPtr; Tcl_HashEntry *hPtr; int isNew; - (void)dummy; if (nameObj == NULL) { mPtr = (Method *)ckalloc(sizeof(Method)); @@ -209,7 +200,7 @@ Tcl_NewInstanceMethod( Tcl_Method Tcl_NewMethod( - Tcl_Interp *dummy, /* The interpreter containing the class. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Class cls, /* The class to attach the method to. */ Tcl_Obj *nameObj, /* The name of the object. May be NULL (e.g., * for constructors or destructors); if so, up @@ -219,14 +210,13 @@ Tcl_NewMethod( /* The type of method this is, which defines * how to invoke, delete and clone the * method. */ - void *clientData) /* Some data associated with the particular + void *clientData) /* Some data associated with the particular * method to be created. */ { Class *clsPtr = (Class *) cls; Method *mPtr; Tcl_HashEntry *hPtr; int isNew; - (void)dummy; if (nameObj == NULL) { mPtr = (Method *)ckalloc(sizeof(Method)); @@ -962,12 +952,11 @@ ProcedureMethodVarResolver( Tcl_Interp *interp, const char *varName, Tcl_Namespace *contextNs, - int flags, + TCL_UNUSED(int) /*flags*/, /* Ignoring variable access flags (???) */ Tcl_Var *varPtr) { int result; Tcl_ResolvedVarInfo *rPtr = NULL; - (void)flags; result = ProcedureMethodCompiledVarResolver(interp, varName, strlen(varName), contextNs, &rPtr); @@ -1110,16 +1099,14 @@ ProcedureMethodCompiledVarDelete( static int ProcedureMethodCompiledVarResolver( - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), const char *varName, int length, - Tcl_Namespace *contextNs, + TCL_UNUSED(Tcl_Namespace *), Tcl_ResolvedVarInfo **rPtrPtr) { OOResVarInfo *infoPtr; Tcl_Obj *variableObj = Tcl_NewStringObj(varName, length); - (void)dummy; - (void)contextNs; /* * Do not create resolvers for cases that contain namespace separators or @@ -1183,6 +1170,8 @@ RenderDeclarerName( * ---------------------------------------------------------------------- */ +/* TODO: Check whether Tcl_AppendLimitedToObj() can work here. */ + #define LIMIT 60 #define ELLIPSIFY(str,len) \ ((len) > LIMIT ? LIMIT : (len)), (str), ((len) > LIMIT ? "..." : "") @@ -1190,7 +1179,8 @@ RenderDeclarerName( static void MethodErrorHandler( Tcl_Interp *interp, - Tcl_Obj *methodNameObj) + TCL_UNUSED(Tcl_Obj *) /*methodNameObj*/) + /* We pull the method name out of context instead of from argument */ { int nameLen, objectNameLen; CallContext *contextPtr = (CallContext *)((Interp *) interp)->varFramePtr->clientData; @@ -1198,7 +1188,6 @@ MethodErrorHandler( const char *objectName, *kindName, *methodName = TclGetStringFromObj(mPtr->namePtr, &nameLen); Object *declarerPtr; - (void)methodNameObj; if (mPtr->declaringObjectPtr != NULL) { declarerPtr = mPtr->declaringObjectPtr; @@ -1222,14 +1211,14 @@ MethodErrorHandler( static void ConstructorErrorHandler( Tcl_Interp *interp, - Tcl_Obj *methodNameObj) + TCL_UNUSED(Tcl_Obj *) /*methodNameObj*/) + /* Ignore. We know it is the constructor. */ { CallContext *contextPtr = (CallContext *)((Interp *) interp)->varFramePtr->clientData; Method *mPtr = contextPtr->callPtr->chain[contextPtr->index].mPtr; Object *declarerPtr; const char *objectName, *kindName; int objectNameLen; - (void)methodNameObj; if (mPtr->declaringObjectPtr != NULL) { declarerPtr = mPtr->declaringObjectPtr; @@ -1252,14 +1241,14 @@ ConstructorErrorHandler( static void DestructorErrorHandler( Tcl_Interp *interp, - Tcl_Obj *methodNameObj) + TCL_UNUSED(Tcl_Obj *) /*methodNameObj*/) + /* Ignore. We know it is the destructor. */ { CallContext *contextPtr = (CallContext *)((Interp *) interp)->varFramePtr->clientData; Method *mPtr = contextPtr->callPtr->chain[contextPtr->index].mPtr; Object *declarerPtr; const char *objectName, *kindName; int objectNameLen; - (void)methodNameObj; if (mPtr->declaringObjectPtr != NULL) { declarerPtr = mPtr->declaringObjectPtr; @@ -1534,13 +1523,12 @@ DeleteForwardMethod( static int CloneForwardMethod( - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), void *clientData, void **newClientData) { ForwardMethod *fmPtr = (ForwardMethod *)clientData; ForwardMethod *fm2Ptr = (ForwardMethod *)ckalloc(sizeof(ForwardMethod)); - (void)dummy; fm2Ptr->prefixObj = fmPtr->prefixObj; Tcl_IncrRefCount(fm2Ptr->prefixObj); -- cgit v0.12 From 467d03dbc94f1e8b6ec74da6ac0f54ce4975bf10 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 7 Mar 2020 15:55:35 +0000 Subject: Change (interal) function signature of TclpAlloc/TclpRealloc/TclpFree, using (void *) in stead of (char *) --- generic/tclAlloc.c | 24 ++++++++++++------------ generic/tclCkalloc.c | 24 ++++++++++++------------ generic/tclInt.decls | 6 +++--- generic/tclIntDecls.h | 12 ++++++------ generic/tclThreadAlloc.c | 20 ++++++++++---------- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c index 0c0ab7b..c1e7b28 100644 --- a/generic/tclAlloc.c +++ b/generic/tclAlloc.c @@ -249,7 +249,7 @@ TclFinalizeAllocSubsystem(void) *---------------------------------------------------------------------- */ -char * +void * TclpAlloc( unsigned int numBytes) /* Number of bytes to allocate. */ { @@ -446,7 +446,7 @@ MoreCore( void TclpFree( - char *oldPtr) /* Pointer to memory to free. */ + void *oldPtr) /* Pointer to memory to free. */ { size_t size; union overhead *overPtr; @@ -509,9 +509,9 @@ TclpFree( *---------------------------------------------------------------------- */ -char * +void * TclpRealloc( - char *oldPtr, /* Pointer to alloced block. */ + void *oldPtr, /* Pointer to alloced block. */ unsigned int numBytes) /* New size of memory. */ { int i; @@ -581,7 +581,7 @@ TclpRealloc( #endif Tcl_MutexUnlock(allocMutexPtr); - return (char *)(overPtr+1); + return (void *)(overPtr+1); } maxSize = 1 << (i+3); expensive = 0; @@ -592,7 +592,7 @@ TclpRealloc( } if (expensive) { - char *newPtr; + void *newPtr; Tcl_MutexUnlock(allocMutexPtr); @@ -692,11 +692,11 @@ mstats( *---------------------------------------------------------------------- */ -char * +void * TclpAlloc( unsigned int numBytes) /* Number of bytes to allocate. */ { - return (char *) malloc(numBytes); + return malloc(numBytes); } /* @@ -717,7 +717,7 @@ TclpAlloc( void TclpFree( - char *oldPtr) /* Pointer to memory to free. */ + void *oldPtr) /* Pointer to memory to free. */ { free(oldPtr); return; @@ -739,12 +739,12 @@ TclpFree( *---------------------------------------------------------------------- */ -char * +void * TclpRealloc( - char *oldPtr, /* Pointer to alloced block. */ + void *oldPtr, /* Pointer to alloced block. */ unsigned int numBytes) /* New size of memory. */ { - return (char *) realloc(oldPtr, numBytes); + return realloc(oldPtr, numBytes); } #endif /* !USE_TCLALLOC */ diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index c1ff631..0092c83 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -633,7 +633,7 @@ Tcl_DbCkfree( if (memp->tagPtr != NULL) { if ((memp->tagPtr->refCount-- <= 1) && (curTagPtr != memp->tagPtr)) { - TclpFree((char *) memp->tagPtr); + TclpFree(memp->tagPtr); } } @@ -650,7 +650,7 @@ Tcl_DbCkfree( if (allocHead == memp) { allocHead = memp->flink; } - TclpFree((char *) memp); + TclpFree(memp); Tcl_MutexUnlock(ckallocMutexPtr); } @@ -914,7 +914,7 @@ MemoryCmd( return TCL_ERROR; } if ((curTagPtr != NULL) && (curTagPtr->refCount == 0)) { - TclpFree((char *) curTagPtr); + TclpFree(curTagPtr); } len = strlen(TclGetString(objv[2])); curTagPtr = (MemTag *) TclpAlloc(TAG_SIZE(len)); @@ -1052,7 +1052,7 @@ char * Tcl_Alloc( unsigned int size) { - char *result = TclpAlloc(size); + char *result = (char *)TclpAlloc(size); /* * Most systems will not alloc(0), instead bumping it to one so that NULL @@ -1076,7 +1076,7 @@ Tcl_DbCkalloc( const char *file, int line) { - char *result = TclpAlloc(size); + char *result = (char *)TclpAlloc(size); if ((result == NULL) && size) { fflush(stdout); @@ -1100,7 +1100,7 @@ char * Tcl_AttemptAlloc( unsigned int size) { - return TclpAlloc(size); + return (char *)TclpAlloc(size); } char * @@ -1109,7 +1109,7 @@ Tcl_AttemptDbCkalloc( TCL_UNUSED(const char *) /*file*/, TCL_UNUSED(int) /*line*/) { - return TclpAlloc(size); + return (char *)TclpAlloc(size); } /* @@ -1128,7 +1128,7 @@ Tcl_Realloc( char *ptr, unsigned int size) { - char *result = TclpRealloc(ptr, size); + char *result = (char *)TclpRealloc(ptr, size); if ((result == NULL) && size) { Tcl_Panic("unable to realloc %u bytes", size); @@ -1143,7 +1143,7 @@ Tcl_DbCkrealloc( const char *file, int line) { - char *result = TclpRealloc(ptr, size); + char *result = (char *)TclpRealloc(ptr, size); if ((result == NULL) && size) { fflush(stdout); @@ -1168,7 +1168,7 @@ Tcl_AttemptRealloc( char *ptr, unsigned int size) { - return TclpRealloc(ptr, size); + return (char *)TclpRealloc(ptr, size); } char * @@ -1178,7 +1178,7 @@ Tcl_AttemptDbCkrealloc( TCL_UNUSED(const char *) /*file*/, TCL_UNUSED(int) /*line*/) { - return TclpRealloc(ptr, size); + return (char *)TclpRealloc(ptr, size); } /* @@ -1282,7 +1282,7 @@ TclFinalizeMemorySubsystem(void) Tcl_MutexLock(ckallocMutexPtr); if (curTagPtr != NULL) { - TclpFree((char *) curTagPtr); + TclpFree(curTagPtr); curTagPtr = NULL; } allocHead = NULL; diff --git a/generic/tclInt.decls b/generic/tclInt.decls index ec6b77f..5640fab 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -289,7 +289,7 @@ declare 64 { # int TclpAccess(const char *path, int mode) #} declare 69 { - char *TclpAlloc(unsigned int size) + void *TclpAlloc(unsigned int size) } #declare 70 { # int TclpCopyFile(const char *source, const char *dest) @@ -305,7 +305,7 @@ declare 69 { # int TclpDeleteFile(const char *path) #} declare 74 { - void TclpFree(char *ptr) + void TclpFree(void *ptr) } declare 75 { unsigned long TclpGetClicks(void) @@ -330,7 +330,7 @@ declare 77 {deprecated {}} { # char *modeString, int permissions) #} declare 81 { - char *TclpRealloc(char *ptr, unsigned int size) + void *TclpRealloc(void *ptr, unsigned int size) } #declare 82 { # int TclpRemoveDirectory(const char *path, int recursive, diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index d3941fd..8ba0c4c 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -208,13 +208,13 @@ EXTERN int TclObjInvoke(Tcl_Interp *interp, int objc, /* Slot 67 is reserved */ /* Slot 68 is reserved */ /* 69 */ -EXTERN char * TclpAlloc(unsigned int size); +EXTERN void * TclpAlloc(unsigned int size); /* Slot 70 is reserved */ /* Slot 71 is reserved */ /* Slot 72 is reserved */ /* Slot 73 is reserved */ /* 74 */ -EXTERN void TclpFree(char *ptr); +EXTERN void TclpFree(void *ptr); /* 75 */ EXTERN unsigned long TclpGetClicks(void); /* 76 */ @@ -226,7 +226,7 @@ void TclpGetTime(Tcl_Time *time); /* Slot 79 is reserved */ /* Slot 80 is reserved */ /* 81 */ -EXTERN char * TclpRealloc(char *ptr, unsigned int size); +EXTERN void * TclpRealloc(void *ptr, unsigned int size); /* Slot 82 is reserved */ /* Slot 83 is reserved */ /* Slot 84 is reserved */ @@ -734,19 +734,19 @@ typedef struct TclIntStubs { void (*reserved66)(void); void (*reserved67)(void); void (*reserved68)(void); - char * (*tclpAlloc) (unsigned int size); /* 69 */ + void * (*tclpAlloc) (unsigned int size); /* 69 */ void (*reserved70)(void); void (*reserved71)(void); void (*reserved72)(void); void (*reserved73)(void); - void (*tclpFree) (char *ptr); /* 74 */ + void (*tclpFree) (void *ptr); /* 74 */ unsigned long (*tclpGetClicks) (void); /* 75 */ unsigned long (*tclpGetSeconds) (void); /* 76 */ TCL_DEPRECATED_API("") void (*tclpGetTime) (Tcl_Time *time); /* 77 */ void (*reserved78)(void); void (*reserved79)(void); void (*reserved80)(void); - char * (*tclpRealloc) (char *ptr, unsigned int size); /* 81 */ + void * (*tclpRealloc) (void *ptr, unsigned int size); /* 81 */ void (*reserved82)(void); void (*reserved83)(void); void (*reserved84)(void); diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index df685eb..1248f5d 100644 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -134,8 +134,8 @@ static void LockBucket(Cache *cachePtr, int bucket); static void UnlockBucket(Cache *cachePtr, int bucket); static void PutBlocks(Cache *cachePtr, int bucket, int numMove); static int GetBlocks(Cache *cachePtr, int bucket); -static Block * Ptr2Block(char *ptr); -static char * Block2Ptr(Block *blockPtr, int bucket, unsigned int reqSize); +static Block * Ptr2Block(void *ptr); +static void * Block2Ptr(Block *blockPtr, int bucket, unsigned int reqSize); static void MoveObjs(Cache *fromPtr, Cache *toPtr, int numMove); static void PutObjs(Cache *fromPtr, int numMove); @@ -299,7 +299,7 @@ TclFreeAllocCache( *---------------------------------------------------------------------- */ -char * +void * TclpAlloc( unsigned int reqSize) { @@ -378,7 +378,7 @@ TclpAlloc( void TclpFree( - char *ptr) + void *ptr) { Cache *cachePtr; Block *blockPtr; @@ -435,9 +435,9 @@ TclpFree( *---------------------------------------------------------------------- */ -char * +void * TclpRealloc( - char *ptr, + void *ptr, unsigned int reqSize) { Cache *cachePtr; @@ -510,7 +510,7 @@ TclpRealloc( memcpy(newPtr, ptr, reqSize); TclpFree(ptr); } - return (char *)newPtr; + return newPtr; } /* @@ -804,7 +804,7 @@ PutObjs( *---------------------------------------------------------------------- */ -static char * +static void * Block2Ptr( Block *blockPtr, int bucket, @@ -819,12 +819,12 @@ Block2Ptr( #if RCHECK ((unsigned char *)(ptr))[reqSize] = MAGIC; #endif - return (char *) ptr; + return ptr; } static Block * Ptr2Block( - char *ptr) + void *ptr) { Block *blockPtr; -- cgit v0.12 From 89b0bdb8829f03a5216972f59d54b3fa8a1bef16 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 7 Mar 2020 18:25:27 +0000 Subject: Move TCL_UNUSED to tclInt.h, so we can still deprecate JOIN() --- generic/tcl.h | 19 ++++--------------- generic/tclInt.h | 11 +++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 6aff9e7..369a894 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -81,17 +81,16 @@ extern "C" { # define STRINGIFY(x) STRINGIFY1(x) # define STRINGIFY1(x) #x #endif +#ifndef JOIN +# define JOIN(a,b) JOIN1(a,b) +# define JOIN1(a,b) a##b +#endif #ifndef TCL_THREADS # define TCL_THREADS 1 #endif #endif /* !TCL_NO_DEPRECATED */ -#ifndef JOIN -# define JOIN(a,b) JOIN1(a,b) -# define JOIN1(a,b) a##b -#endif - /* * A special definition used to allow this header file to be included from * windows resource files so that they can obtain version information. @@ -147,11 +146,6 @@ extern "C" { # else # define TCL_NORETURN1 /* nothing */ # endif -# if defined(__cplusplus) -# define TCL_UNUSED(T) T -# else -# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused)) -# endif #else # define TCL_FORMAT_PRINTF(a,b) # if defined(_MSC_VER) && (_MSC_VER >= 1310) @@ -162,11 +156,6 @@ extern "C" { # define TCL_NOINLINE /* nothing */ # endif # define TCL_NORETURN1 /* nothing */ -# if defined(__cplusplus) -# define TCL_UNUSED(T) T -# else -# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) -# endif #endif /* diff --git a/generic/tclInt.h b/generic/tclInt.h index 6704789..9126c3b 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -53,7 +53,18 @@ # endif #endif +#ifndef JOIN +# define JOIN(a,b) JOIN1(a,b) +# define JOIN1(a,b) a##b +#endif +#if defined(__cplusplus) +# define TCL_UNUSED(T) T +#elif defined(__GNUC__) && (__GNUC__ > 2) +# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused)) +#else +# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) +#endif /* * Common include files needed by most of the Tcl source files are included -- cgit v0.12 From 085094bd8714e2c46e3f098189728bb966eb3fb0 Mon Sep 17 00:00:00 2001 From: dgp Date: Sun, 8 Mar 2020 13:58:07 +0000 Subject: More TCL_UNUSED. --- generic/tclObj.c | 118 +++++++++++++++++++++++---------------------------- generic/tclPathObj.c | 9 ++-- generic/tclPkg.c | 32 +++++--------- generic/tclProc.c | 31 ++++++-------- generic/tclProcess.c | 12 ++---- generic/tclRegexp.c | 3 +- generic/tclScan.c | 3 +- 7 files changed, 85 insertions(+), 123 deletions(-) diff --git a/generic/tclObj.c b/generic/tclObj.c index bc1953a..efa63dc 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -783,7 +783,7 @@ TclContinuationsGet( static void TclThreadFinalizeContLines( - ClientData dummy) + TCL_UNUSED(ClientData)) { /* * Release the hashtable tracking invisible continuation lines. @@ -792,7 +792,6 @@ TclThreadFinalizeContLines( ThreadSpecificData *tsdPtr = TclGetContLineTable(); Tcl_HashEntry *hPtr; Tcl_HashSearch hSearch; - (void)dummy; for (hPtr = Tcl_FirstHashEntry(tsdPtr->lineCLPtr, &hSearch); hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) { @@ -993,11 +992,11 @@ Tcl_ConvertToType( *-------------------------------------------------------------- */ +#if TCL_THREADS && defined(TCL_MEM_DEBUG) void TclDbDumpActiveObjects( FILE *outFile) { -#if TCL_THREADS && defined(TCL_MEM_DEBUG) Tcl_HashSearch hSearch; Tcl_HashEntry *hPtr; Tcl_HashTable *tablePtr; @@ -1022,10 +1021,14 @@ TclDbDumpActiveObjects( } } } +} #else - (void)outFile; -#endif +void +TclDbDumpActiveObjects( + TCL_UNUSED(FILE *)) +{ } +#endif /* *---------------------------------------------------------------------- @@ -1195,14 +1198,9 @@ Tcl_DbNewObj( Tcl_Obj * Tcl_DbNewObj( - const char *file, /* The name of the source file calling this - * function; used for debugging. */ - int line) /* Line number in the source file; used for - * debugging. */ + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) { - (void)file; - (void)line; - return Tcl_NewObj(); } #endif /* TCL_MEM_DEBUG */ @@ -2036,14 +2034,9 @@ Tcl_DbNewBooleanObj( Tcl_Obj * Tcl_DbNewBooleanObj( int boolValue, /* Boolean used to initialize new object. */ - const char *file, /* The name of the source file calling this - * function; used for debugging. */ - int line) /* Line number in the source file; used for - * debugging. */ + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) { - (void)file; - (void)line; - return Tcl_NewBooleanObj(boolValue); } #endif /* TCL_MEM_DEBUG */ @@ -2426,14 +2419,9 @@ Tcl_DbNewDoubleObj( Tcl_Obj * Tcl_DbNewDoubleObj( double dblValue, /* Double used to initialize the object. */ - const char *file, /* The name of the source file calling this - * function; used for debugging. */ - int line) /* Line number in the source file; used for - * debugging. */ + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) { - (void)file; - (void)line; - return Tcl_NewDoubleObj(dblValue); } #endif /* TCL_MEM_DEBUG */ @@ -2913,14 +2901,9 @@ Tcl_Obj * Tcl_DbNewLongObj( long longValue, /* Long integer used to initialize the new * object. */ - const char *file, /* The name of the source file calling this - * function; used for debugging. */ - int line) /* Line number in the source file; used for - * debugging. */ + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) { - (void)file; - (void)line; - return Tcl_NewWideIntObj(longValue); } #endif /* TCL_MEM_DEBUG */ @@ -3182,14 +3165,9 @@ Tcl_DbNewWideIntObj( Tcl_WideInt wideValue, /* Long integer used to initialize the new * object. */ - const char *file, /* The name of the source file calling this - * function; used for debugging. */ - int line) /* Line number in the source file; used for - * debugging. */ + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) { - (void)file; - (void)line; - return Tcl_NewWideIntObj(wideValue); } #endif /* TCL_MEM_DEBUG */ @@ -3567,12 +3545,9 @@ Tcl_DbNewBignumObj( Tcl_Obj * Tcl_DbNewBignumObj( void *bignumValue, - const char *file, - int line) + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) { - (void)file; - (void)line; - return Tcl_NewBignumObj(bignumValue); } #endif @@ -3956,6 +3931,7 @@ Tcl_IsShared( *---------------------------------------------------------------------- */ +#ifdef TCL_MEM_DEBUG void Tcl_DbIncrRefCount( Tcl_Obj *objPtr, /* The object we are registering a reference @@ -3965,7 +3941,6 @@ Tcl_DbIncrRefCount( int line) /* Line number in the source file; used for * debugging. */ { -#ifdef TCL_MEM_DEBUG if (objPtr->refCount == 0x61616161) { fprintf(stderr, "file = %s, line = %d\n", file, line); fflush(stderr); @@ -3994,12 +3969,19 @@ Tcl_DbIncrRefCount( } } # endif /* TCL_THREADS */ -#else - (void)file; - (void)line; -#endif /* TCL_MEM_DEBUG */ ++(objPtr)->refCount; } +#else /* !TCL_MEM_DEBUG */ +void +Tcl_DbIncrRefCount( + Tcl_Obj *objPtr, /* The object we are registering a reference + * to. */ + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) +{ + ++(objPtr)->refCount; +} +#endif /* TCL_MEM_DEBUG */ /* *---------------------------------------------------------------------- @@ -4022,6 +4004,7 @@ Tcl_DbIncrRefCount( *---------------------------------------------------------------------- */ +#ifdef TCL_MEM_DEBUG void Tcl_DbDecrRefCount( Tcl_Obj *objPtr, /* The object we are releasing a reference @@ -4031,7 +4014,6 @@ Tcl_DbDecrRefCount( int line) /* Line number in the source file; used for * debugging. */ { -#ifdef TCL_MEM_DEBUG if (objPtr->refCount == 0x61616161) { fprintf(stderr, "file = %s, line = %d\n", file, line); fflush(stderr); @@ -4060,15 +4042,24 @@ Tcl_DbDecrRefCount( } } # endif /* TCL_THREADS */ -#else - (void)file; - (void)line; -#endif /* TCL_MEM_DEBUG */ if (objPtr->refCount-- <= 1) { TclFreeObj(objPtr); } } +#else /* !TCL_MEM_DEBUG */ +void +Tcl_DbDecrRefCount( + Tcl_Obj *objPtr, /* The object we are releasing a reference + * to. */ + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) +{ + if (objPtr->refCount-- <= 1) { + TclFreeObj(objPtr); + } +} +#endif /* TCL_MEM_DEBUG */ /* *---------------------------------------------------------------------- @@ -4094,10 +4085,15 @@ Tcl_DbDecrRefCount( int Tcl_DbIsShared( Tcl_Obj *objPtr, /* The object to test for being shared. */ +#ifdef TCL_MEM_DEBUG const char *file, /* The name of the source file calling this * function; used for debugging. */ int line) /* Line number in the source file; used for * debugging. */ +#else + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) +#endif { #ifdef TCL_MEM_DEBUG if (objPtr->refCount == 0x61616161) { @@ -4128,9 +4124,6 @@ Tcl_DbIsShared( } } # endif /* TCL_THREADS */ -#else - (void)file; - (void)line; #endif /* TCL_MEM_DEBUG */ #ifdef TCL_COMPILE_STATS @@ -4194,12 +4187,11 @@ Tcl_InitObjHashTable( static Tcl_HashEntry * AllocObjEntry( - Tcl_HashTable *dummy, /* Hash table. */ + TCL_UNUSED(Tcl_HashTable *), void *keyPtr) /* Key to store in the hash table entry. */ { Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr; Tcl_HashEntry *hPtr = (Tcl_HashEntry *)ckalloc(sizeof(Tcl_HashEntry)); - (void)dummy; hPtr->key.objPtr = objPtr; Tcl_IncrRefCount(objPtr); @@ -4316,14 +4308,13 @@ TclFreeObjEntry( TCL_HASH_TYPE TclHashObjKey( - Tcl_HashTable *dummy, /* Hash table. */ + TCL_UNUSED(Tcl_HashTable *), void *keyPtr) /* Key from which to compute hash value. */ { Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr; int length; const char *string = TclGetStringFromObj(objPtr, &length); TCL_HASH_TYPE result = 0; - (void)dummy; /* * I tried a zillion different hash functions and asked many other people @@ -4718,13 +4709,12 @@ SetCmdNameFromAny( int Tcl_RepresentationCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *descObj; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "value"); diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 7accfa2..32b2961 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -1385,14 +1385,13 @@ AppendPath( Tcl_Obj * TclFSMakePathRelative( - Tcl_Interp *dummy, /* Used for error reporting if not NULL. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Obj *pathPtr, /* The path we have. */ Tcl_Obj *cwdPtr) /* Make it relative to this. */ { int cwdLen, len; const char *tempStr; Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType); - (void)dummy; if (irPtr) { FsPath *fsPathPtr = PATHOBJ(pathPtr); @@ -1457,11 +1456,10 @@ TclFSMakePathRelative( static int MakePathFromNormalized( - Tcl_Interp *dummy, /* Not used. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Obj *pathPtr) /* The object to convert. */ { FsPath *fsPathPtr; - (void)dummy; if (TclHasIntRep(pathPtr, &fsPathType)) { return TCL_OK; @@ -2512,9 +2510,8 @@ UpdateStringOfFsPath( int TclNativePathInFilesystem( Tcl_Obj *pathPtr, - ClientData *dummy) + TCL_UNUSED(ClientData *)) { - (void)dummy; /* * A special case is required to handle the empty path "". This is a valid * path (i.e. the user should be able to do 'file exists ""' without diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 0a32f48..bb3795b 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -226,12 +226,11 @@ Tcl_PkgProvideEx( static void PkgFilesCleanupProc( ClientData clientData, - Tcl_Interp *dummy) + TCL_UNUSED(Tcl_Interp *)) { PkgFiles *pkgFiles = (PkgFiles *) clientData; Tcl_HashSearch search; Tcl_HashEntry *entry; - (void)dummy; while (pkgFiles->names) { PkgName *name = pkgFiles->names; @@ -460,14 +459,13 @@ static int PkgRequireCore( ClientData data[], Tcl_Interp *interp, - int result) + TCL_UNUSED(int)) { const char *name = (const char *)data[0]; int reqc = PTR2INT(data[1]); Tcl_Obj **reqv = (Tcl_Obj **)data[2]; int code = CheckAllRequirements(interp, reqc, reqv); Require *reqPtr; - (void)result; if (code != TCL_OK) { return code; @@ -492,7 +490,7 @@ static int PkgRequireCoreStep1( ClientData data[], Tcl_Interp *interp, - int result) + TCL_UNUSED(int)) { Tcl_DString command; char *script; @@ -500,7 +498,6 @@ PkgRequireCoreStep1( int reqc = PTR2INT(data[1]); Tcl_Obj **const reqv = (Tcl_Obj **)data[2]; const char *name = reqPtr->name /* Name of desired package. */; - (void)result; /* * If we've got the package in the DB already, go on to actually loading @@ -587,7 +584,7 @@ static int PkgRequireCoreFinal( ClientData data[], Tcl_Interp *interp, - int result) + TCL_UNUSED(int)) { Require *reqPtr = (Require *)data[0]; int reqc = PTR2INT(data[1]), satisfies; @@ -595,7 +592,6 @@ PkgRequireCoreFinal( char *pkgVersionI; void *clientDataPtr = reqPtr->clientDataPtr; const char *name = reqPtr->name; /* Name of desired package. */ - (void)result; if (reqPtr->pkgPtr->version == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -639,11 +635,9 @@ PkgRequireCoreFinal( static int PkgRequireCoreCleanup( ClientData data[], - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), int result) { - (void)dummy; - ckfree(data[0]); return result; } @@ -652,7 +646,7 @@ static int SelectPackage( ClientData data[], Tcl_Interp *interp, - int result) + TCL_UNUSED(int)) { PkgAvail *availPtr, *bestPtr, *bestStablePtr; char *availVersion, *bestVersion, *bestStableVersion; @@ -664,7 +658,6 @@ SelectPackage( const char *name = reqPtr->name; Package *pkgPtr = reqPtr->pkgPtr; Interp *iPtr = (Interp *) interp; - (void)result; /* * Check whether we're already attempting to load some version of this @@ -1059,20 +1052,18 @@ Tcl_PkgPresentEx( */ int Tcl_PackageObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - - return Tcl_NRCallObjProc(interp, TclNRPackageObjCmd, NULL, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRPackageObjCmd, clientData, objc, objv); } /* ARGSUSED */ int TclNRPackageObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1098,7 +1089,6 @@ TclNRPackageObjCmd( const char *argv2, *argv3, *argv4; char *iva = NULL, *ivb = NULL; Tcl_Obj *objvListPtr, **newObjvPtr; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1546,11 +1536,9 @@ TclNRPackageObjCmd( static int TclNRPackageObjCmdCleanup( ClientData data[], - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), int result) { - (void)dummy; - TclDecrRefCount((Tcl_Obj *) data[0]); TclDecrRefCount((Tcl_Obj *) data[1]); return result; diff --git a/generic/tclProc.c b/generic/tclProc.c index 81da618..9951249 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -34,8 +34,7 @@ typedef struct { static void DupLambdaInternalRep(Tcl_Obj *objPtr, Tcl_Obj *copyPtr); static void FreeLambdaInternalRep(Tcl_Obj *objPtr); -static int InitArgsAndLocals(Tcl_Interp *interp, - Tcl_Obj *procNameObj, int skip); +static int InitArgsAndLocals(Tcl_Interp *interp, int skip); static void InitResolvedLocals(Tcl_Interp *interp, ByteCode *codePtr, Var *defPtr, Namespace *nsPtr); @@ -152,7 +151,7 @@ static const Tcl_ObjType lambdaType = { /* ARGSUSED */ int Tcl_ProcObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -163,7 +162,6 @@ Tcl_ProcObjCmd( const char *simpleName, *procArgs, *procBody; Namespace *nsPtr, *altNsPtr, *cxtNsPtr; Tcl_Command cmd; - (void)dummy; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "name args body"); @@ -199,8 +197,8 @@ Tcl_ProcObjCmd( * Create the data structure to represent the procedure. */ - if (TclCreateProc(interp, nsPtr, simpleName, objv[2], objv[3], - &procPtr) != TCL_OK) { + if (TclCreateProc(interp, /*ignored nsPtr*/ NULL, simpleName, objv[2], + objv[3], &procPtr) != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (creating proc \""); Tcl_AddErrorInfo(interp, simpleName); Tcl_AddErrorInfo(interp, "\")"); @@ -398,7 +396,7 @@ Tcl_ProcObjCmd( int TclCreateProc( Tcl_Interp *interp, /* Interpreter containing proc. */ - Namespace *nsPtr, /* Namespace containing this proc. */ + TCL_UNUSED(Namespace *) /*nsPtr*/, const char *procName, /* Unqualified name of this proc. */ Tcl_Obj *argsPtr, /* Description of arguments. */ Tcl_Obj *bodyPtr, /* Command body. */ @@ -411,7 +409,6 @@ TclCreateProc( CompiledLocal *localPtr = NULL; Tcl_Obj **argArray; int precompiled = 0; - (void)nsPtr; ProcGetIntRep(bodyPtr, procPtr); if (procPtr != NULL) { @@ -890,17 +887,17 @@ Uplevel_Callback( /* ARGSUSED */ int Tcl_UplevelObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRUplevelObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRUplevelObjCmd, clientData, objc, objv); } int TclNRUplevelObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -912,7 +909,6 @@ TclNRUplevelObjCmd( int result; CallFrame *savedVarFramePtr, *framePtr; Tcl_Obj *objPtr; - (void)dummy; if (objc < 2) { uplevelSyntax: @@ -1374,7 +1370,6 @@ static int InitArgsAndLocals( Tcl_Interp *interp,/* Interpreter in which procedure was * invoked. */ - Tcl_Obj *procNameObj, /* Procedure name for error reporting. */ int skip) /* Number of initial arguments to be skipped, * i.e., words in the "command name". */ { @@ -1384,7 +1379,6 @@ InitArgsAndLocals( Var *varPtr, *defPtr; int localCt = procPtr->numCompiledLocals, numArgs, argCt, i, imax; Tcl_Obj *const *argObjs; - (void)procNameObj; ByteCodeGetIntRep(procPtr->bodyPtr, &tclByteCodeType, codePtr); @@ -1698,7 +1692,7 @@ TclNRInterpProcCore( CallFrame *freePtr; ByteCode *codePtr; - result = InitArgsAndLocals(interp, procNameObj, skip); + result = InitArgsAndLocals(interp, skip); if (result != TCL_OK) { freePtr = iPtr->framePtr; Tcl_PopCallFrame(interp); /* Pop but do not free. */ @@ -2626,17 +2620,17 @@ TclGetLambdaFromObj( int Tcl_ApplyObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRApplyObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRApplyObjCmd, clientData, objc, objv); } int TclNRApplyObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2646,7 +2640,6 @@ TclNRApplyObjCmd( int result; Tcl_Namespace *nsPtr; ApplyExtraData *extraPtr; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "lambdaExpr ?arg ...?"); diff --git a/generic/tclProcess.c b/generic/tclProcess.c index 573baf4..5bf0af8 100644 --- a/generic/tclProcess.c +++ b/generic/tclProcess.c @@ -402,7 +402,7 @@ BuildProcessStatusObj( static int ProcessListObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -411,7 +411,6 @@ ProcessListObjCmd( Tcl_HashEntry *entry; Tcl_HashSearch search; ProcessInfo *info; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -454,7 +453,7 @@ ProcessListObjCmd( static int ProcessStatusObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -476,7 +475,6 @@ ProcessStatusObjCmd( enum switches { STATUS_WAIT, STATUS_LAST }; - (void)dummy; while (objc > 1) { if (TclGetString(objv[1])[0] != '-') { @@ -603,7 +601,7 @@ ProcessStatusObjCmd( static int ProcessPurgeObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -616,7 +614,6 @@ ProcessPurgeObjCmd( int result; int i; int pid; - (void)dummy; if (objc != 1 && objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "?pids?"); @@ -704,12 +701,11 @@ ProcessPurgeObjCmd( static int ProcessAutopurgeObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; if (objc != 1 && objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "?flag?"); diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index 74b384a..8b88423 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -1053,12 +1053,11 @@ FreeRegexp( static void FinalizeRegexp( - ClientData dummy) /* Not used. */ + TCL_UNUSED(ClientData)) { int i; TclRegexp *regexpPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; for (i = 0; (i < NUM_REGEXPS) && (tsdPtr->patterns[i] != NULL); i++) { regexpPtr = tsdPtr->regexps[i]; diff --git a/generic/tclScan.c b/generic/tclScan.c index 054d935..5aa6a10 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -565,7 +565,7 @@ ValidateFormat( /* ARGSUSED */ int Tcl_ScanObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -581,7 +581,6 @@ Tcl_ScanObjCmd( Tcl_UniChar ch = 0, sch = 0; Tcl_Obj **objs = NULL, *objPtr = NULL; int flags; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, -- cgit v0.12 From 42e6e9b167278c19dd2d9039fc434558bfc2c7f1 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 9 Mar 2020 12:31:47 +0000 Subject: More TCL_UNUSED --- generic/tclStrToD.c | 18 +- generic/tclStringObj.c | 13 +- generic/tclStubInit.c | 4 +- generic/tclTest.c | 810 +++++++++++++------------------------------ generic/tclTestObj.c | 49 +-- generic/tclTestProcBodyObj.c | 6 +- generic/tclThreadAlloc.c | 4 +- generic/tclThreadTest.c | 10 +- 8 files changed, 281 insertions(+), 633 deletions(-) diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index be26d0b..7964b68 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -328,7 +328,7 @@ static void CastOutPowersOf2(int *, int *, int *); static char * ShorteningInt64Conversion(Double *, Tcl_WideUInt, int, int, int, int, int, int, int, int, int, int, int, int *, char **); -static char * StrictInt64Conversion(Double *, Tcl_WideUInt, +static char * StrictInt64Conversion(Tcl_WideUInt, int, int, int, int, int, int, int, int, int *, char **); static int ShouldBankerRoundUpPowD(mp_int *, int, int); @@ -340,7 +340,7 @@ static char * ShorteningBignumConversionPowD(Double *dPtr, int sd, int k, int len, int ilim, int ilim1, int *decpt, char **endPtr); -static char * StrictBignumConversionPowD(Double *dPtr, +static char * StrictBignumConversionPowD( Tcl_WideUInt bw, int b2, int b5, int sd, int k, int len, int ilim, int ilim1, int *decpt, @@ -354,7 +354,7 @@ static char * ShorteningBignumConversion(Double *dPtr, int s2, int s5, int k, int len, int ilim, int ilim1, int *decpt, char **endPtr); -static char * StrictBignumConversion(Double *dPtr, +static char * StrictBignumConversion( Tcl_WideUInt bw, int b2, int s2, int s5, int k, int len, int ilim, int ilim1, int *decpt, @@ -3180,7 +3180,6 @@ ShorteningInt64Conversion( static inline char * StrictInt64Conversion( - Double *dPtr, /* Original number to convert. */ Tcl_WideUInt bw, /* Integer significand. */ int b2, int b5, /* Scale factor for the significand in the * numerator. */ @@ -3205,7 +3204,6 @@ StrictInt64Conversion( int digit; /* Current output digit. */ char *s = retval; /* Cursor in the output buffer. */ int i; /* Current position in the output buffer. */ - (void)dPtr; /* * Adjust if the logarithm was guessed wrong. @@ -3589,7 +3587,6 @@ ShorteningBignumConversionPowD( static inline char * StrictBignumConversionPowD( - Double *dPtr, /* Original number to convert. */ Tcl_WideUInt bw, /* Integer significand. */ int b2, int b5, /* Scale factor for the significand in the * numerator. */ @@ -3611,7 +3608,6 @@ StrictBignumConversionPowD( char *s = retval; /* Cursor in the output buffer. */ int i; /* Index in the output buffer. */ mp_err err; - (void)dPtr; /* * b = bw * 2**b2 * 5**b5 @@ -4028,7 +4024,6 @@ ShorteningBignumConversion( static inline char * StrictBignumConversion( - Double *dPtr, /* Original number being converted. */ Tcl_WideUInt bw, /* Integer significand and exponent. */ int b2, /* Scale factor for the significand. */ int s2, int s5, /* Scale factors for denominator. */ @@ -4049,7 +4044,6 @@ StrictBignumConversion( int g; /* Size of the current digit ground. */ int i, j; mp_err err; - (void)dPtr; /* * b = bw * 2**b2 * 5**b5 @@ -4469,7 +4463,7 @@ TclDoubleDigits( * operations. */ - return StrictInt64Conversion(&d, bw, b2, b5, s2, s5, k, + return StrictInt64Conversion(bw, b2, b5, s2, s5, k, len, ilim, ilim1, decpt, endPtr); } else if (s5 == 0) { /* @@ -4486,7 +4480,7 @@ TclDoubleDigits( b2 += delta; s2 += delta; } - return StrictBignumConversionPowD(&d, bw, b2, b5, + return StrictBignumConversionPowD(bw, b2, b5, s2/MP_DIGIT_BIT, k, len, ilim, ilim1, decpt, endPtr); } else { /* @@ -4496,7 +4490,7 @@ TclDoubleDigits( * fewer mp_int divisions. */ - return StrictBignumConversion(&d, bw, b2, s2, s5, k, + return StrictBignumConversion(bw, b2, s2, s5, k, len, ilim, ilim1, decpt, endPtr); } } diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 6ab2371..cb2a773 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -342,14 +342,9 @@ Tcl_DbNewStringObj( * when initializing the new object. If * negative, use bytes up to the first NUL * byte. */ - const char *file, /* The name of the source file calling this - * function; used for debugging. */ - int line) /* Line number in the source file; used for - * debugging. */ + TCL_UNUSED(const char *) /*file*/, + TCL_UNUSED(int) /*line*/) { - (void)file; - (void)line; - return Tcl_NewStringObj(bytes, length); } #endif /* TCL_MEM_DEBUG */ @@ -4169,11 +4164,9 @@ DupStringInternalRep( static int SetStringFromAny( - Tcl_Interp *dummy, /* Not used. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Obj *objPtr) /* The object to convert. */ { - (void)dummy; - if (!TclHasIntRep(objPtr, &tclStringType)) { String *stringPtr = stringAlloc(0); diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 784d165..fbbac6d 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -270,9 +270,9 @@ mp_err TclBN_mp_div_3(const mp_int *a, mp_int *c, unsigned int *d) { return result; } -int TclBN_mp_expt_d_ex(const mp_int *a, unsigned int b, mp_int *c, int fast) +int TclBN_mp_expt_d_ex(const mp_int *a, unsigned int b, mp_int *c, + TCL_UNUSED(int) /*fast*/) { - (void)fast; return TclBN_mp_expt_u32(a, b, c); } diff --git a/generic/tclTest.c b/generic/tclTest.c index 634f22b..c454d70 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -164,10 +164,8 @@ static void CleanupTestSetassocdataTests( void *clientData, Tcl_Interp *interp); static void CmdDelProc1(void *clientData); static void CmdDelProc2(void *clientData); -static int CmdProc1(void *clientData, - Tcl_Interp *interp, int argc, const char **argv); -static int CmdProc2(void *clientData, - Tcl_Interp *interp, int argc, const char **argv); +static Tcl_CmdProc CmdProc1; +static Tcl_CmdProc CmdProc2; static void CmdTraceDeleteProc( void *clientData, Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *cmdProc, @@ -177,16 +175,11 @@ static void CmdTraceProc(void *clientData, Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *cmdProc, void *cmdClientData, int argc, const char *argv[]); -static int CreatedCommandProc( - void *clientData, Tcl_Interp *interp, - int argc, const char **argv); -static int CreatedCommandProc2( - void *clientData, Tcl_Interp *interp, - int argc, const char **argv); +static Tcl_CmdProc CreatedCommandProc; +static Tcl_CmdProc CreatedCommandProc2; static void DelCallbackProc(void *clientData, Tcl_Interp *interp); -static int DelCmdProc(void *clientData, - Tcl_Interp *interp, int argc, const char **argv); +static Tcl_CmdProc DelCmdProc; static void DelDeleteProc(void *clientData); static void EncodingFreeProc(void *clientData); static int EncodingToUtfProc(void *clientData, @@ -201,15 +194,11 @@ static int EncodingFromUtfProc(void *clientData, int *dstCharsPtr); static void ExitProcEven(void *clientData); static void ExitProcOdd(void *clientData); -static int GetTimesObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc GetTimesObjCmd; +static Tcl_ResolveCompiledVarProc InterpCompiledVarResolver; static void MainLoop(void); -static int NoopCmd(void *clientData, - Tcl_Interp *interp, int argc, const char **argv); -static int NoopObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_CmdProc NoopCmd; +static Tcl_ObjCmdProc NoopObjCmd; static int ObjTraceProc(void *clientData, Tcl_Interp *interp, int level, const char *command, Tcl_Command commandToken, int objc, @@ -218,181 +207,83 @@ static void ObjTraceDeleteProc(void *clientData); static void PrintParse(Tcl_Interp *interp, Tcl_Parse *parsePtr); static void SpecialFree(char *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[]); -static int TestpurebytesobjObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TeststringbytesObjCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestcmdinfoCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestcmdtokenCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestcmdtraceCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestconcatobjCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestcreatecommandCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestdcallCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestdelCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestdelassocdataCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestdoubledigitsObjCmd(void *dummy, - Tcl_Interp* interp, int objc, - Tcl_Obj* const objv[]); -static int TestdstringCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestencodingObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestevalexObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestevalobjvObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TesteventObjCmd(void *unused, - Tcl_Interp *interp, int argc, - Tcl_Obj *const objv[]); +static Tcl_CmdProc TestasyncCmd; +static Tcl_ObjCmdProc TestbumpinterpepochObjCmd; +static Tcl_ObjCmdProc TestbytestringObjCmd; +static Tcl_ObjCmdProc TestpurebytesobjObjCmd; +static Tcl_ObjCmdProc TeststringbytesObjCmd; +static Tcl_CmdProc TestcmdinfoCmd; +static Tcl_CmdProc TestcmdtokenCmd; +static Tcl_CmdProc TestcmdtraceCmd; +static Tcl_CmdProc TestconcatobjCmd; +static Tcl_CmdProc TestcreatecommandCmd; +static Tcl_CmdProc TestdcallCmd; +static Tcl_CmdProc TestdelCmd; +static Tcl_CmdProc TestdelassocdataCmd; +static Tcl_ObjCmdProc TestdoubledigitsObjCmd; +static Tcl_CmdProc TestdstringCmd; +static Tcl_ObjCmdProc TestencodingObjCmd; +static Tcl_ObjCmdProc TestevalexObjCmd; +static Tcl_ObjCmdProc TestevalobjvObjCmd; +static Tcl_ObjCmdProc TesteventObjCmd; static int TesteventProc(Tcl_Event *event, int flags); static int TesteventDeleteProc(Tcl_Event *event, void *clientData); -static int TestexithandlerCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestexprlongCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestexprlongobjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestexprdoubleCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestexprdoubleobjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestexprparserObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestexprstringCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestfileCmd(void *dummy, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestfilelinkCmd(void *dummy, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestfeventCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestgetassocdataCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestgetintCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestlongsizeCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestgetplatformCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestgetvarfullnameCmd( - void *dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int TestinterpdeleteCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestlinkCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestlinkarrayCmd(void *dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); -static int TestlocaleCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestmainthreadCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestsetmainloopCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestexitmainloopCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestpanicCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestparseargsCmd(void *dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int TestparserObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestparsevarObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestparsevarnameObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestpreferstableObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestprintObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestregexpObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestreturnObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_CmdProc TestexithandlerCmd; +static Tcl_CmdProc TestexprlongCmd; +static Tcl_ObjCmdProc TestexprlongobjCmd; +static Tcl_CmdProc TestexprdoubleCmd; +static Tcl_ObjCmdProc TestexprdoubleobjCmd; +static Tcl_ObjCmdProc TestexprparserObjCmd; +static Tcl_CmdProc TestexprstringCmd; +static Tcl_ObjCmdProc TestfileCmd; +static Tcl_ObjCmdProc TestfilelinkCmd; +static Tcl_CmdProc TestfeventCmd; +static Tcl_CmdProc TestgetassocdataCmd; +static Tcl_CmdProc TestgetintCmd; +static Tcl_CmdProc TestlongsizeCmd; +static Tcl_CmdProc TestgetplatformCmd; +static Tcl_ObjCmdProc TestgetvarfullnameCmd; +static Tcl_CmdProc TestinterpdeleteCmd; +static Tcl_CmdProc TestlinkCmd; +static Tcl_ObjCmdProc TestlinkarrayCmd; +static Tcl_ObjCmdProc TestlocaleCmd; +static Tcl_CmdProc TestmainthreadCmd; +static Tcl_CmdProc TestsetmainloopCmd; +static Tcl_CmdProc TestexitmainloopCmd; +static Tcl_CmdProc TestpanicCmd; +static Tcl_ObjCmdProc TestparseargsCmd; +static Tcl_ObjCmdProc TestparserObjCmd; +static Tcl_ObjCmdProc TestparsevarObjCmd; +static Tcl_ObjCmdProc TestparsevarnameObjCmd; +static Tcl_ObjCmdProc TestpreferstableObjCmd; +static Tcl_ObjCmdProc TestprintObjCmd; +static Tcl_ObjCmdProc TestregexpObjCmd; +static Tcl_ObjCmdProc TestreturnObjCmd; static void TestregexpXflags(const char *string, int length, int *cflagsPtr, int *eflagsPtr); -static int TestsaveresultCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc TestsaveresultCmd; static void TestsaveresultFree(char *blockPtr); -static int TestsetassocdataCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestsetCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int Testset2Cmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestseterrorcodeCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestsetobjerrorcodeCmd( - void *dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int TestsetplatformCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TeststaticpkgCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TesttranslatefilenameCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestupvarCmd(void *dummy, - Tcl_Interp *interp, int argc, const char **argv); -static int TestWrongNumArgsObjCmd( - void *clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int TestGetIndexFromObjStructObjCmd( - void *clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int TestChannelCmd(void *clientData, - Tcl_Interp *interp, int argc, const char **argv); -static int TestChannelEventCmd(void *clientData, - Tcl_Interp *interp, int argc, const char **argv); -static int TestSocketCmd(void *clientData, - Tcl_Interp *interp, int argc, const char **argv); -static int TestFilesystemObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestSimpleFilesystemObjCmd( - void *dummy, Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_CmdProc TestsetassocdataCmd; +static Tcl_CmdProc TestsetCmd; +static Tcl_CmdProc Testset2Cmd; +static Tcl_CmdProc TestseterrorcodeCmd; +static Tcl_ObjCmdProc TestsetobjerrorcodeCmd; +static Tcl_CmdProc TestsetplatformCmd; +static Tcl_CmdProc TeststaticpkgCmd; +static Tcl_CmdProc TesttranslatefilenameCmd; +static Tcl_CmdProc TestupvarCmd; +static Tcl_ObjCmdProc TestWrongNumArgsObjCmd; +static Tcl_ObjCmdProc TestGetIndexFromObjStructObjCmd; +static Tcl_CmdProc TestChannelCmd; +static Tcl_CmdProc TestChannelEventCmd; +static Tcl_CmdProc TestSocketCmd; +static Tcl_ObjCmdProc TestFilesystemObjCmd; +static Tcl_ObjCmdProc TestSimpleFilesystemObjCmd; static void TestReport(const char *cmd, Tcl_Obj *arg1, Tcl_Obj *arg2); -static int TestgetencpathObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestsetencpathObjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc TestgetencpathObjCmd; +static Tcl_ObjCmdProc TestsetencpathObjCmd; static Tcl_Obj * TestReportGetNativePath(Tcl_Obj *pathPtr); static Tcl_FSStatProc TestReportStat; static Tcl_FSAccessProc TestReportAccess; @@ -425,33 +316,17 @@ static Tcl_FSListVolumesProc SimpleListVolumes; static Tcl_FSPathInFilesystemProc SimplePathInFilesystem; static Tcl_Obj * SimpleRedirect(Tcl_Obj *pathPtr); static Tcl_FSMatchInDirectoryProc SimpleMatchInDirectory; -static int TestNumUtfCharsCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestFindFirstCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestFindLastCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestHashSystemHashCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc TestNumUtfCharsCmd; +static Tcl_ObjCmdProc TestFindFirstCmd; +static Tcl_ObjCmdProc TestFindLastCmd; +static Tcl_ObjCmdProc TestHashSystemHashCmd; static Tcl_NRPostProc NREUnwind_callback; -static int TestNREUnwind(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestNRELevels(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestInterpResolverCmd(void *clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc TestNREUnwind; +static Tcl_ObjCmdProc TestNRELevels; +static Tcl_ObjCmdProc TestInterpResolverCmd; #if defined(HAVE_CPUID) || defined(_WIN32) -static int TestcpuidCmd(void *dummy, - Tcl_Interp* interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc TestcpuidCmd; #endif static const Tcl_Filesystem testReportingFilesystem = { @@ -843,7 +718,7 @@ Tcltest_SafeInit( /* ARGSUSED */ static int TestasyncCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -851,7 +726,6 @@ TestasyncCmd( TestAsyncHandler *asyncPtr, *prevPtr; int id, code; static int nextId = 1; - (void)dummy; if (argc < 2) { wrongNumArgs: @@ -1054,13 +928,12 @@ AsyncThreadProc( static int TestbumpinterpepochObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Interp *iPtr = (Interp *)interp; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); @@ -1091,13 +964,12 @@ TestbumpinterpepochObjCmd( /* ARGSUSED */ static int TestcmdinfoCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { Tcl_CmdInfo info; - (void)dummy; if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -1165,12 +1037,9 @@ static int CmdProc1( void *clientData, /* String to return. */ Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + TCL_UNUSED(int) /*argc*/, + TCL_UNUSED(const char **) /*argv*/) { - (void)argc; - (void)argv; - Tcl_AppendResult(interp, "CmdProc1 ", (char *) clientData, NULL); return TCL_OK; } @@ -1180,12 +1049,9 @@ static int CmdProc2( void *clientData, /* String to return. */ Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + TCL_UNUSED(int) /*argc*/, + TCL_UNUSED(const char **) /*argv*/) { - (void)argc; - (void)argv; - Tcl_AppendResult(interp, "CmdProc2 ", (char *) clientData, NULL); return TCL_OK; } @@ -1228,7 +1094,7 @@ CmdDelProc2( /* ARGSUSED */ static int TestcmdtokenCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -1236,7 +1102,6 @@ TestcmdtokenCmd( Tcl_Command token; int *l; char buf[30]; - (void)dummy; if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -1293,14 +1158,13 @@ TestcmdtokenCmd( /* ARGSUSED */ static int TestcmdtraceCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { Tcl_DString buffer; int result; - (void)dummy; if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -1386,22 +1250,17 @@ CmdTraceProc( void *clientData, /* Pointer to buffer in which the * command and arguments are appended. * Accumulates test result. */ - Tcl_Interp *interp, /* Current interpreter. */ - int level, /* Current trace level. */ + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(int) /*level*/, char *command, /* The command being traced (after * substitutions). */ - Tcl_CmdProc *cmdProc, /* Points to command's command procedure. */ - void *cmdClientData, /* Client data associated with command - * procedure. */ + TCL_UNUSED(Tcl_CmdProc *) /*cmdProc*/, + TCL_UNUSED(ClientData), int argc, /* Number of arguments. */ const char *argv[]) /* Argument strings. */ { Tcl_DString *bufPtr = (Tcl_DString *) clientData; int i; - (void)interp; - (void)level; - (void)cmdProc; - (void)cmdClientData; Tcl_DStringAppendElement(bufPtr, command); @@ -1414,25 +1273,15 @@ CmdTraceProc( static void CmdTraceDeleteProc( - void *dummy, /* Unused. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ - int level, /* Current trace level. */ - char *command, /* The command being traced (after - * substitutions). */ - Tcl_CmdProc *cmdProc, /* Points to command's command procedure. */ - void *cmdClientData, /* Client data associated with command - * procedure. */ - int argc, /* Number of arguments. */ - const char *argv[]) /* Argument strings. */ + TCL_UNUSED(int) /*level*/, + TCL_UNUSED(char *) /*command*/, + TCL_UNUSED(Tcl_CmdProc *), + TCL_UNUSED(ClientData), + TCL_UNUSED(int) /*argc*/, + TCL_UNUSED(const char **) /*argv*/) { - (void)dummy; - (void)level; - (void)command; - (void)cmdProc; - (void)cmdClientData; - (void)argc; - (void)argv; - /* * Remove ourselves to test whether calling Tcl_DeleteTrace within a trace * callback causes the for loop in TclNRExecuteByteCode that calls traces to @@ -1444,20 +1293,15 @@ CmdTraceDeleteProc( static int ObjTraceProc( - void *dummy, /* unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Tcl interpreter */ - int level, /* Execution level */ - const char *command, /* Command being executed */ - Tcl_Command token, /* Command information */ - int objc, /* Parameter count */ - Tcl_Obj *const objv[]) /* Parameter list */ + TCL_UNUSED(int) /*level*/, + const char *command, + TCL_UNUSED(Tcl_Command), + TCL_UNUSED(int) /*objc*/, + Tcl_Obj *const objv[]) /* Argument objects. */ { const char *word = Tcl_GetString(objv[0]); - (void)dummy; - (void)level; - (void)token; - (void)objc; - (void)objv; if (!strcmp(word, "Error")) { Tcl_SetObjResult(interp, Tcl_NewStringObj(command, -1)); @@ -1506,13 +1350,11 @@ ObjTraceDeleteProc( static int TestcreatecommandCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { - (void)dummy; - if (argc != 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " option\"", NULL); @@ -1538,16 +1380,13 @@ TestcreatecommandCmd( static int CreatedCommandProc( - void *dummy, /* String to return. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + TCL_UNUSED(int) /*argc*/, + TCL_UNUSED(const char **) /*argv*/) { Tcl_CmdInfo info; int found; - (void)dummy; - (void)argc; - (void)argv; found = Tcl_GetCommandInfo(interp, "test_ns_basic::createdcommand", &info); @@ -1563,16 +1402,13 @@ CreatedCommandProc( static int CreatedCommandProc2( - void *dummy, /* String to return. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + TCL_UNUSED(int) /*argc*/, + TCL_UNUSED(const char **) /*argv*/) { Tcl_CmdInfo info; int found; - (void)dummy; - (void)argc; - (void)argv; found = Tcl_GetCommandInfo(interp, "value:at:", &info); if (!found) { @@ -1605,13 +1441,12 @@ CreatedCommandProc2( /* ARGSUSED */ static int TestdcallCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { int i, id; - (void)dummy; delInterp = Tcl_CreateInterp(); Tcl_DStringInit(&delString); @@ -1671,14 +1506,13 @@ DelCallbackProc( /* ARGSUSED */ static int TestdelCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { DelCmd *dPtr; Tcl_Interp *slave; - (void)dummy; if (argc != 4) { Tcl_AppendResult(interp, "wrong # args", NULL); @@ -1704,12 +1538,10 @@ static int DelCmdProc( void *clientData, /* String result to return. */ Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + TCL_UNUSED(int) /*argc*/, + TCL_UNUSED(const char **) /*argv*/) { DelCmd *dPtr = (DelCmd *) clientData; - (void)argc; - (void)argv; Tcl_AppendResult(interp, dPtr->deleteCmd, NULL); ckfree(dPtr->deleteCmd); @@ -1749,13 +1581,11 @@ DelDeleteProc( static int TestdelassocdataCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { - (void)dummy; - if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], " data_key\"", NULL); @@ -1787,14 +1617,11 @@ TestdelassocdataCmd( */ static int -TestdoubledigitsObjCmd(void *dummy, - /* NULL */ - Tcl_Interp* interp, - /* Tcl interpreter */ - int objc, - /* Parameter count */ - Tcl_Obj* const objv[]) - /* Parameter vector */ +TestdoubledigitsObjCmd( + TCL_UNUSED(ClientData), + Tcl_Interp* interp, /* Tcl interpreter */ + int objc, /* Parameter count */ + Tcl_Obj* const objv[]) /* Parameter vector */ { static const char* options[] = { "shortest", @@ -1819,7 +1646,6 @@ TestdoubledigitsObjCmd(void *dummy, char* endPtr; Tcl_Obj* strObj; Tcl_Obj* retval; - (void)dummy; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 1, objv, "fpval ndigits type ?shorten?"); @@ -1880,13 +1706,12 @@ TestdoubledigitsObjCmd(void *dummy, /* ARGSUSED */ static int TestdstringCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { int count; - (void)dummy; if (argc < 2) { wrongNumArgs: @@ -2008,7 +1833,7 @@ static void SpecialFree( /* ARGSUSED */ static int TestencodingObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2023,7 +1848,6 @@ TestencodingObjCmd( enum options { ENC_CREATE, ENC_DELETE }; - (void)dummy; if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, &index) != TCL_OK) { @@ -2078,10 +1902,10 @@ TestencodingObjCmd( static int EncodingToUtfProc( void *clientData, /* TclEncoding structure. */ - const char *src, /* Source string in specified encoding. */ + TCL_UNUSED(const char *) /*src*/, int srcLen, /* Source string length in bytes. */ - int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Current state. */ + TCL_UNUSED(int) /*flags*/, + TCL_UNUSED(Tcl_EncodingState *), char *dst, /* Output buffer. */ int dstLen, /* The maximum length of output buffer. */ int *srcReadPtr, /* Filled with number of bytes read. */ @@ -2090,9 +1914,6 @@ EncodingToUtfProc( { int len; TclEncoding *encodingPtr; - (void)src; - (void)flags; - (void)statePtr; encodingPtr = (TclEncoding *) clientData; Tcl_EvalEx(encodingPtr->interp, encodingPtr->toUtfCmd, -1, TCL_EVAL_GLOBAL); @@ -2113,10 +1934,10 @@ EncodingToUtfProc( static int EncodingFromUtfProc( void *clientData, /* TclEncoding structure. */ - const char *src, /* Source string in specified encoding. */ + TCL_UNUSED(const char *) /*src*/, int srcLen, /* Source string length in bytes. */ - int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Current state. */ + TCL_UNUSED(int) /*flags*/, + TCL_UNUSED(Tcl_EncodingState *), char *dst, /* Output buffer. */ int dstLen, /* The maximum length of output buffer. */ int *srcReadPtr, /* Filled with number of bytes read. */ @@ -2125,9 +1946,6 @@ EncodingFromUtfProc( { int len; TclEncoding *encodingPtr; - (void)src; - (void)flags; - (void)statePtr; encodingPtr = (TclEncoding *) clientData; Tcl_EvalEx(encodingPtr->interp, encodingPtr->fromUtfCmd, -1, TCL_EVAL_GLOBAL); @@ -2175,14 +1993,13 @@ EncodingFreeProc( static int TestevalexObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int length, flags; const char *script; - (void)dummy; flags = 0; if (objc == 3) { @@ -2221,13 +2038,12 @@ TestevalexObjCmd( static int TestevalobjvObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int evalGlobal; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "global word ?word ...?"); @@ -2271,7 +2087,7 @@ TestevalobjvObjCmd( static int TesteventObjCmd( - void *dummy, /* Not used */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const objv[]) /* Parameter vector */ @@ -2291,7 +2107,6 @@ TesteventObjCmd( TCL_QUEUE_MARK }; TestEvent *ev; /* Event to be queued */ - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?arg ...?"); @@ -2357,7 +2172,7 @@ TesteventObjCmd( static int TesteventProc( Tcl_Event *event, /* Event to deliver */ - int flags) /* Current flags for Tcl_ServiceEvent */ + TCL_UNUSED(int) /*flags*/) { TestEvent *ev = (TestEvent *) event; Tcl_Interp *interp = ev->interp; @@ -2365,7 +2180,6 @@ TesteventProc( int result = Tcl_EvalObjEx(interp, command, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT); int retval; - (void)flags; if (result != TCL_OK) { Tcl_AddErrorInfo(interp, @@ -2452,13 +2266,12 @@ TesteventDeleteProc( static int TestexithandlerCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { int value; - (void)dummy; if (argc != 3) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], @@ -2529,7 +2342,7 @@ ExitProcEven( static int TestexprlongCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -2537,7 +2350,6 @@ TestexprlongCmd( long exprResult; char buf[4 + TCL_INTEGER_SPACE]; int result; - (void)dummy; if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], @@ -2573,7 +2385,7 @@ TestexprlongCmd( static int TestexprlongobjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument objects. */ @@ -2581,7 +2393,6 @@ TestexprlongobjCmd( long exprResult; char buf[4 + TCL_INTEGER_SPACE]; int result; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "expression"); @@ -2616,7 +2427,7 @@ TestexprlongobjCmd( static int TestexprdoubleCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -2624,7 +2435,6 @@ TestexprdoubleCmd( double exprResult; char buf[4 + TCL_DOUBLE_SPACE]; int result; - (void)dummy; if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], @@ -2661,7 +2471,7 @@ TestexprdoubleCmd( static int TestexprdoubleobjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument objects. */ @@ -2669,7 +2479,6 @@ TestexprdoubleobjCmd( double exprResult; char buf[4 + TCL_DOUBLE_SPACE]; int result; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "expression"); @@ -2704,13 +2513,11 @@ TestexprdoubleobjCmd( static int TestexprstringCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { - (void)dummy; - if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], " expression\"", NULL); @@ -2738,13 +2545,12 @@ TestexprstringCmd( static int TestfilelinkCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { Tcl_Obj *contents; - (void)dummy; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "source ?target?"); @@ -2806,13 +2612,12 @@ TestfilelinkCmd( static int TestgetassocdataCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { char *res; - (void)dummy; if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], @@ -2845,14 +2650,13 @@ TestgetassocdataCmd( static int TestgetplatformCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { static const char *const platformStrings[] = { "unix", "mac", "windows" }; TclPlatformType *platform; - (void)dummy; platform = TclGetPlatform(); @@ -2887,13 +2691,12 @@ TestgetplatformCmd( /* ARGSUSED */ static int TestinterpdeleteCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { Tcl_Interp *slaveToDelete; - (void)dummy; if (argc != 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -2929,7 +2732,7 @@ TestinterpdeleteCmd( /* ARGSUSED */ static int TestlinkCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -2952,7 +2755,6 @@ TestlinkCmd( char buffer[2*TCL_DOUBLE_SPACE]; int writable, flag; Tcl_Obj *tmp; - (void)dummy; if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -3398,7 +3200,7 @@ TestlinkCmd( static int TestlinkarrayCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3422,7 +3224,6 @@ TestlinkarrayCmd( int optionIndex, typeIndex, readonly, i, size, length; char *name, *arg; Tcl_WideInt addr; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option args"); @@ -3517,7 +3318,7 @@ TestlinkarrayCmd( static int TestlocaleCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -3532,7 +3333,6 @@ TestlocaleCmd( LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_ALL }; - (void)dummy; /* * LC_CTYPE, etc. correspond to the indices for the strings. @@ -3580,10 +3380,8 @@ TestlocaleCmd( static void CleanupTestSetassocdataTests( void *clientData, /* Data to be released. */ - Tcl_Interp *dummy) /* Interpreter being deleted. */ + TCL_UNUSED(Tcl_Interp *)) { - (void)dummy; - ckfree(clientData); } @@ -3606,7 +3404,7 @@ CleanupTestSetassocdataTests( static int TestparserObjCmd( - void *dummy1, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -3614,7 +3412,6 @@ TestparserObjCmd( const char *script; int length, dummy; Tcl_Parse parse; - (void)dummy1; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "script length"); @@ -3663,7 +3460,7 @@ TestparserObjCmd( static int TestexprparserObjCmd( - void *dummy1, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -3671,7 +3468,6 @@ TestexprparserObjCmd( const char *script; int length, dummy; Tcl_Parse parse; - (void)dummy1; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "expr length"); @@ -3811,13 +3607,12 @@ PrintParse( static int TestparsevarObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { const char *value, *name, *termPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "varName"); @@ -3853,7 +3648,7 @@ TestparsevarObjCmd( static int TestparsevarnameObjCmd( - void *dummy1, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -3861,7 +3656,6 @@ TestparsevarnameObjCmd( const char *script; int append, length, dummy; Tcl_Parse parse; - (void)dummy1; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "script length append"); @@ -3917,15 +3711,12 @@ TestparsevarnameObjCmd( static int TestpreferstableObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* The argument objects. */ + TCL_UNUSED(int) /*objc*/, + TCL_UNUSED(Tcl_Obj *const *) /*objv*/) { Interp *iPtr = (Interp *) interp; - (void)dummy; - (void)objc; - (void)objv; iPtr->packagePrefer = PKG_PREFER_STABLE; return TCL_OK; @@ -3950,14 +3741,13 @@ TestpreferstableObjCmd( static int TestprintObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { Tcl_WideInt argv1 = 0; size_t argv2; - (void)dummy; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "format wideint"); @@ -3993,7 +3783,7 @@ TestprintObjCmd( /* ARGSUSED */ static int TestregexpObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -4016,7 +3806,6 @@ TestregexpObjCmd( REGEXP_XFLAGS, REGEXP_LAST }; - (void)dummy; indices = 0; about = 0; @@ -4318,16 +4107,11 @@ TestregexpXflags( /* ARGSUSED */ static int TestreturnObjCmd( - void *dummy, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ + TCL_UNUSED(ClientData), + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(int) /*objc*/, + TCL_UNUSED(Tcl_Obj *const *) /*objv*/) { - (void)dummy; - (void)interp; - (void)objc; - (void)objv; - return TCL_RETURN; } @@ -4351,14 +4135,13 @@ TestreturnObjCmd( static int TestsetassocdataCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { char *buf, *oldData; Tcl_InterpDeleteProc *procPtr; - (void)dummy; if (argc != 3) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], @@ -4403,14 +4186,13 @@ TestsetassocdataCmd( static int TestsetplatformCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { size_t length; TclPlatformType *platform; - (void)dummy; platform = TclGetPlatform(); @@ -4453,13 +4235,12 @@ TestsetplatformCmd( static int TeststaticpkgCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { int safe, loaded; - (void)dummy; if (argc != 4) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", @@ -4505,14 +4286,13 @@ StaticInitProc( static int TesttranslatefilenameCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { Tcl_DString buffer; const char *result; - (void)dummy; if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", @@ -4548,13 +4328,12 @@ TesttranslatefilenameCmd( /* ARGSUSED */ static int TestupvarCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { int flags = 0; - (void)dummy; if ((argc != 5) && (argc != 6)) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", @@ -4602,13 +4381,11 @@ TestupvarCmd( /* ARGSUSED */ static int TestseterrorcodeCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { - (void)dummy; - if (argc > 6) { Tcl_AppendResult(interp, "too many args", NULL); return TCL_ERROR; @@ -4657,13 +4434,11 @@ TestseterrorcodeCmd( /* ARGSUSED */ static int TestsetobjerrorcodeCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { - (void)dummy; - Tcl_SetObjErrorCode(interp, Tcl_ConcatObj(objc - 1, objv + 1)); return TCL_ERROR; } @@ -4688,7 +4463,7 @@ TestsetobjerrorcodeCmd( /* ARGSUSED */ static int TestfeventCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -4696,7 +4471,6 @@ TestfeventCmd( static Tcl_Interp *interp2 = NULL; int code; Tcl_Channel chan; - (void)dummy; if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -4761,21 +4535,17 @@ TestfeventCmd( static int TestpanicCmd( - void *dummy, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ + TCL_UNUSED(ClientData), + TCL_UNUSED(Tcl_Interp *), int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { - char *argString; - (void)dummy; - (void)interp; - /* * Put the arguments into a var args structure * Append all of the arguments together separated by spaces */ - argString = Tcl_Merge(argc-1, argv+1); + char *argString = Tcl_Merge(argc-1, argv+1); Tcl_Panic("%s", argString); ckfree(argString); @@ -4784,7 +4554,7 @@ TestpanicCmd( static int TestfileCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ Tcl_Obj *const argv[]) /* The argument objects. */ @@ -4792,7 +4562,6 @@ TestfileCmd( int force, i, j, result; Tcl_Obj *error = NULL; const char *subcmd; - (void)dummy; if (argc < 3) { return TCL_ERROR; @@ -4867,7 +4636,7 @@ TestfileCmd( static int TestgetvarfullnameCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -4877,7 +4646,6 @@ TestgetvarfullnameCmd( Tcl_Namespace *namespacePtr; Tcl_CallFrame *framePtr; Tcl_Var variable; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "name scope"); @@ -4942,10 +4710,10 @@ TestgetvarfullnameCmd( static int GetTimesObjCmd( - void *dummy, /* Unused. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* The current interpreter. */ - int cobjc, /* Number of arguments. */ - Tcl_Obj *const cobjv[]) /* The argument objects. */ + TCL_UNUSED(int) /*cobjc*/, + TCL_UNUSED(Tcl_Obj *const *) /*cobjv*/) { Interp *iPtr = (Interp *) interp; int i, n; @@ -4954,9 +4722,6 @@ GetTimesObjCmd( Tcl_Obj *objPtr, **objv; const char *s; char newString[TCL_INTEGER_SPACE]; - (void)dummy; - (void)cobjc; - (void)cobjv; /* alloc & free 100000 times */ fprintf(stderr, "alloc & free 100000 6 word items\n"); @@ -5124,16 +4889,11 @@ GetTimesObjCmd( static int NoopCmd( - void *dummy, /* Unused. */ - Tcl_Interp *interp, /* The current interpreter. */ - int argc, /* The number of arguments. */ - const char **argv) /* The argument strings. */ + TCL_UNUSED(ClientData), + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(int) /*argc*/, + TCL_UNUSED(const char **) /*argv*/) { - (void)dummy; - (void)interp; - (void)argc; - (void)argv; - return TCL_OK; } @@ -5156,16 +4916,11 @@ NoopCmd( static int NoopObjCmd( - void *dummy, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* The argument objects. */ + TCL_UNUSED(ClientData), + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(int) /*objc*/, + TCL_UNUSED(Tcl_Obj *const *) /*objv*/) { - (void)dummy; - (void)interp; - (void)objc; - (void)objv; - return TCL_OK; } @@ -5186,14 +4941,13 @@ NoopObjCmd( static int TeststringbytesObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { int n; const unsigned char *p; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "value"); @@ -5227,13 +4981,12 @@ TeststringbytesObjCmd( static int TestpurebytesobjObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { Tcl_Obj *objPtr; - (void)dummy; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?string?"); @@ -5275,14 +5028,13 @@ TestpurebytesobjObjCmd( static int TestbytestringObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { int n = 0; const char *p; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "bytearray"); @@ -5400,7 +5152,7 @@ Testset2Cmd( /* ARGSUSED */ static int TestsaveresultCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp,/* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -5415,7 +5167,6 @@ TestsaveresultCmd( enum options { RESULT_APPEND, RESULT_DYNAMIC, RESULT_FREE, RESULT_OBJECT, RESULT_SMALL }; - (void)dummy; /* * Parse arguments @@ -5508,9 +5259,8 @@ TestsaveresultCmd( static void TestsaveresultFree( - char *blockPtr) + TCL_UNUSED(char *)) { - (void)blockPtr; freeCount++; } @@ -5533,14 +5283,11 @@ TestsaveresultFree( static int TestmainthreadCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp,/* Current interpreter. */ int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + TCL_UNUSED(const char **) /*argv*/) { - (void)dummy; - (void)argv; - if (argc == 1) { Tcl_Obj *idObj = Tcl_NewWideIntObj((Tcl_WideInt)(size_t)Tcl_GetCurrentThread()); @@ -5597,16 +5344,11 @@ MainLoop(void) static int TestsetmainloopCmd( - void *dummy, /* Not used. */ - Tcl_Interp *interp,/* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + TCL_UNUSED(ClientData), + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(int) /*argc*/, + TCL_UNUSED(const char **) /*argv*/) { - (void)dummy; - (void)interp; - (void)argc; - (void)argv; - exitMainLoop = 0; Tcl_SetMainLoop(MainLoop); return TCL_OK; @@ -5631,16 +5373,11 @@ TestsetmainloopCmd( static int TestexitmainloopCmd( - void *dummy, /* Not used. */ - Tcl_Interp *interp,/* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + TCL_UNUSED(ClientData), + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(int) /*argc*/, + TCL_UNUSED(const char **) /*argv*/) { - (void)dummy; - (void)interp; - (void)argc; - (void)argv; - exitMainLoop = 1; return TCL_OK; } @@ -5665,7 +5402,7 @@ TestexitmainloopCmd( /* ARGSUSED */ static int TestChannelCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter for result. */ int argc, /* Count of additional args. */ const char **argv) /* Additional arg strings. */ @@ -5681,7 +5418,6 @@ TestChannelCmd( int IOQueued; /* How much IO is queued inside channel? */ char buf[TCL_INTEGER_SPACE];/* For sprintf. */ int mode; /* rw mode of the channel */ - (void)dummy; if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -6135,7 +5871,7 @@ TestChannelCmd( /* ARGSUSED */ static int TestChannelEventCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -6146,7 +5882,6 @@ TestChannelEventCmd( EventScriptRecord *esPtr, *prevEsPtr, *nextEsPtr; const char *cmd; int index, i, mask, len; - (void)dummy; if ((argc < 3) || (argc > 5)) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -6349,14 +6084,13 @@ TestChannelEventCmd( /* ARGSUSED */ static int TestSocketCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Interpreter for result. */ int argc, /* Count of additional args. */ const char **argv) /* Additional arg strings. */ { const char *cmdName; /* Sub command. */ size_t len; /* Length of subcommand string. */ - (void)dummy; if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -6417,14 +6151,13 @@ TestSocketCmd( static int TestWrongNumArgsObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int i, length; const char *msg; - (void)dummy; if (objc < 3) { /* @@ -6474,7 +6207,7 @@ TestWrongNumArgsObjCmd( static int TestGetIndexFromObjStructObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -6483,7 +6216,6 @@ TestGetIndexFromObjStructObjCmd( "a", "b", "c", "d", "e", "f", NULL, NULL }; int idx,target; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "argument targetvalue"); @@ -6529,14 +6261,13 @@ TestGetIndexFromObjStructObjCmd( static int TestFilesystemObjCmd( - void *dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { int res, boolVal; const char *msg; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "boolean"); @@ -6866,12 +6597,10 @@ TestReportUtime( static int TestReportNormalizePath( - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), Tcl_Obj *pathPtr, int nextCheckpoint) { - (void)dummy; - TestReport("normalizepath", pathPtr, NULL); return nextCheckpoint; } @@ -6879,10 +6608,9 @@ TestReportNormalizePath( static int SimplePathInFilesystem( Tcl_Obj *pathPtr, - void **dummy) + TCL_UNUSED(ClientData *)) { const char *str = Tcl_GetString(pathPtr); - (void)dummy; if (strncmp(str, "simplefs:/", 10)) { return -1; @@ -6909,14 +6637,13 @@ SimplePathInFilesystem( static int TestSimpleFilesystemObjCmd( - void *dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { int res, boolVal; const char *msg; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "boolean"); @@ -7070,13 +6797,11 @@ SimpleListVolumes(void) static int TestNumUtfCharsCmd( - void *dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; - if (objc > 1) { int len = -1; @@ -7095,13 +6820,11 @@ TestNumUtfCharsCmd( static int TestFindFirstCmd( - void *dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; - if (objc > 1) { int len = -1; @@ -7119,13 +6842,11 @@ TestFindFirstCmd( static int TestFindLastCmd( - void *dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - (void)dummy; - if (objc > 1) { int len = -1; @@ -7163,7 +6884,7 @@ TestFindLastCmd( static int TestcpuidCmd( - void *dummy, + TCL_UNUSED(ClientData), Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const * objv) /* Parameter vector */ @@ -7171,7 +6892,6 @@ TestcpuidCmd( int status, index, i; int regs[4]; Tcl_Obj *regsObjs[4]; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "eax"); @@ -7200,7 +6920,7 @@ TestcpuidCmd( static int TestHashSystemHashCmd( - void *dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -7212,7 +6932,6 @@ TestHashSystemHashCmd( Tcl_HashTable hash; Tcl_HashEntry *hPtr; int i, isNew, limit = 100; - (void)dummy; if (objc>1 && Tcl_GetIntFromObj(interp, objv[1], &limit)!=TCL_OK) { return TCL_ERROR; @@ -7277,13 +6996,11 @@ TestHashSystemHashCmd( */ static int TestgetintCmd( - void *dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int argc, const char **argv) { - (void)dummy; - if (argc < 2) { Tcl_AppendResult(interp, "wrong # args", NULL); return TCL_ERROR; @@ -7306,14 +7023,11 @@ TestgetintCmd( */ static int TestlongsizeCmd( - void *dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int argc, - const char **argv) + TCL_UNUSED(const char **) /*argv*/) { - (void)dummy; - (void)argv; - if (argc != 1) { Tcl_AppendResult(interp, "wrong # args", NULL); return TCL_ERROR; @@ -7326,10 +7040,9 @@ static int NREUnwind_callback( void *data[], Tcl_Interp *interp, - int result) + TCL_UNUSED(int) /*result*/) { int none; - (void)result; if (data[0] == INT2PTR(-1)) { Tcl_NRAddCallback(interp, NREUnwind_callback, &none, INT2PTR(-1), @@ -7352,14 +7065,11 @@ NREUnwind_callback( static int TestNREUnwind( - void *dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, - int objc, - Tcl_Obj *const objv[]) + TCL_UNUSED(int) /*objc*/, + TCL_UNUSED(Tcl_Obj *const *) /*objv*/) { - (void)dummy; - (void)objc; - (void)objv; /* * Insure that callbacks effectively run at the proper level during the * unwinding of the NRE stack. @@ -7373,10 +7083,10 @@ TestNREUnwind( static int TestNRELevels( - void *dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, - int objc, - Tcl_Obj *const objv[]) + TCL_UNUSED(int) /*objc*/, + TCL_UNUSED(Tcl_Obj *const *) /*objv*/) { Interp *iPtr = (Interp *) interp; static ptrdiff_t *refDepth = NULL; @@ -7384,9 +7094,6 @@ TestNRELevels( Tcl_Obj *levels[6]; int i = 0; NRE_callback *cbPtr = iPtr->execEnvPtr->callbackPtr; - (void)dummy; - (void)objc; - (void)objv; if (refDepth == NULL) { refDepth = &depth; @@ -7432,17 +7139,14 @@ TestNRELevels( static int TestconcatobjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + TCL_UNUSED(int) /*argc*/, + TCL_UNUSED(const char **) /*argv*/) { Tcl_Obj *list1Ptr, *list2Ptr, *emptyPtr, *concatPtr, *tmpPtr; int result = TCL_OK, len; Tcl_Obj *objv[3]; - (void)dummy; - (void)argc; - (void)argv; /* * Set the start of the error message as obj result; it will be cleared at @@ -7731,13 +7435,11 @@ TestconcatobjCmd( static int TestgetencpathObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ { - (void)dummy; - if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; @@ -7766,13 +7468,11 @@ TestgetencpathObjCmd( static int TestsetencpathObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ { - (void)dummy; - if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "defaultDir"); return TCL_ERROR; @@ -7802,7 +7502,7 @@ TestsetencpathObjCmd( static int TestparseargsCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Arguments. */ @@ -7814,7 +7514,6 @@ TestparseargsCmd( {TCL_ARGV_CONSTANT, "-bool", INT2PTR(1), &foo, "booltest", NULL}, TCL_ARGV_AUTO_REST, TCL_ARGV_AUTO_HELP, TCL_ARGV_TABLE_END }; - (void)dummy; foo = 0; if (Tcl_ParseArgsObjv(interp, argTable, &count, objv, &remObjv)!=TCL_OK) { @@ -7836,8 +7535,8 @@ static int InterpCmdResolver( Tcl_Interp *interp, const char *name, - Tcl_Namespace *context, - int flags, + TCL_UNUSED(Tcl_Namespace *), + TCL_UNUSED(int) /*flags*/, Tcl_Command *rPtr) { Interp *iPtr = (Interp *) interp; @@ -7846,8 +7545,6 @@ InterpCmdResolver( varFramePtr->procPtr : NULL; Namespace *callerNsPtr = varFramePtr->nsPtr; Tcl_Command resolvedCmdPtr = NULL; - (void)context; - (void)flags; /* * Just do something special on a cmd literal "z" in two cases: @@ -7929,18 +7626,12 @@ InterpCmdResolver( static int InterpVarResolver( - Tcl_Interp *interp, - const char *name, - Tcl_Namespace *context, - int flags, - Tcl_Var *rPtr) + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(const char *), + TCL_UNUSED(Tcl_Namespace *), + TCL_UNUSED(int), + TCL_UNUSED(Tcl_Var *)) { - (void)interp; - (void)name; - (void)context; - (void)flags; - (void)rPtr; - /* * Don't resolve the variable; use standard rules. */ @@ -8028,16 +7719,12 @@ MyCompiledVarFetch( static int InterpCompiledVarResolver( - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), const char *name, - int length, - Tcl_Namespace *context, + TCL_UNUSED(int) /*length*/, + TCL_UNUSED(Tcl_Namespace *), Tcl_ResolvedVarInfo **rPtr) { - (void)dummy; - (void)length; - (void)context; - if (*name == 'T') { MyResolvedVarInfo *resVarInfo = (MyResolvedVarInfo *)ckalloc(sizeof(MyResolvedVarInfo)); @@ -8054,7 +7741,7 @@ InterpCompiledVarResolver( static int TestInterpResolverCmd( - void *dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -8064,7 +7751,6 @@ TestInterpResolverCmd( }; int idx; #define RESOLVER_KEY "testInterpResolver" - (void)dummy; if ((objc < 2) || (objc > 3)) { Tcl_WrongNumArgs(interp, 1, objv, "up|down ?interp?"); diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index cfe7886..bfd0a45 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -42,23 +42,14 @@ static int CheckIfVarUnset(Tcl_Interp *interp, Tcl_Obj **varPtr, int varIndex); static int GetVariableIndex(Tcl_Interp *interp, const char *string, int *indexPtr); static void SetVarToObj(Tcl_Obj **varPtr, int varIndex, Tcl_Obj *objPtr); -static int TestbignumobjCmd(void *dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int TestbooleanobjCmd(void *dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestdoubleobjCmd(void *dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int TestindexobjCmd(void *dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int TestintobjCmd(void *dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int TestlistobjCmd(void *dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int TestobjCmd(void *dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static int TeststringobjCmd(void *dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc TestbignumobjCmd; +static Tcl_ObjCmdProc TestbooleanobjCmd; +static Tcl_ObjCmdProc TestdoubleobjCmd; +static Tcl_ObjCmdProc TestindexobjCmd; +static Tcl_ObjCmdProc TestintobjCmd; +static Tcl_ObjCmdProc TestlistobjCmd; +static Tcl_ObjCmdProc TestobjCmd; +static Tcl_ObjCmdProc TeststringobjCmd; #define VARPTR_KEY "TCLOBJTEST_VARPTR" #define NUMBER_OF_OBJECT_VARS 20 @@ -158,7 +149,7 @@ TclObjTest_Init( static int TestbignumobjCmd( - void *dummy, /* unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Argument count */ Tcl_Obj *const objv[]) /* Argument vector */ @@ -174,7 +165,6 @@ TestbignumobjCmd( const char *string; mp_int bignumValue; Tcl_Obj **varPtr; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -358,7 +348,7 @@ TestbignumobjCmd( static int TestbooleanobjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -366,7 +356,6 @@ TestbooleanobjCmd( int varIndex, boolValue; const char *index, *subCmd; Tcl_Obj **varPtr; - (void)dummy; if (objc < 3) { wrongNumArgs: @@ -459,7 +448,7 @@ TestbooleanobjCmd( static int TestdoubleobjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -468,7 +457,6 @@ TestdoubleobjCmd( double doubleValue; const char *index, *subCmd, *string; Tcl_Obj **varPtr; - (void)dummy; if (objc < 3) { wrongNumArgs: @@ -578,7 +566,7 @@ TestdoubleobjCmd( static int TestindexobjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -596,7 +584,6 @@ TestindexobjCmd( int index; /* Selected index into table. */ }; struct IndexRep *indexRep; - (void)dummy; if ((objc == 3) && (strcmp(Tcl_GetString(objv[1]), "check") == 0)) { @@ -669,7 +656,7 @@ TestindexobjCmd( static int TestintobjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -678,7 +665,6 @@ TestintobjCmd( Tcl_WideInt wideValue; const char *index, *subCmd, *string; Tcl_Obj **varPtr; - (void)dummy; if (objc < 3) { wrongNumArgs: @@ -874,7 +860,7 @@ TestintobjCmd( static int TestlistobjCmd( - void *dummy, /* Not used */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ @@ -897,7 +883,6 @@ TestlistobjCmd( int first; /* First index in the list */ int count; /* Count of elements in a list */ Tcl_Obj **varPtr; - (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option arg ?arg...?"); @@ -972,7 +957,7 @@ TestlistobjCmd( static int TestobjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -981,7 +966,6 @@ TestobjCmd( const char *index, *subCmd, *string; const Tcl_ObjType *targetType; Tcl_Obj **varPtr; - (void)dummy; if (objc < 2) { wrongNumArgs: @@ -1185,7 +1169,7 @@ TestobjCmd( static int TeststringobjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1201,7 +1185,6 @@ TeststringobjCmd( "set", "set2", "setlength", "maxchars", "appendself", "appendself2", NULL }; - (void)dummy; if (objc < 3) { wrongNumArgs: diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c index b6ac741..09dfbef 100644 --- a/generic/tclTestProcBodyObj.c +++ b/generic/tclTestProcBodyObj.c @@ -228,7 +228,7 @@ ProcBodyTestInitInternal( static int ProcBodyTestProcObjCmd( - void *dummy, /* context; not used */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* the current interpreter */ int objc, /* argument count */ Tcl_Obj *const objv[]) /* arguments */ @@ -240,7 +240,6 @@ ProcBodyTestProcObjCmd( Tcl_Obj *bodyObjPtr; Tcl_Obj *myobjv[5]; int result; - (void)dummy; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "newName argsList bodyName"); @@ -328,13 +327,12 @@ ProcBodyTestProcObjCmd( static int ProcBodyTestCheckObjCmd( - void *dummy, /* context; not used */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* the current interpreter */ int objc, /* argument count */ Tcl_Obj *const objv[]) /* arguments */ { const char *version; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index 1248f5d..1aa2be1 100644 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -872,11 +872,9 @@ LockBucket( static void UnlockBucket( - Cache *cachePtr, + TCL_UNUSED(Cache *), int bucket) { - (void)cachePtr; - Tcl_MutexUnlock(bucketInfo[bucket].lockPtr); } diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index 7fc748e..961a56a 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -206,7 +206,7 @@ TclThread_Init( /* ARGSUSED */ static int ThreadObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -223,7 +223,6 @@ ThreadObjCmd( THREAD_ID, THREAD_JOIN, THREAD_NAMES, THREAD_SEND, THREAD_WAIT, THREAD_ERRORPROC }; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1011,7 +1010,7 @@ ThreadCancel( static int ThreadEventProc( Tcl_Event *evPtr, /* Really ThreadEvent */ - int mask) + TCL_UNUSED(int) /*mask*/) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); ThreadEvent *threadEventPtr = (ThreadEvent *) evPtr; @@ -1019,7 +1018,6 @@ ThreadEventProc( Tcl_Interp *interp = tsdPtr->interp; int code; const char *result, *errorCode, *errorInfo; - (void)mask; if (interp == NULL) { code = TCL_ERROR; @@ -1111,10 +1109,8 @@ ThreadFreeProc( static int ThreadDeleteEvent( Tcl_Event *eventPtr, /* Really ThreadEvent */ - void *dummy) /* dummy */ + TCL_UNUSED(ClientData)) { - (void)dummy; - if (eventPtr->proc == ThreadEventProc) { ckfree(((ThreadEvent *) eventPtr)->script); return 1; -- cgit v0.12 From a8870a4faede58af23c1054436fe9baa727cb3cf Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 9 Mar 2020 13:15:02 +0000 Subject: More --- generic/tclTimer.c | 18 ++++++------------ generic/tclTrace.c | 14 ++++---------- generic/tclUtil.c | 8 +++----- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/generic/tclTimer.c b/generic/tclTimer.c index 55466cc..db2c7d5 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.c @@ -211,10 +211,9 @@ InitTimer(void) static void TimerExitProc( - ClientData dummy) /* Not used. */ + TCL_UNUSED(ClientData)) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey); - (void)dummy; Tcl_DeleteEventSource(TimerSetupProc, TimerCheckProc, NULL); if (tsdPtr != NULL) { @@ -399,12 +398,11 @@ Tcl_DeleteTimerHandler( static void TimerSetupProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { Tcl_Time blockTime; ThreadSpecificData *tsdPtr = InitTimer(); - (void)dummy; if (((flags & TCL_IDLE_EVENTS) && tsdPtr->idleList) || ((flags & TCL_TIMER_EVENTS) && tsdPtr->timerPending)) { @@ -458,13 +456,12 @@ TimerSetupProc( static void TimerCheckProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { Tcl_Event *timerEvPtr; Tcl_Time blockTime; ThreadSpecificData *tsdPtr = InitTimer(); - (void)dummy; if ((flags & TCL_TIMER_EVENTS) && tsdPtr->firstTimerHandlerPtr) { /* @@ -521,7 +518,7 @@ TimerCheckProc( static int TimerHandlerEventProc( - Tcl_Event *evPtr, /* Event to service. */ + TCL_UNUSED(Tcl_Event *), int flags) /* Flags that indicate what events to handle, * such as TCL_FILE_EVENTS. */ { @@ -529,7 +526,6 @@ TimerHandlerEventProc( Tcl_Time time; int currentTimerId; ThreadSpecificData *tsdPtr = InitTimer(); - (void)evPtr; /* * Do nothing if timers aren't enabled. This leaves the event on the @@ -783,7 +779,7 @@ TclServiceIdle(void) /* ARGSUSED */ int Tcl_AfterObjCmd( - ClientData dummy, /* Unused */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -799,7 +795,6 @@ Tcl_AfterObjCmd( }; enum afterSubCmds {AFTER_CANCEL, AFTER_IDLE, AFTER_INFO}; ThreadSpecificData *tsdPtr = InitTimer(); - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1258,11 +1253,10 @@ static void AfterCleanupProc( ClientData clientData, /* Points to AfterAssocData for the * interpreter. */ - Tcl_Interp *dummy) /* Interpreter that is being deleted. */ + TCL_UNUSED(Tcl_Interp *)) { AfterAssocData *assocPtr = (AfterAssocData *)clientData; AfterInfo *afterPtr; - (void)dummy; while (assocPtr->firstAfterPtr != NULL) { afterPtr = assocPtr->firstAfterPtr; diff --git a/generic/tclTrace.c b/generic/tclTrace.c index a7d0c72..5d69a49 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -184,7 +184,7 @@ typedef struct { /* ARGSUSED */ int Tcl_TraceObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -209,7 +209,6 @@ Tcl_TraceObjCmd( TRACE_OLD_VARIABLE, TRACE_OLD_VDELETE, TRACE_OLD_VINFO #endif }; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1040,8 +1039,7 @@ ClientData Tcl_CommandTraceInfo( Tcl_Interp *interp, /* Interpreter containing command. */ const char *cmdName, /* Name of command. */ - int flags, /* OR-ed combo or TCL_GLOBAL_ONLY, - * TCL_NAMESPACE_ONLY (can be 0). */ + TCL_UNUSED(int) /*flags*/, Tcl_CommandTraceProc *proc, /* Function assocated with trace. */ ClientData prevClientData) /* If non-NULL, gives last value returned by * this function, so this call will return the @@ -1050,7 +1048,6 @@ Tcl_CommandTraceInfo( { Command *cmdPtr; CommandTrace *tracePtr; - (void)flags; cmdPtr = (Command *) Tcl_FindCommand(interp, cmdName, NULL, TCL_LEAVE_ERR_MSG); @@ -1424,8 +1421,7 @@ TclCheckExecutionTraces( Tcl_Interp *interp, /* The current interpreter. */ const char *command, /* Pointer to beginning of the current command * string. */ - int numChars, /* The number of characters in 'command' which - * are part of the command string. */ + TCL_UNUSED(int) /*numChars*/, Command *cmdPtr, /* Points to command's Command struct. */ int code, /* The current result code. */ int traceFlags, /* Current tracing situation. */ @@ -1438,7 +1434,6 @@ TclCheckExecutionTraces( int curLevel; int traceCode = TCL_OK; Tcl_InterpState state = NULL; - (void)numChars; if (cmdPtr->tracePtr == NULL) { return traceCode; @@ -1765,7 +1760,7 @@ TraceExecutionProc( Tcl_Interp *interp, int level, const char *command, - Tcl_Command cmdInfo, + TCL_UNUSED(Tcl_Command), int objc, struct Tcl_Obj *const objv[]) { @@ -1775,7 +1770,6 @@ TraceExecutionProc( int flags = tcmdPtr->curFlags; int code = tcmdPtr->curCode; int traceCode = TCL_OK; - (void)cmdInfo; if (tcmdPtr->flags & TCL_TRACE_EXEC_IN_PROGRESS) { /* diff --git a/generic/tclUtil.c b/generic/tclUtil.c index b736d5d..7a05d95 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2475,11 +2475,10 @@ TclByteArrayMatch( /* Pattern, which may contain special * characters. */ int ptnLen, /* Length of Pattern */ - int flags) + TCL_UNUSED(int) /*flags*/) { const unsigned char *stringEnd, *patternEnd; unsigned char p; - (void)flags; stringEnd = string + strLen; patternEnd = pattern + ptnLen; @@ -3264,7 +3263,7 @@ Tcl_DStringEndSublist( void Tcl_PrintDouble( - Tcl_Interp *dummy, /* Not used. */ + TCL_UNUSED(Tcl_Interp *), double value, /* Value to print as string. */ char *dst) /* Where to store converted value; must have * at least TCL_DOUBLE_SPACE characters. */ @@ -3275,7 +3274,6 @@ Tcl_PrintDouble( char *digits; char *end; int *precisionPtr = (int *)Tcl_GetThreadData(&precisionKey, sizeof(int)); - (void)dummy; /* * Handle NaN. @@ -3441,7 +3439,7 @@ Tcl_PrintDouble( /* ARGSUSED */ char * TclPrecTraceProc( - ClientData clientData, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ -- cgit v0.12 From a5406cf5c0fe5d9df20c96546433bbd707937675 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 9 Mar 2020 14:34:27 +0000 Subject: more --- generic/tclVar.c | 79 +++++++++++--------------------- generic/tclZipfs.c | 129 +++++++++++++++++------------------------------------ 2 files changed, 69 insertions(+), 139 deletions(-) diff --git a/generic/tclVar.c b/generic/tclVar.c index 2c2f967..40170dc 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -188,8 +188,7 @@ static void ArrayPopulateSearch(Tcl_Interp *interp, static void ArrayDoneSearch(Interp *iPtr, Var *varPtr, ArraySearch *searchPtr); static Tcl_NRPostProc ArrayForLoopCallback; -static int ArrayForNRCmd(ClientData dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv); +static Tcl_ObjCmdProc ArrayForNRCmd; static void DeleteSearches(Interp *iPtr, Var *arrayVarPtr); static void DeleteArray(Interp *iPtr, Tcl_Obj *arrayNamePtr, Var *varPtr, int flags, int index); @@ -1528,13 +1527,12 @@ TclPtrGetVarIdx( /* ARGSUSED */ int Tcl_SetObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp,/* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *varValueObj; - (void)dummy; if (objc == 2) { varValueObj = Tcl_ObjGetVar2(interp, objv[1], NULL,TCL_LEAVE_ERR_MSG); @@ -2824,14 +2822,13 @@ UnsetVarStruct( /* ARGSUSED */ int Tcl_UnsetObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int i, flags = TCL_LEAVE_ERR_MSG; const char *name; - (void)dummy; if (objc == 1) { /* @@ -2893,7 +2890,7 @@ Tcl_UnsetObjCmd( /* ARGSUSED */ int Tcl_AppendObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2902,7 +2899,6 @@ Tcl_AppendObjCmd( Tcl_Obj *varValuePtr = NULL; /* Initialized to avoid compiler warning. */ int i; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "varName ?value ...?"); @@ -2960,7 +2956,7 @@ Tcl_AppendObjCmd( /* ARGSUSED */ int Tcl_LappendObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2969,7 +2965,6 @@ Tcl_LappendObjCmd( int numElems, createdNewObj; Var *varPtr, *arrayPtr; int result; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "varName ?value ...?"); @@ -3167,17 +3162,17 @@ ArrayObjNext( static int ArrayForObjCmd( - ClientData dummy, /* Not used. */ + ClientData clientData, Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, ArrayForNRCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, ArrayForNRCmd, clientData, objc, objv); } static int ArrayForNRCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) @@ -3186,7 +3181,6 @@ ArrayForNRCmd( ArraySearch *searchPtr = NULL; Var *varPtr; int isArray, numVars; - (void)dummy; /* * array for {k v} a body @@ -3409,7 +3403,7 @@ ArrayPopulateSearch( static int ArrayStartSearchCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -3417,7 +3411,6 @@ ArrayStartSearchCmd( Var *varPtr; int isArray; ArraySearch *searchPtr; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName"); @@ -3506,7 +3499,7 @@ ArrayDoneSearch( /* ARGSUSED */ static int ArrayAnyMoreCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -3516,7 +3509,6 @@ ArrayAnyMoreCmd( Tcl_Obj *varNameObj, *searchObj; int gotValue, isArray; ArraySearch *searchPtr; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName searchId"); @@ -3586,7 +3578,7 @@ ArrayAnyMoreCmd( /* ARGSUSED */ static int ArrayNextElementCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -3595,7 +3587,6 @@ ArrayNextElementCmd( Tcl_Obj *varNameObj, *searchObj; ArraySearch *searchPtr; int isArray; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName searchId"); @@ -3668,7 +3659,7 @@ ArrayNextElementCmd( /* ARGSUSED */ static int ArrayDoneSearchCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -3678,7 +3669,6 @@ ArrayDoneSearchCmd( Tcl_Obj *varNameObj, *searchObj; ArraySearch *searchPtr; int isArray; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName searchId"); @@ -3730,14 +3720,13 @@ ArrayDoneSearchCmd( /* ARGSUSED */ static int ArrayExistsCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Interp *iPtr = (Interp *)interp; int isArray; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName"); @@ -3772,7 +3761,7 @@ ArrayExistsCmd( /* ARGSUSED */ static int ArrayGetCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -3783,7 +3772,6 @@ ArrayGetCmd( Tcl_HashSearch search; const char *pattern; int i, count, result, isArray; - (void)dummy; switch (objc) { case 2: @@ -3933,7 +3921,7 @@ ArrayGetCmd( /* ARGSUSED */ static int ArrayNamesCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -3947,7 +3935,6 @@ ArrayNamesCmd( Tcl_HashSearch search; const char *pattern = NULL; int isArray, mode = OPT_GLOB; - (void)dummy; if ((objc < 2) || (objc > 4)) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName ?mode? ?pattern?"); @@ -4102,7 +4089,7 @@ TclFindArrayPtrElements( /* ARGSUSED */ static int ArraySetCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -4111,7 +4098,6 @@ ArraySetCmd( Tcl_Obj *arrayElemObj; Var *varPtr, *arrayPtr; int result, i; - (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName list"); @@ -4279,7 +4265,7 @@ ArraySetCmd( /* ARGSUSED */ static int ArraySizeCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -4288,7 +4274,6 @@ ArraySizeCmd( Tcl_HashSearch search; Var *varPtr2; int isArray, size = 0; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName"); @@ -4340,7 +4325,7 @@ ArraySizeCmd( /* ARGSUSED */ static int ArrayStatsCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -4349,7 +4334,6 @@ ArrayStatsCmd( Tcl_Obj *varNameObj; char *stats; int isArray; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName"); @@ -4396,7 +4380,7 @@ ArrayStatsCmd( /* ARGSUSED */ static int ArrayUnsetCmd( - ClientData dummy, + TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -4407,7 +4391,6 @@ ArrayUnsetCmd( const char *pattern; const int unsetFlags = 0; /* Should this be TCL_LEAVE_ERR_MSG? */ int isArray; - (void)dummy; switch (objc) { case 2: @@ -5023,7 +5006,7 @@ Tcl_GetVariableFullName( int Tcl_GlobalObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -5033,7 +5016,6 @@ Tcl_GlobalObjCmd( const char *varName; const char *tail; int result, i; - (void)dummy; /* * If we are not executing inside a Tcl procedure, just return. @@ -5128,7 +5110,7 @@ Tcl_GlobalObjCmd( int Tcl_VariableObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -5139,7 +5121,6 @@ Tcl_VariableObjCmd( Tcl_Obj *varValuePtr; int i, result; Tcl_Obj *varNamePtr, *tailPtr; - (void)dummy; for (i=1 ; iflags = VAR_IN_HASHTABLE; @@ -6669,7 +6645,7 @@ CompareVarKeys( /* ARGSUSED */ static int ArrayDefaultCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -6681,7 +6657,6 @@ ArrayDefaultCmd( Tcl_Obj *arrayNameObj, *defaultValueObj; Var *varPtr, *arrayPtr; int isArray, option; - (void)dummy; /* * Parse arguments. diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 7fae81e..f9a6a8f 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -386,8 +386,7 @@ static void ZipfsExitHandler(ClientData clientData); static void ZipfsSetup(void); static int ZipChannelClose(void *instanceData, Tcl_Interp *interp, int flags); -static int ZipChannelGetFile(void *instanceData, - int direction, void **handlePtr); +static Tcl_DriverGetHandleProc ZipChannelGetFile; static int ZipChannelRead(void *instanceData, char *buf, int toRead, int *errloc); #ifndef TCL_NO_DEPRECATED @@ -458,7 +457,7 @@ static Tcl_ChannelType ZipChannelType = { NULL, /* Get options, NULL'able */ ZipChannelWatchChannel, /* Initialize notifier */ ZipChannelGetFile, /* Get OS handle from the channel */ - ZipChannelClose, /* 2nd version of close channel, NULL'able */ + ZipChannelClose, /* 2nd version of close channel, NULL'able */ NULL, /* Set blocking mode for raw channel, NULL'able */ NULL, /* Function to flush channel, NULL'able */ NULL, /* Function to handle event, NULL'able */ @@ -1889,12 +1888,11 @@ TclZipfs_Unmount( static int ZipFSMountObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; if (objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -1925,7 +1923,7 @@ ZipFSMountObjCmd( static int ZipFSMountBufferObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1933,7 +1931,6 @@ ZipFSMountBufferObjCmd( const char *mountPoint; /* Mount point path. */ unsigned char *data; int length; - (void)dummy; if (objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "?mountpoint? ?data?"); @@ -1978,15 +1975,11 @@ ZipFSMountBufferObjCmd( static int ZipFSRootObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ + TCL_UNUSED(int) /*objc*/, + TCL_UNUSED(Tcl_Obj *const *)) /*objv*/ { - (void)dummy; - (void)objc; - (void)objv; - Tcl_SetObjResult(interp, Tcl_NewStringObj(ZIPFS_VOLUME, -1)); return TCL_OK; } @@ -2009,12 +2002,11 @@ ZipFSRootObjCmd( static int ZipFSUnmountObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "zipfile"); @@ -2042,14 +2034,13 @@ ZipFSUnmountObjCmd( static int ZipFSMkKeyObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int len, i = 0; char *pw, passBuf[264]; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "password"); @@ -2822,13 +2813,11 @@ ZipFSMkZipOrImgObjCmd( static int ZipFSMkZipObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - if (objc < 3 || objc > 5) { Tcl_WrongNumArgs(interp, 1, objv, "outfile indir ?strip? ?password?"); return TCL_ERROR; @@ -2844,13 +2833,11 @@ ZipFSMkZipObjCmd( static int ZipFSLMkZipObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "outfile inlist ?password?"); return TCL_ERROR; @@ -2883,13 +2870,11 @@ ZipFSLMkZipObjCmd( static int ZipFSMkImgObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - if (objc < 3 || objc > 6) { Tcl_WrongNumArgs(interp, 1, objv, "outfile indir ?strip? ?password? ?infile?"); @@ -2906,13 +2891,11 @@ ZipFSMkImgObjCmd( static int ZipFSLMkImgObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - (void)dummy; - if (objc < 3 || objc > 5) { Tcl_WrongNumArgs(interp, 1, objv, "outfile inlist ?password infile?"); return TCL_ERROR; @@ -2945,7 +2928,7 @@ ZipFSLMkImgObjCmd( static int ZipFSCanonicalObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2954,7 +2937,6 @@ ZipFSCanonicalObjCmd( char *filename = NULL; char *result; Tcl_DString dPath; - (void)dummy; if (objc < 2 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "?mountpoint? filename ?inZipfs?"); @@ -3002,7 +2984,7 @@ ZipFSCanonicalObjCmd( static int ZipFSExistsObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3010,7 +2992,6 @@ ZipFSExistsObjCmd( char *filename; int exists; Tcl_DString ds; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "filename"); @@ -3056,14 +3037,13 @@ ZipFSExistsObjCmd( static int ZipFSInfoObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { char *filename; ZipEntry *z; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "filename"); @@ -3107,7 +3087,7 @@ ZipFSInfoObjCmd( static int ZipFSListObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3117,7 +3097,6 @@ ZipFSListObjCmd( Tcl_HashEntry *hPtr; Tcl_HashSearch search; Tcl_Obj *result = Tcl_GetObjResult(interp); - (void)dummy; if (objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "?(-glob|-regexp)? ?pattern?"); @@ -3305,15 +3284,11 @@ TclZipfs_TclLibrary(void) static int ZipFSTclLibraryObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ + TCL_UNUSED(int) /*objc*/, + TCL_UNUSED(Tcl_Obj *const *)) /*objv*/ { - (void)dummy; - (void)objc; - (void)objv; - if (!Tcl_IsSafe(interp)) { Tcl_Obj *pResult = TclZipfs_TclLibrary(); @@ -3344,11 +3319,10 @@ ZipFSTclLibraryObjCmd( static int ZipChannelClose( void *instanceData, - Tcl_Interp *dummy, /* Current interpreter. */ + TCL_UNUSED(Tcl_Interp *), int flags) { ZipChannel *info = (ZipChannel *)instanceData; - (void)dummy; if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { return EINVAL; @@ -3611,12 +3585,9 @@ ZipChannelSeek( static void ZipChannelWatchChannel( - void *instanceData, - int mask) + TCL_UNUSED(ClientData), + TCL_UNUSED(int) /*mask*/) { - (void)instanceData; - (void)mask; - return; } @@ -3639,14 +3610,10 @@ ZipChannelWatchChannel( static int ZipChannelGetFile( - void *instanceData, - int direction, - void **handlePtr) + TCL_UNUSED(ClientData), + TCL_UNUSED(int) /*direction*/, + TCL_UNUSED(ClientData *) /*handlePtr*/) { - (void)instanceData; - (void)direction; - (void)handlePtr; - return TCL_ERROR; } @@ -3672,13 +3639,12 @@ ZipChannelOpen( Tcl_Interp *interp, /* Current interpreter. */ char *filename, int mode, - int permissions) + TCL_UNUSED(int) /*permissions*/) { ZipEntry *z; ZipChannel *info; int i, ch, trunc, wr, flags = 0; char cname[128]; - (void)permissions; if ((mode & O_APPEND) || ((ZipFS.wrmax <= 0) && (mode & (O_WRONLY | O_RDWR)))) { @@ -4199,10 +4165,8 @@ ZipFSAccessProc( static Tcl_Obj * ZipFSFilesystemSeparatorProc( - Tcl_Obj *pathPtr) + TCL_UNUSED(Tcl_Obj *) /*pathPtr*/) { - (void)pathPtr; - return Tcl_NewStringObj("/", -1); } @@ -4227,7 +4191,7 @@ ZipFSFilesystemSeparatorProc( static int ZipFSMatchInDirectoryProc( - Tcl_Interp *dummy, /* Current interpreter. */ + TCL_UNUSED(Tcl_Interp *), Tcl_Obj *result, Tcl_Obj *pathPtr, const char *pattern, @@ -4240,7 +4204,6 @@ ZipFSMatchInDirectoryProc( size_t len; char *pat, *prefix, *path; Tcl_DString dsPref; - (void)dummy; if (!normPathPtr) { return -1; @@ -4419,14 +4382,13 @@ ZipFSMatchInDirectoryProc( static int ZipFSPathInFilesystemProc( Tcl_Obj *pathPtr, - void **dummy) + TCL_UNUSED(ClientData *)) { Tcl_HashEntry *hPtr; Tcl_HashSearch search; int ret = -1; size_t len; char *path; - (void)dummy; pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr); if (!pathPtr) { @@ -4516,8 +4478,8 @@ ZipFSListVolumesProc(void) static const char *const * ZipFSFileAttrStringsProc( - Tcl_Obj *pathPtr, - Tcl_Obj **objPtrRef) + TCL_UNUSED(Tcl_Obj *) /*pathPtr*/, + TCL_UNUSED(Tcl_Obj **) /*objPtrRef*/) { static const char *const attrs[] = { "-uncompsize", @@ -4528,8 +4490,6 @@ ZipFSFileAttrStringsProc( "-permissions", NULL, }; - (void)pathPtr; - (void)objPtrRef; return attrs; } @@ -4628,14 +4588,10 @@ ZipFSFileAttrsGetProc( static int ZipFSFileAttrsSetProc( Tcl_Interp *interp, /* Current interpreter. */ - int index, - Tcl_Obj *pathPtr, - Tcl_Obj *objPtr) + TCL_UNUSED(int) /*index*/, + TCL_UNUSED(Tcl_Obj *) /*pathPtr*/, + TCL_UNUSED(Tcl_Obj *) /*objPtr*/) { - (void)index; - (void)pathPtr; - (void)objPtr; - if (interp) { Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported operation", -1)); Tcl_SetErrorCode(interp, "TCL", "ZIPFS", "UNSUPPORTED_OP", NULL); @@ -4657,9 +4613,8 @@ ZipFSFileAttrsSetProc( static Tcl_Obj * ZipFSFilesystemPathTypeProc( - Tcl_Obj *pathPtr) + TCL_UNUSED(Tcl_Obj *) /*pathPtr*/) { - (void)pathPtr; return Tcl_NewStringObj("zip", -1); } @@ -4941,18 +4896,20 @@ ZipfsExitHandler( int TclZipfs_AppHook( +#ifdef SUPPORT_BUILTIN_ZIP_INSTALL int *argcPtr, /* Pointer to argc */ +#else + TCL_UNUSED(int *) /*argcPtr*/, +#endif #ifdef _WIN32 - WCHAR + TCL_UNUSED(WCHAR ***)argvPtr, #else /* !_WIN32 */ - char + char ***argvPtr) /* Pointer to argv */ #endif /* _WIN32 */ - ***argvPtr) /* Pointer to argv */ { char *archive; #ifdef _WIN32 - (void)argvPtr; Tcl_FindExecutable(NULL); #else Tcl_FindExecutable((*argvPtr)[0]); @@ -5056,8 +5013,6 @@ TclZipfs_AppHook( #ifdef _WIN32 Tcl_DStringFree(&ds); #endif /* _WIN32 */ -#else - (void)argcPtr; #endif /* SUPPORT_BUILTIN_ZIP_INSTALL */ } return TCL_OK; -- cgit v0.12 From bd4dfc850ea167c4a0081befe5c8a8bd9cdbd58a Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 9 Mar 2020 14:40:27 +0000 Subject: Bring TCL_UNUSED to macosx sources. --- macosx/tclMacOSXBundle.c | 3 +-- macosx/tclMacOSXNotify.c | 14 +++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/macosx/tclMacOSXBundle.c b/macosx/tclMacOSXBundle.c index 81d8d04..0c68e2d 100644 --- a/macosx/tclMacOSXBundle.c +++ b/macosx/tclMacOSXBundle.c @@ -197,7 +197,7 @@ Tcl_MacOSXOpenBundleResources( int Tcl_MacOSXOpenVersionedBundleResources( - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), const char *bundleName, const char *bundleVersion, int hasResourceFile, @@ -208,7 +208,6 @@ Tcl_MacOSXOpenVersionedBundleResources( CFBundleRef bundleRef, versionedBundleRef = NULL; CFStringRef bundleNameRef; CFURLRef libURL; - (void)dummy; libraryPath[0] = '\0'; diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c index 1523400..8f1dbba 100644 --- a/macosx/tclMacOSXNotify.c +++ b/macosx/tclMacOSXNotify.c @@ -755,7 +755,7 @@ StartNotifierThread(void) void Tcl_FinalizeNotifier( - ClientData clientData) /* Not used. */ + ClientData clientData) { ThreadSpecificData *tsdPtr; @@ -942,11 +942,9 @@ Tcl_SetTimer( static void TimerWakeUp( - CFRunLoopTimerRef timer, - void *info) + TCL_UNUSED(CFRunLoopTimerRef), + TCL_UNUSED(ClientData)) { - (void)timer; - (void)info; } /* @@ -1450,12 +1448,11 @@ QueueFileEvents( static void UpdateWaitingListAndServiceEvents( - CFRunLoopObserverRef observer, + TCL_UNUSED(CFRunLoopObserverRef), CFRunLoopActivity activity, void *info) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *)info; - (void)observer; if (tsdPtr->sleeping) { return; @@ -1830,14 +1827,13 @@ TclUnixWaitForFile( static TCL_NORETURN void NotifierThreadProc( - ClientData dummy) /* Not used. */ + TCL_UNUSED(ClientData)) { ThreadSpecificData *tsdPtr; fd_set readableMask, writableMask, exceptionalMask; int i, numFdBits = 0, polling; struct timeval poll = {0., 0.}, *timePtr; char buf[2]; - (void)dummy; /* * Look for file events and report them to interested threads. -- cgit v0.12 From 1baa16d30dfb27a4df336268d8acae3af327054a Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 9 Mar 2020 14:43:18 +0000 Subject: need internal header now. --- macosx/tclMacOSXBundle.c | 1 + 1 file changed, 1 insertion(+) diff --git a/macosx/tclMacOSXBundle.c b/macosx/tclMacOSXBundle.c index 0c68e2d..01b5de4 100644 --- a/macosx/tclMacOSXBundle.c +++ b/macosx/tclMacOSXBundle.c @@ -12,6 +12,7 @@ */ #include "tclPort.h" +#include "tclInt.h" #ifdef HAVE_COREFOUNDATION #include -- cgit v0.12 From 8816b1a873ea5b502c1fcefc3b56875e281f0458 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 9 Mar 2020 15:45:52 +0000 Subject: TCL_UNUSED in the unix sources. --- unix/tclEpollNotfy.c | 2 +- unix/tclKqueueNotfy.c | 2 +- unix/tclLoadDl.c | 8 ++------ unix/tclLoadDyld.c | 12 +++--------- unix/tclSelectNotfy.c | 5 ++--- unix/tclUnixChan.c | 9 +++------ unix/tclUnixCompat.c | 6 ++---- unix/tclUnixFCmd.c | 40 +++++++++++++--------------------------- unix/tclUnixFile.c | 18 +++++++++++------- unix/tclUnixInit.c | 21 +++++++++++---------- unix/tclUnixPipe.c | 9 +++------ unix/tclUnixSock.c | 22 ++++++---------------- unix/tclUnixTest.c | 33 ++++++++++----------------------- unix/tclUnixTime.c | 12 ++++-------- unix/tclXtNotify.c | 4 ++-- unix/tclXtTest.c | 2 +- 16 files changed, 75 insertions(+), 130 deletions(-) diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index e164e7e..406b7ca 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -183,7 +183,7 @@ Tcl_InitNotifier(void) void Tcl_FinalizeNotifier( - ClientData clientData) /* Not used. */ + ClientData clientData) { if (tclNotifierHooks.finalizeNotifierProc) { tclNotifierHooks.finalizeNotifierProc(clientData); diff --git a/unix/tclKqueueNotfy.c b/unix/tclKqueueNotfy.c index e2ff4f4..4daab7c 100644 --- a/unix/tclKqueueNotfy.c +++ b/unix/tclKqueueNotfy.c @@ -169,7 +169,7 @@ Tcl_InitNotifier(void) void Tcl_FinalizeNotifier( - ClientData clientData) /* Not used. */ + ClientData clientData) { if (tclNotifierHooks.finalizeNotifierProc) { tclNotifierHooks.finalizeNotifierProc(clientData); diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index 052aa07..07fd30b 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -281,13 +281,9 @@ UnloadFile( int TclGuessPackageName( - const char *fileName, /* Name of file containing package (already - * translated to local form if needed). */ - Tcl_DString *bufPtr) /* Initialized empty dstring. Append package - * name to this if possible. */ + TCL_UNUSED(const char *) /*fileName*/, + TCL_UNUSED(Tcl_DString *)) { - (void)fileName; - (void)bufPtr; return 0; } diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c index 9d4e99c..e95d269 100644 --- a/unix/tclLoadDyld.c +++ b/unix/tclLoadDyld.c @@ -486,14 +486,9 @@ UnloadFile( int TclGuessPackageName( - const char *fileName, /* Name of file containing package (already - * translated to local form if needed). */ - Tcl_DString *bufPtr) /* Initialized empty dstring. Append package - * name to this if possible. */ + TCL_UNUSED(const char *) /*fileName*/, + TCL_UNUSED(Tcl_DString *) /*bufPtr*/) { - (void)fileName; - (void)bufPtr; - return 0; } @@ -516,11 +511,10 @@ TclGuessPackageName( #ifdef TCL_LOAD_FROM_MEMORY MODULE_SCOPE void * TclpLoadMemoryGetBuffer( - Tcl_Interp *dummy, /* Used for error reporting. */ + TCL_UNUSED(Tcl_Interp *), int size) /* Size of desired buffer. */ { void *buffer = NULL; - (void)dummy; /* * NSCreateObjectFileImageFromMemory is available but always fails diff --git a/unix/tclSelectNotfy.c b/unix/tclSelectNotfy.c index a7788a6..79475f6 100644 --- a/unix/tclSelectNotfy.c +++ b/unix/tclSelectNotfy.c @@ -376,7 +376,7 @@ Tcl_InitNotifier(void) void Tcl_FinalizeNotifier( - ClientData clientData) /* Not used. */ + ClientData clientData) { if (tclNotifierHooks.finalizeNotifierProc) { tclNotifierHooks.finalizeNotifierProc(clientData); @@ -928,7 +928,7 @@ Tcl_WaitForEvent( #if TCL_THREADS static TCL_NORETURN void NotifierThreadProc( - ClientData dummy) /* Not used. */ + TCL_UNUSED(ClientData)) { ThreadSpecificData *tsdPtr; fd_set readableMask; @@ -940,7 +940,6 @@ NotifierThreadProc( struct timeval poll = {0, 0}, *timePtr; char buf[2]; int numFdBits = 0; - (void)dummy; if (pipe(fds) != 0) { Tcl_Panic("NotifierThreadProc: %s", "could not create trigger pipe"); diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 0636b6d..045aad0 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -359,12 +359,11 @@ FileOutputProc( static int FileCloseProc( void *instanceData, /* File state. */ - Tcl_Interp *dummy, /* For error reporting - unused. */ + TCL_UNUSED(Tcl_Interp *), int flags) { FileState *fsPtr = (FileState *)instanceData; int errorCode = 0; - (void)dummy; if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { return EINVAL; @@ -1944,9 +1943,8 @@ Tcl_GetOpenFile( const char *chanID, /* String that identifies file. */ int forWriting, /* 1 means the file is going to be used for * writing, 0 means for reading. */ - int dummy, /* 1 means verify that the file was opened in - * a mode that allows the access specified by - * "forWriting". Ignored, we always check that + TCL_UNUSED(int), /* Obsolete argument. + * Ignored, we always check that * the channel is open for the requested * mode. */ void **filePtr) /* Store pointer to FILE structure here. */ @@ -1956,7 +1954,6 @@ Tcl_GetOpenFile( const Tcl_ChannelType *chanTypePtr; void *data; FILE *f; - (void)dummy; chan = Tcl_GetChannel(interp, chanID, &chanMode); if (chan == NULL) { diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index c4ee1d5..7717721 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -336,10 +336,9 @@ TclpGetPwUid( #ifdef NEED_PW_CLEANER static void FreePwBuf( - ClientData dummy) + TCL_UNUSED(ClientData)) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; ckfree(tsdPtr->pbuf); } @@ -520,10 +519,9 @@ TclpGetGrGid( #ifdef NEED_GR_CLEANER static void FreeGrBuf( - ClientData dummy) + TCL_UNUSED(ClientData)) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; ckfree(tsdPtr->gbuf); } diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 9018bd1..473949a 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -1230,16 +1230,13 @@ TraversalCopy( static int TraversalDelete( Tcl_DString *srcPtr, /* Source pathname (native). */ - Tcl_DString *dummy, /* Destination pathname (not used). */ - const Tcl_StatBuf *statBufPtr, - /* Stat info for file specified by srcPtr. */ + TCL_UNUSED(Tcl_DString *), + TCL_UNUSED(const Tcl_StatBuf *), int type, /* Reason for call - see TraverseUnixTree(). */ Tcl_DString *errorPtr) /* If non-NULL, uninitialized or free DString * filled with UTF-8 name of file causing * error. */ { - (void)dummy; - (void)statBufPtr; switch (type) { case DOTREE_F: @@ -1282,14 +1279,13 @@ TraversalDelete( static int CopyFileAtts( - const char *src, /* Path name of source file (native). */ + TCL_UNUSED(const char *) /*src*/, /* Path name of source file (native). */ const char *dst, /* Path name of target file (native). */ const Tcl_StatBuf *statBufPtr) /* Stat info for source file */ { struct utimbuf tval; mode_t newMode; - (void)src; newMode = statBufPtr->st_mode & (S_ISUID | S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO); @@ -1341,14 +1337,13 @@ CopyFileAtts( static int GetGroupAttribute( Tcl_Interp *interp, /* The interp we are using for errors. */ - int objIndex, /* The index of the attribute. */ + TCL_UNUSED(int) /*objIndex*/, Tcl_Obj *fileName, /* The name of the file (UTF-8). */ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */ { Tcl_StatBuf statBuf; struct group *groupPtr; int result; - (void)objIndex; result = TclpObjStat(fileName, &statBuf); @@ -1396,14 +1391,13 @@ GetGroupAttribute( static int GetOwnerAttribute( Tcl_Interp *interp, /* The interp we are using for errors. */ - int objIndex, /* The index of the attribute. */ + TCL_UNUSED(int) /*objIndex*/, Tcl_Obj *fileName, /* The name of the file (UTF-8). */ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */ { Tcl_StatBuf statBuf; struct passwd *pwPtr; int result; - (void)objIndex; result = TclpObjStat(fileName, &statBuf); @@ -1449,13 +1443,12 @@ GetOwnerAttribute( static int GetPermissionsAttribute( Tcl_Interp *interp, /* The interp we are using for errors. */ - int objIndex, /* The index of the attribute. */ + TCL_UNUSED(int) /*objIndex*/, Tcl_Obj *fileName, /* The name of the file (UTF-8). */ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */ { Tcl_StatBuf statBuf; int result; - (void)objIndex; result = TclpObjStat(fileName, &statBuf); @@ -1492,14 +1485,13 @@ GetPermissionsAttribute( static int SetGroupAttribute( Tcl_Interp *interp, /* The interp for error reporting. */ - int objIndex, /* The index of the attribute. */ + TCL_UNUSED(int) /*objIndex*/, Tcl_Obj *fileName, /* The name of the file (UTF-8). */ Tcl_Obj *attributePtr) /* New group for file. */ { Tcl_WideInt gid; int result; const char *native; - (void)objIndex; if (Tcl_GetWideIntFromObj(NULL, attributePtr, &gid) != TCL_OK) { Tcl_DString ds; @@ -1559,14 +1551,13 @@ SetGroupAttribute( static int SetOwnerAttribute( Tcl_Interp *interp, /* The interp for error reporting. */ - int objIndex, /* The index of the attribute. */ + TCL_UNUSED(int) /*objIndex*/, Tcl_Obj *fileName, /* The name of the file (UTF-8). */ Tcl_Obj *attributePtr) /* New owner for file. */ { Tcl_WideInt uid; int result; const char *native; - (void)objIndex; if (Tcl_GetWideIntFromObj(NULL, attributePtr, &uid) != TCL_OK) { Tcl_DString ds; @@ -1626,7 +1617,7 @@ SetOwnerAttribute( static int SetPermissionsAttribute( Tcl_Interp *interp, /* The interp we are using for errors. */ - int objIndex, /* The index of the attribute. */ + TCL_UNUSED(int) /*objIndex*/, Tcl_Obj *fileName, /* The name of the file (UTF-8). */ Tcl_Obj *attributePtr) /* The attribute to set. */ { @@ -1636,7 +1627,6 @@ SetPermissionsAttribute( const char *native; const char *modeStringPtr = TclGetString(attributePtr); int scanned = TclParseAllWhiteSpace(modeStringPtr, -1); - (void)objIndex; /* * First supply support for octal number format @@ -1749,7 +1739,7 @@ TclpObjListVolumes(void) static int GetModeFromPermString( - Tcl_Interp *dummy, /* The interp we are using for errors. */ + TCL_UNUSED(Tcl_Interp *), const char *modeStringPtr, /* Permissions string */ mode_t *modePtr) /* pointer to the mode value */ { @@ -1758,7 +1748,6 @@ GetModeFromPermString( * is passed in), to allow for the chmod style * manipulation. */ int i,n, who, op, what, op_found, who_found; - (void)dummy; /* * We start off checking for an "rwxrwxrwx" style permissions string @@ -1937,7 +1926,7 @@ GetModeFromPermString( int TclpObjNormalizePath( - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), Tcl_Obj *pathPtr, /* An unshared object containing the path to * normalize. */ int nextCheckpoint) /* offset to start at in pathPtr. Must either @@ -1956,7 +1945,6 @@ TclpObjNormalizePath( #ifndef NO_REALPATH char normPath[MAXPATHLEN]; #endif - (void)dummy; currentPathEndPosition = path + nextCheckpoint; if (*currentPathEndPosition == '/') { @@ -2501,13 +2489,12 @@ SetUnixFileAttributes( static int GetUnixFileAttributes( Tcl_Interp *interp, /* The interp we are using for errors. */ - int objIndex, /* The index of the attribute. */ + TCL_UNUSED(int) /*objIndex*/, Tcl_Obj *fileName, /* The name of the file (UTF-8). */ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */ { Tcl_StatBuf statBuf; int result; - (void)objIndex; result = TclpObjStat(fileName, &statBuf); @@ -2543,14 +2530,13 @@ GetUnixFileAttributes( static int SetUnixFileAttributes( Tcl_Interp *interp, /* The interp we are using for errors. */ - int objIndex, /* The index of the attribute. */ + TCL_UNUSED(int) /*objIndex*/, Tcl_Obj *fileName, /* The name of the file (UTF-8). */ Tcl_Obj *attributePtr) /* The attribute to set. */ { Tcl_StatBuf statBuf; int result, readonly; const char *native; - (void)objIndex; if (Tcl_GetBooleanFromObj(interp, attributePtr, &readonly) != TCL_OK) { return TCL_ERROR; diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 9f4eb77..602ca63 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -34,17 +34,15 @@ static int NativeMatchType(Tcl_Interp *interp, const char* nativeEntry, *--------------------------------------------------------------------------- */ +#ifdef __CYGWIN__ void TclpFindExecutable( - const char *argv0) /* The value of the application's argv[0] - * (native). */ + TCL_UNUSED(const char *) /*argv0*/) { Tcl_Encoding encoding; -#ifdef __CYGWIN__ int length; wchar_t buf[PATH_MAX]; char name[PATH_MAX * 3 + 1]; - (void)argv0; GetModuleFileNameW(NULL, buf, PATH_MAX); cygwin_conv_path(3, buf, name, PATH_MAX); @@ -56,7 +54,14 @@ TclpFindExecutable( encoding = Tcl_GetEncoding(NULL, NULL); TclSetObjNameOfExecutable( Tcl_NewStringObj(name, length), encoding); +} #else +void +TclpFindExecutable( + const char *argv0) /* The value of the application's argv[0] + * (native). */ +{ + Tcl_Encoding encoding; const char *name, *p; Tcl_StatBuf statBuf; Tcl_DString buffer, nameString, cwd, utfName; @@ -194,8 +199,8 @@ TclpFindExecutable( done: Tcl_DStringFree(&buffer); -#endif } +#endif /* *---------------------------------------------------------------------- @@ -1020,9 +1025,8 @@ TclpObjLink( Tcl_Obj * TclpFilesystemPathType( - Tcl_Obj *pathPtr) + TCL_UNUSED(Tcl_Obj *)) { - (void)pathPtr; /* * All native paths are of the same type. */ diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 0e61e85..a86fcde 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -1053,26 +1053,27 @@ TclpFindVariable( */ #ifdef HAVE_COREFOUNDATION +#ifdef TCL_FRAMEWORK static int MacOSXGetLibraryPath( Tcl_Interp *interp, int maxPathLen, char *tclLibPath) { - int foundInFramework = TCL_ERROR; - -#ifdef TCL_FRAMEWORK - foundInFramework = Tcl_MacOSXOpenVersionedBundleResources(interp, + return Tcl_MacOSXOpenVersionedBundleResources(interp, "com.tcltk.tcllibrary", TCL_FRAMEWORK_VERSION, 0, maxPathLen, tclLibPath); +} #else - (void)interp; - (void)maxPathLen; - (void)tclLibPath; -#endif - - return foundInFramework; +static int +MacOSXGetLibraryPath( + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(int), + TCL_UNUSED(char *)) +{ + return TCL_ERROR; } +#endif #endif /* HAVE_COREFOUNDATION */ /* diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index 31d9671..f47e021 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -268,10 +268,9 @@ TclpTempFileName(void) Tcl_Obj * TclpTempFileNameForLibrary( Tcl_Interp *interp, /* Tcl interpreter. */ - Tcl_Obj *path) /* Path name of the library in the VFS. */ + TCL_UNUSED(Tcl_Obj *) /*path*/) { Tcl_Obj *retval = TclpTempFileName(); - (void)path; if (retval == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -811,10 +810,9 @@ Tcl_CreatePipe( Tcl_Interp *interp, /* Errors returned in result. */ Tcl_Channel *rchan, /* Returned read side. */ Tcl_Channel *wchan, /* Returned write side. */ - int flags) /* Reserved for future use. */ + TCL_UNUSED(int) /*flags*/) /* Reserved for future use. */ { int fileNums[2]; - (void)flags; if (pipe(fileNums) < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("pipe creation failed: %s", @@ -1254,7 +1252,7 @@ Tcl_WaitPid( /* ARGSUSED */ int Tcl_PidObjCmd( - void *dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ @@ -1263,7 +1261,6 @@ Tcl_PidObjCmd( PipeState *pipePtr; int i; Tcl_Obj *resultPtr; - (void)dummy; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?channelId?"); diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index dd8ca30..325e361 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -338,10 +338,8 @@ Tcl_GetHostName(void) int TclpHasSockets( - Tcl_Interp *dummy) /* Not used. */ + TCL_UNUSED(Tcl_Interp *)) { - (void)dummy; - return TCL_OK; } @@ -627,12 +625,11 @@ TcpOutputProc( static int TcpCloseProc( void *instanceData, /* The socket to close. */ - Tcl_Interp *dummy) /* For error reporting - unused */ + TCL_UNUSED(Tcl_Interp *)) { TcpState *statePtr = (TcpState *)instanceData; int errorCode = 0; TcpFdList *fds; - (void)dummy; /* * Delete a file handler that may be active for this socket if this is a @@ -689,13 +686,12 @@ TcpCloseProc( static int TcpClose2Proc( void *instanceData, /* The socket to close. */ - Tcl_Interp *dummy, /* For error reporting. */ + TCL_UNUSED(Tcl_Interp *), int flags) /* Flags that indicate which side to close. */ { TcpState *statePtr = (TcpState *)instanceData; int readError = 0; int writeError = 0; - (void)dummy; /* * Shutdown the OS socket handle. @@ -1110,11 +1106,10 @@ TcpWatchProc( static int TcpGetHandleProc( void *instanceData, /* The socket state. */ - int direction, /* Not used. */ + TCL_UNUSED(int) /*direction*/, void **handlePtr) /* Where to store the handle. */ { TcpState *statePtr = (TcpState *)instanceData; - (void)direction; *handlePtr = INT2PTR(statePtr->fds.fd); return TCL_OK; @@ -1135,12 +1130,8 @@ TcpGetHandleProc( static void TcpAsyncCallback( void *clientData, /* The socket state. */ - int mask) /* Events of interest; an OR-ed combination of - * TCL_READABLE, TCL_WRITABLE and - * TCL_EXCEPTION. */ + TCL_UNUSED(int) /*mask*/) { - (void)mask; - TcpConnect(NULL, (TcpState *)clientData); } @@ -1771,7 +1762,7 @@ Tcl_OpenTcpServerEx( static void TcpAccept( void *data, /* Callback token. */ - int mask) /* Not used. */ + TCL_UNUSED(int) /*mask*/) { TcpFdList *fds = (TcpFdList *)data; /* Client data of server socket. */ int newsock; /* The new client socket */ @@ -1780,7 +1771,6 @@ TcpAccept( socklen_t len; /* For accept interface */ char channelName[SOCK_CHAN_LENGTH]; char host[NI_MAXHOST], port[NI_MAXSERV]; - (void)mask; len = sizeof(addr); newsock = accept(fds->fd, &addr.sa, &len); diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index 8868bbe..b06abdf0 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -129,7 +129,7 @@ TclplatformtestInit( static int TestfilehandlerCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ @@ -139,7 +139,6 @@ TestfilehandlerCmd( static int initialized = 0; char buffer[4000]; TclFile file; - (void)dummy; /* * NOTE: When we make this code work on Windows also, the following @@ -344,7 +343,7 @@ TestFileHandlerProc( static int TestfilewaitCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ @@ -353,7 +352,6 @@ TestfilewaitCmd( Tcl_Channel channel; int fd; ClientData data; - (void)dummy; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "file readable|writable|both timeout"); @@ -413,13 +411,12 @@ TestfilewaitCmd( static int TestfindexecutableCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ { Tcl_Obj *saveName; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "argv0"); @@ -456,13 +453,12 @@ TestfindexecutableCmd( static int TestforkCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ { pid_t pid; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); @@ -503,7 +499,7 @@ TestforkCmd( static int TestalarmCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ @@ -511,7 +507,6 @@ TestalarmCmd( #ifdef SA_RESTART unsigned int sec = 1; struct sigaction action; - (void)dummy; if (objc > 1) { Tcl_GetIntFromObj(interp, objv[1], (int *)&sec); @@ -533,7 +528,6 @@ TestalarmCmd( (void) alarm(sec); return TCL_OK; #else - (void)dummy; Tcl_AppendResult(interp, "warning: sigaction SA_RESTART not support on this platform", @@ -560,10 +554,8 @@ TestalarmCmd( static void AlarmHandler( - int signum) + TCL_UNUSED(int) /*signum*/) { - (void)signum; - gotsig = "1"; } @@ -585,15 +577,11 @@ AlarmHandler( static int TestgotsigCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const *objv) /* Argument strings. */ + TCL_UNUSED(int) /*objc*/, + TCL_UNUSED(Tcl_Obj *const *)) { - (void)dummy; - (void)objc; - (void)objv; - Tcl_AppendResult(interp, gotsig, NULL); gotsig = "0"; return TCL_OK; @@ -620,13 +608,12 @@ TestgotsigCmd( static int TestchmodCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ { int i, mode; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "mode file ?file ...?"); diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index fb649d2..07b3065 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -508,11 +508,9 @@ Tcl_QueryTimeProc( static void NativeScaleTime( - Tcl_Time *timePtr, - ClientData clientData) + TCL_UNUSED(Tcl_Time *), + TCL_UNUSED(ClientData)) { - (void)timePtr; - (void)clientData; /* Native scale is 1:1. Nothing is done */ } @@ -536,10 +534,9 @@ NativeScaleTime( static void NativeGetTime( Tcl_Time *timePtr, - ClientData dummy) + TCL_UNUSED(ClientData)) { struct timeval tv; - (void)dummy; (void) gettimeofday(&tv, NULL); timePtr->sec = tv.tv_sec; @@ -606,9 +603,8 @@ SetTZIfNecessary(void) static void CleanupMemory( - ClientData dummy) + TCL_UNUSED(ClientData)) { - (void)dummy; ckfree(lastTZ); } #endif /* TCL_NO_DEPRECATED */ diff --git a/unix/tclXtNotify.c b/unix/tclXtNotify.c index 490b739..cf99fb2 100644 --- a/unix/tclXtNotify.c +++ b/unix/tclXtNotify.c @@ -232,7 +232,7 @@ InitNotifier(void) static void NotifierExitHandler( - ClientData clientData) /* Not used. */ + TCL_UNUSED(ClientData)) { if (notifier.currentTimeout != 0) { XtRemoveTimeOut(notifier.currentTimeout); @@ -305,7 +305,7 @@ SetTimer( static void TimerProc( - XtPointer clientData, /* Not used. */ + TCL_UNUSED(XtPointer), XtIntervalId *id) { if (*id != notifier.currentTimeout) { diff --git a/unix/tclXtTest.c b/unix/tclXtTest.c index cb70b58..6c09a50 100644 --- a/unix/tclXtTest.c +++ b/unix/tclXtTest.c @@ -78,7 +78,7 @@ Tclxttest_Init( static int TesteventloopCmd( - ClientData clientData, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ -- cgit v0.12 From 683144e7f0a62bea19fb406f3f3cb377a9eb7d58 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 9 Mar 2020 16:13:11 +0000 Subject: TCL_UNUSED for win sources. --- win/tclAppInit.c | 3 +-- win/tclWin32Dll.c | 6 ++---- win/tclWinChan.c | 13 ++++--------- win/tclWinConsole.c | 20 ++++++-------------- win/tclWinFCmd.c | 11 +++-------- win/tclWinFile.c | 3 +-- win/tclWinLoad.c | 12 +++--------- win/tclWinPipe.c | 18 ++++++------------ win/tclWinSerial.c | 19 ++++++------------- win/tclWinSock.c | 19 ++++++------------- win/tclWinTest.c | 40 +++++++++++++--------------------------- win/tclWinTime.c | 17 +++++------------ 12 files changed, 56 insertions(+), 125 deletions(-) diff --git a/win/tclAppInit.c b/win/tclAppInit.c index 0a47000..105af65 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -87,11 +87,10 @@ MODULE_SCOPE int TCL_LOCAL_MAIN_HOOK(int *argc, TCHAR ***argv); int main( int argc, /* Number of command-line arguments. */ - char *dummy[]) /* Not used. */ + TCL_UNUSED(char **)) { TCHAR **argv; TCHAR *p; - (void)dummy; #else int _tmain( diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 821ac35..156ec9e 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -90,7 +90,7 @@ BOOL APIENTRY DllEntryPoint( HINSTANCE hInst, /* Library instance handle. */ DWORD reason, /* Reason this function is being called. */ - LPVOID reserved) /* Not used. */ + LPVOID reserved) { return DllMain(hInst, reason, reserved); } @@ -117,10 +117,8 @@ BOOL APIENTRY DllMain( HINSTANCE hInst, /* Library instance handle. */ DWORD reason, /* Reason this function is being called. */ - LPVOID reserved) /* Not used. */ + TCL_UNUSED(LPVOID)) { - (void)reserved; - switch (reason) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hInst); diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 7ffd6b5..b13dbd2 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -186,10 +186,8 @@ FileInit(void) static void FileChannelExitHandler( - ClientData dummy) /* Old window proc */ + TCL_UNUSED(ClientData)) { - (void)dummy; - Tcl_DeleteEventSource(FileSetupProc, FileCheckProc, NULL); } @@ -212,13 +210,12 @@ FileChannelExitHandler( void FileSetupProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { FileInfo *infoPtr; Tcl_Time blockTime = { 0, 0 }; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if (!TEST_FLAG(flags, TCL_FILE_EVENTS)) { return; @@ -256,13 +253,12 @@ FileSetupProc( static void FileCheckProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { FileEvent *evPtr; FileInfo *infoPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if (!TEST_FLAG(flags, TCL_FILE_EVENTS)) { return; @@ -396,14 +392,13 @@ FileBlockProc( static int FileCloseProc( ClientData instanceData, /* Pointer to FileInfo structure. */ - Tcl_Interp *dummy, /* Not used. */ + TCL_UNUSED(Tcl_Interp *), int flags) { FileInfo *fileInfoPtr = (FileInfo *)instanceData; FileInfo *infoPtr; ThreadSpecificData *tsdPtr; int errorCode = 0; - (void)dummy; if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { return EINVAL; diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 4c1aec0..3b8753b 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -317,10 +317,8 @@ ConsoleInit(void) static void ConsoleExitHandler( - ClientData dummy) /* Old window proc. */ + TCL_UNUSED(ClientData)) { - (void)dummy; - Tcl_DeleteEventSource(ConsoleSetupProc, ConsoleCheckProc, NULL); } @@ -343,10 +341,8 @@ ConsoleExitHandler( static void ProcExitHandler( - ClientData dummy) /* Old window proc. */ + TCL_UNUSED(ClientData)) { - (void)dummy; - Tcl_MutexLock(&consoleMutex); initialized = 0; Tcl_MutexUnlock(&consoleMutex); @@ -371,14 +367,13 @@ ProcExitHandler( void ConsoleSetupProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { ConsoleInfo *infoPtr; Tcl_Time blockTime = { 0, 0 }; int block = 1; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if (!(flags & TCL_FILE_EVENTS)) { return; @@ -426,13 +421,12 @@ ConsoleSetupProc( static void ConsoleCheckProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { ConsoleInfo *infoPtr; int needEvent; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if (!(flags & TCL_FILE_EVENTS)) { return; @@ -537,14 +531,13 @@ ConsoleBlockModeProc( static int ConsoleCloseProc( ClientData instanceData, /* Pointer to ConsoleInfo structure. */ - Tcl_Interp *dummy, /* For error reporting. */ + TCL_UNUSED(Tcl_Interp *), int flags) { ConsoleInfo *consolePtr = (ConsoleInfo *)instanceData; int errorCode = 0; ConsoleInfo *infoPtr, **nextPtrPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { return EINVAL; @@ -995,11 +988,10 @@ ConsoleWatchProc( static int ConsoleGetHandleProc( ClientData instanceData, /* The console state. */ - int direction, /* TCL_READABLE or TCL_WRITABLE. */ + TCL_UNUSED(int) /*direction*/, ClientData *handlePtr) /* Where to store the handle. */ { ConsoleInfo *infoPtr = (ConsoleInfo *)instanceData; - (void)direction; *handlePtr = infoPtr->handle; return TCL_OK; diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index b9a5342..347c5e9 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -1427,13 +1427,11 @@ TraversalCopy( static int TraversalDelete( const WCHAR *nativeSrc, /* Source pathname to delete. */ - const WCHAR *dstPtr, /* Not used. */ + TCL_UNUSED(const WCHAR *) /*dstPtr*/, int type, /* Reason for call - see TraverseWinTree() */ Tcl_DString *errorPtr) /* If non-NULL, initialized DString filled * with UTF-8 name of file causing error. */ { - (void)dstPtr; - switch (type) { case DOTREE_F: if (TclpDeleteFile(nativeSrc) == TCL_OK) { @@ -1592,14 +1590,13 @@ GetWinFileAttributes( static int ConvertFileNameFormat( Tcl_Interp *interp, /* The interp we are using for errors. */ - int objIndex, /* The index of the attribute. */ + TCL_UNUSED(int) /*objIndex*/, Tcl_Obj *fileName, /* The name of the file. */ int longShort, /* 0 to short name, 1 to long name. */ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */ { int pathc, i; Tcl_Obj *splitPath; - (void)objIndex; splitPath = Tcl_FSSplitPath(fileName, &pathc); @@ -1895,10 +1892,8 @@ CannotSetAttribute( Tcl_Interp *interp, /* The interp we are using for errors. */ int objIndex, /* The index of the attribute. */ Tcl_Obj *fileName, /* The name of the file. */ - Tcl_Obj *attributePtr) /* The new value of the attribute. */ + TCL_UNUSED(Tcl_Obj *) /*attributePtr*/) { - (void)attributePtr; - Tcl_SetObjResult(interp, Tcl_ObjPrintf( "cannot set attribute \"%s\" for file \"%s\": attribute is readonly", tclpFileAttrStrings[objIndex], Tcl_GetString(fileName))); diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 1380217..d2777d7 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -2541,7 +2541,7 @@ TclpFilesystemPathType( int TclpObjNormalizePath( - Tcl_Interp *dummy, + TCL_UNUSED(Tcl_Interp *), Tcl_Obj *pathPtr, /* An unshared object containing the path to * normalize */ int nextCheckpoint) /* offset to start at in pathPtr */ @@ -2552,7 +2552,6 @@ TclpObjNormalizePath( Tcl_Obj *temp = NULL; int isDrive = 1; Tcl_DString ds; /* Some workspace. */ - (void)dummy; Tcl_DStringInit(&dsNorm); path = Tcl_GetString(pathPtr); diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 3f48f7c..1a74618 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -61,13 +61,12 @@ TclpDlopen( /* Filled with address of Tcl_FSUnloadFileProc * function which should be used for this * file. */ - int flags) + TCL_UNUSED(int) /*flags*/) { HINSTANCE hInstance = NULL; const WCHAR *nativeName; Tcl_LoadHandle handlePtr; DWORD firstError; - (void)flags; /* * First try the full path the user gave us. This is particularly @@ -282,14 +281,9 @@ UnloadFile( int TclGuessPackageName( - const char *fileName, /* Name of file containing package (already - * translated to local form if needed). */ - Tcl_DString *bufPtr) /* Initialized empty dstring. Append package - * name to this if possible. */ + TCL_UNUSED(const char *), + TCL_UNUSED(Tcl_DString *)) { - (void)fileName; - (void)bufPtr; - return 0; } diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 26f0b3e..7066bd2 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -310,14 +310,13 @@ TclpFinalizePipes(void) void PipeSetupProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { PipeInfo *infoPtr; Tcl_Time blockTime = { 0, 0 }; int block = 1; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if (!(flags & TCL_FILE_EVENTS)) { return; @@ -364,14 +363,13 @@ PipeSetupProc( static void PipeCheckProc( - ClientData dummy, /* Not used. */ + TCL_UNUNSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { PipeInfo *infoPtr; PipeEvent *evPtr; int needEvent; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if (!(flags & TCL_FILE_EVENTS)) { return; @@ -1858,11 +1856,10 @@ Tcl_CreatePipe( Tcl_Interp *interp, /* Errors returned in result.*/ Tcl_Channel *rchan, /* Where to return the read side. */ Tcl_Channel *wchan, /* Where to return the write side. */ - int flags) /* Reserved for future use. */ + TCL_UNUSED(int) /*flags*/) /* Reserved for future use. */ { HANDLE readHandle, writeHandle; SECURITY_ATTRIBUTES sec; - (void)flags; sec.nLength = sizeof(SECURITY_ATTRIBUTES); sec.lpSecurityDescriptor = NULL; @@ -2746,7 +2743,7 @@ TclWinAddProcess( /* ARGSUSED */ int Tcl_PidObjCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ @@ -2756,7 +2753,6 @@ Tcl_PidObjCmd( PipeInfo *pipePtr; int i; Tcl_Obj *resultPtr; - (void)dummy; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?channelId?"); @@ -3193,9 +3189,9 @@ PipeThreadActionProc( Tcl_Channel TclpOpenTemporaryFile( - Tcl_Obj *dirObj, + TCL_UNUSED(Tcl_Obj *) /*dirObj*/, Tcl_Obj *basenameObj, - Tcl_Obj *extensionObj, + TCL_UNUSED(Tcl_Obj *) /*extensionObj*/, Tcl_Obj *resultingNameObj) { WCHAR name[MAX_PATH]; @@ -3204,8 +3200,6 @@ TclpOpenTemporaryFile( DWORD flags = FILE_ATTRIBUTE_TEMPORARY; int length, counter, counter2; Tcl_DString buf; - (void)dirObj; - (void)extensionObj; if (!resultingNameObj) { flags |= FILE_FLAG_DELETE_ON_CLOSE; diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 7884453..328fbad 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -285,11 +285,10 @@ SerialInit(void) static void SerialExitHandler( - ClientData dummy) /* Old window proc */ + TCL_UNUSED(ClientData)) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); SerialInfo *infoPtr; - (void)dummy; /* * Clear all eventually pending output. Otherwise Tcl's exit could totally @@ -324,10 +323,8 @@ SerialExitHandler( static void ProcExitHandler( - ClientData dummy) /* Old window proc */ + TCL_UNUSED(ClientData)) { - (void)dummy; - Tcl_MutexLock(&serialMutex); initialized = 0; Tcl_MutexUnlock(&serialMutex); @@ -409,14 +406,13 @@ SerialGetMilliseconds(void) void SerialSetupProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { SerialInfo *infoPtr; int block = 1; int msec = INT_MAX; /* min. found block time */ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if (!(flags & TCL_FILE_EVENTS)) { return; @@ -465,7 +461,7 @@ SerialSetupProc( static void SerialCheckProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { SerialInfo *infoPtr; @@ -474,7 +470,6 @@ SerialCheckProc( ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); COMSTAT cStat; unsigned int time; - (void)dummy; if (!(flags & TCL_FILE_EVENTS)) { return; @@ -606,14 +601,13 @@ SerialBlockProc( static int SerialCloseProc( ClientData instanceData, /* Pointer to SerialInfo structure. */ - Tcl_Interp *dummy, /* For error reporting. */ + TCL_UNUSED(Tcl_Interp *), int flags) { SerialInfo *serialPtr = (SerialInfo *) instanceData; int errorCode = 0, result = 0; SerialInfo *infoPtr, **nextPtrPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) { return EINVAL; @@ -1256,11 +1250,10 @@ SerialWatchProc( static int SerialGetHandleProc( ClientData instanceData, /* The serial state. */ - int direction, /* TCL_READABLE or TCL_WRITABLE */ + TCL_UNUSED(int) /*direction*/, ClientData *handlePtr) /* Where to store the handle. */ { SerialInfo *infoPtr = (SerialInfo *) instanceData; - (void)direction; *handlePtr = (ClientData) infoPtr->handle; return TCL_OK; diff --git a/win/tclWinSock.c b/win/tclWinSock.c index ad9ed72..cd07a8f 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1042,13 +1042,12 @@ TcpOutputProc( static int TcpCloseProc( ClientData instanceData, /* The socket to close. */ - Tcl_Interp *dummy) /* Unused. */ + TCL_UNUSED(Tcl_Interp *)) { TcpState *statePtr = (TcpState *)instanceData; /* TIP #218 */ int errorCode = 0; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; /* * Check that WinSock is initialized; do not call it if not, to prevent @@ -1189,7 +1188,7 @@ TcpSetOptionProc( ClientData instanceData, /* Socket state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ const char *optionName, /* Name of the option to set. */ - const char *value) /* New value for option. */ + TCL_UNUSED(const char *) /*value*/) /* New value for option. */ { #ifdef TCL_FEATURE_KEEPALIVE_NAGLE TcpState *statePtr = instanceData; @@ -1197,7 +1196,6 @@ TcpSetOptionProc( #else (void)instanceData; #endif /*TCL_FEATURE_KEEPALIVE_NAGLE*/ - (void)value; /* * Check that WinSock is initialized; do not call it if not, to prevent @@ -1670,11 +1668,10 @@ TcpWatchProc( static int TcpGetHandleProc( ClientData instanceData, /* The socket state. */ - int direction, /* Not used. */ + TCL_UNUSED(int) /*direction*/, ClientData *handlePtr) /* Where to store the handle. */ { TcpState *statePtr = (TcpState *)instanceData; - (void)direction; *handlePtr = INT2PTR(statePtr->sockets->fd); return TCL_OK; @@ -2620,10 +2617,8 @@ SocketsEnabled(void) /* ARGSUSED */ static void SocketExitHandler( - ClientData dummy) /* Not used. */ + TCL_UNUSED(ClientData)) { - (void)dummy; - Tcl_MutexLock(&socketMutex); /* @@ -2656,13 +2651,12 @@ SocketExitHandler( void SocketSetupProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { TcpState *statePtr; Tcl_Time blockTime = { 0, 0 }; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if (!GOT_BITS(flags, TCL_FILE_EVENTS)) { return; @@ -2702,13 +2696,12 @@ SocketSetupProc( static void SocketCheckProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { TcpState *statePtr; SocketEvent *evPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - (void)dummy; if (!GOT_BITS(flags, TCL_FILE_EVENTS)) { return; diff --git a/win/tclWinTest.c b/win/tclWinTest.c index bc3701d..d78d5f1 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -33,21 +33,14 @@ * Forward declarations of functions defined later in this file: */ -static int TesteventloopCmd(ClientData dummy, Tcl_Interp* interp, - int objc, Tcl_Obj *const objv[]); -static int TestvolumetypeCmd(ClientData dummy, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int TestwinclockCmd(ClientData dummy, Tcl_Interp* interp, - int objc, Tcl_Obj *const objv[]); -static int TestwinsleepCmd(ClientData dummy, Tcl_Interp* interp, - int objc, Tcl_Obj *const objv[]); -static int TestSizeCmd(ClientData dummy, Tcl_Interp* interp, - int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc TesteventloopCmd; +static Tcl_ObjCmdProc TestvolumetypeCmd; +static Tcl_ObjCmdProc TestwinclockCmd; +static Tcl_ObjCmdProc TestwinsleepCmd; +static Tcl_ObjCmdProc TestSizeCmd; static Tcl_ObjCmdProc TestExceptionCmd; static int TestplatformChmod(const char *nativePath, int pmode); -static int TestchmodCmd(ClientData dummy, Tcl_Interp* interp, - int objc, Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc TestchmodCmd; /* *---------------------------------------------------------------------- @@ -105,7 +98,7 @@ TclplatformtestInit( static int TesteventloopCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -113,7 +106,6 @@ TesteventloopCmd( static int *framePtr = NULL;/* Pointer to integer on stack frame of * innermost invocation of the "wait" * subcommand. */ - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ..."); @@ -182,7 +174,7 @@ TesteventloopCmd( static int TestvolumetypeCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -191,7 +183,6 @@ TestvolumetypeCmd( int found; char volType[VOL_BUF_SIZE]; const char *path; - (void)dummy; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?name?"); @@ -249,7 +240,7 @@ TestvolumetypeCmd( static int TestwinclockCmd( - ClientData dummy, /* Unused */ + TCL_UNUSED(ClientData), Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Argument count */ Tcl_Obj *const objv[]) /* Argument vector */ @@ -262,7 +253,6 @@ TestwinclockCmd( Tcl_Obj *result; /* Result of the command */ LARGE_INTEGER t1, t2; LARGE_INTEGER p1, p2; - (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); @@ -299,13 +289,12 @@ TestwinclockCmd( static int TestwinsleepCmd( - ClientData dummy, /* Unused */ + TCL_UNUSED(ClientData), Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const * objv) /* Parameter vector */ { int ms; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "ms"); @@ -320,12 +309,11 @@ TestwinsleepCmd( static int TestSizeCmd( - ClientData dummy, /* Unused */ + TCL_UNUSED(ClientData), Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const * objv) /* Parameter vector */ { - (void)dummy; if (objc != 2) { goto syntax; @@ -370,7 +358,7 @@ syntax: static int TestExceptionCmd( - ClientData dummy, /* Unused */ + TCL_UNUSED(ClientData), Tcl_Interp* interp, /* Tcl interpreter */ int objc, /* Argument count */ Tcl_Obj *const objv[]) /* Argument vector */ @@ -397,7 +385,6 @@ TestExceptionCmd( EXCEPTION_GUARD_PAGE, EXCEPTION_INVALID_HANDLE, CONTROL_C_EXIT }; int cmd; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 0, objv, ""); @@ -660,13 +647,12 @@ TestplatformChmod( static int TestchmodCmd( - ClientData dummy, /* Not used. */ + TCL_UNUSED(ClientData), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Parameter count */ Tcl_Obj *const * objv) /* Parameter vector */ { int i, mode; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "mode file ?file ...?"); diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 4a55c3f..8546fc2 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -413,12 +413,9 @@ Tcl_GetTime( static void NativeScaleTime( - Tcl_Time *timePtr, - ClientData dummy) + TCL_UNUSED(Tcl_Time *), + TCL_UNUSED(ClientData)) { - (void)timePtr; - (void)dummy; - /* * Native scale is 1:1. Nothing is done. */ @@ -652,10 +649,9 @@ NativeGetMicroseconds(void) static void NativeGetTime( Tcl_Time *timePtr, - ClientData dummy) + TCL_UNUSED(ClientData)) { Tcl_WideInt usecSincePosixEpoch; - (void)dummy; /* * Try to use high resolution timer. @@ -698,10 +694,8 @@ void TclWinResetTimerResolution(void); static void StopCalibration( - ClientData dummy) /* Client data is unused */ + TCL_UNUSED(ClientData)) { - (void)dummy; - SetEvent(timeInfo.exitEvent); /* @@ -979,11 +973,10 @@ ComputeGMT( static DWORD WINAPI CalibrationThread( - LPVOID arg) + TCL_UNUSED(LPVOID)) { FILETIME curFileTime; DWORD waitResult; - (void)arg; /* * Get initial system time and performance counter. -- cgit v0.12 From 065483ce8b22e7da470427493d68f36e6a53b80b Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 9 Mar 2020 16:24:52 +0000 Subject: Mac fix --- unix/tclUnixFCmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 473949a..bd93ad2 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -1279,7 +1279,11 @@ TraversalDelete( static int CopyFileAtts( - TCL_UNUSED(const char *) /*src*/, /* Path name of source file (native). */ +#ifdef MAC_OSX_TCL + const char *src, /* Path name of source file (native). */ +#else + TCL_UNUSED(const char *) /*src*/, +#endif const char *dst, /* Path name of target file (native). */ const Tcl_StatBuf *statBufPtr) /* Stat info for source file */ -- cgit v0.12 From f13b7726c4db8ae40da10effbd492cefd7aca015 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 10 Mar 2020 13:51:25 +0000 Subject: Fix Windows build, broken by [d5175f6050e308f4] --- generic/tclZipfs.c | 4 ++-- win/tclWinPipe.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index f9a6a8f..4901292 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -4899,10 +4899,10 @@ TclZipfs_AppHook( #ifdef SUPPORT_BUILTIN_ZIP_INSTALL int *argcPtr, /* Pointer to argc */ #else - TCL_UNUSED(int *) /*argcPtr*/, + TCL_UNUSED(int *), /*argcPtr*/ #endif #ifdef _WIN32 - TCL_UNUSED(WCHAR ***)argvPtr, + TCL_UNUSED(WCHAR ***)) /* argvPtr */ #else /* !_WIN32 */ char ***argvPtr) /* Pointer to argv */ #endif /* _WIN32 */ diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 7066bd2..67cca32 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -363,7 +363,7 @@ PipeSetupProc( static void PipeCheckProc( - TCL_UNUNSED(ClientData), + TCL_UNUSED(ClientData), int flags) /* Event flags as passed to Tcl_DoOneEvent. */ { PipeInfo *infoPtr; -- cgit v0.12 From 14fd6b059e2e8ea5c2d5758b8a2800f3413e02f3 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 11 Mar 2020 15:33:28 +0000 Subject: lpop.test: added test illustrating segfault in [234d6c811d] (and small review - stability of tests depending on outside circumstances, e. g. in case of -singleproc) --- tests/lpop.test | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/tests/lpop.test b/tests/lpop.test index 89b651c..3e28978 100644 --- a/tests/lpop.test +++ b/tests/lpop.test @@ -16,6 +16,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} { namespace import -force ::tcltest::* } +unset -nocomplain no; # following tests expecting var "no" does not exists test lpop-1.1 {error conditions} -returnCodes error -body { lpop no } -result {can't read "no": no such variable} @@ -23,32 +24,36 @@ test lpop-1.2 {error conditions} -returnCodes error -body { lpop no 0 } -result {can't read "no": no such variable} test lpop-1.3 {error conditions} -returnCodes error -body { - set no "x {}x" - lpop no + set l "x {}x" + lpop l } -result {list element in braces followed by "x" instead of space} test lpop-1.4 {error conditions} -returnCodes error -body { - set no "x y" - lpop no -1 + set l "x y" + lpop l -1 } -result {index "-1" out of range} +test lpop-1.4b {error conditions (also check SF on empty list variable, bug [234d6c811d])} -body { + set l "x y" + list [lpop l] [lpop l] [catch {lpop l} v] $v [catch {lpop l 0} v] $v $l +} -result {y x 1 {index "end" out of range} 1 {index "0" out of range} {}} test lpop-1.5 {error conditions} -returnCodes error -body { - set no "x y z" - lpop no 3 + set l "x y z" + lpop l 3 } -result {index "3" out of range} ;#-errorCode {TCL OPERATION LPOP BADINDEX} test lpop-1.6 {error conditions} -returnCodes error -body { - set no "x y" - lpop no end+1 + set l "x y" + lpop l end+1 } -result {index "end+1" out of range} test lpop-1.7 {error conditions} -returnCodes error -body { - set no "x y" - lpop no {} + set l "x y" + lpop l {} } -match glob -result {bad index *} test lpop-1.8 {error conditions} -returnCodes error -body { - set no "x y" - lpop no 0 0 0 0 1 + set l "x y" + lpop l 0 0 0 0 1 } -result {index "1" out of range} test lpop-1.9 {error conditions} -returnCodes error -body { - set no "x y" - lpop no {1 0} + set l "x y" + lpop l {1 0} } -match glob -result {bad index *} test lpop-2.1 {basic functionality} -body { -- cgit v0.12 From 7cf28a1e23e36cae089d6ed13eeecf2d0b618f97 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 11 Mar 2020 15:48:07 +0000 Subject: close [234d6c811d]: fixed segfault on empty list variable by "lpop" without index --- generic/tclCmdIL.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index f74368a..94ff2cc 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2587,6 +2587,14 @@ Tcl_LpopObjCmd( */ if (objc == 2) { + if (!listLen) { + /* empty list, throw the same error as with index "end" */ + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "index \"end\" out of range", -1)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX" + "OUTOFRANGE", NULL); + return TCL_ERROR; + } elemPtr = elemPtrs[listLen - 1]; Tcl_IncrRefCount(elemPtr); } else { -- cgit v0.12 From 46e5b17ffbd7d678e0113f8564deaeb32f137a82 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 12 Mar 2020 17:29:33 +0000 Subject: Add some testing of Tcl_SetByteArrayLength(). --- generic/tclTest.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/binary.test | 11 +++++++++++ 2 files changed, 59 insertions(+) diff --git a/generic/tclTest.c b/generic/tclTest.c index 5e807d4..3e942bb 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -226,6 +226,9 @@ static int TestbumpinterpepochObjCmd(ClientData clientData, static int TestpurebytesobjObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int TestsetbytearraylengthObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); static int TestbytestringObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -577,6 +580,7 @@ Tcltest_Init( Tcl_CreateCommand(interp, "noop", NoopCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "noop", NoopObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testpurebytesobj", TestpurebytesobjObjCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "testsetbytearraylength", TestsetbytearraylengthObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testbytestring", TestbytestringObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testwrongnumargs", TestWrongNumArgsObjCmd, NULL, NULL); @@ -5037,6 +5041,50 @@ TestpurebytesobjObjCmd( /* *---------------------------------------------------------------------- * + * TestsetbytearraylengthObjCmd -- + * + * Testing command 'testsetbytearraylength` used to test the public + * interface routine Tcl_SetByteArrayLength(). + * + * Results: + * Returns the TCL_OK result code. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +TestsetbytearraylengthObjCmd( + ClientData unused, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* The argument objects. */ +{ + int n; + Tcl_Obj *obj = NULL; + + if (objc != 3) { + Tcl_WrongNumArgs(interp, 1, objv, "value length"); + return TCL_ERROR; + } + if (TCL_OK != Tcl_GetIntFromObj(interp, objv[2], &n)) { + return TCL_ERROR; + } + if (Tcl_IsShared(objv[1])) { + obj = Tcl_DuplicateObj(objv[1]); + } else { + obj = objv[1]; + } + Tcl_SetByteArrayLength(obj, n); + Tcl_SetObjResult(interp, obj); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * * TestbytestringObjCmd -- * * This object-based procedure constructs a string which can diff --git a/tests/binary.test b/tests/binary.test index 8c1dedb..92fb648 100644 --- a/tests/binary.test +++ b/tests/binary.test @@ -2889,6 +2889,17 @@ test binary-76.2 {binary string appending growth algorithm} win { # Append to it string length [append str [binary format a* foo]] } 3 + +testConstraint testsetbytearraylength \ + [expr {"testsetbytearraylength" in [info commands]}] + +test binary-77.1 {Tcl_SetByteArrayLength} testsetbytearraylength { + testsetbytearraylength [string cat A B C] 1 +} A +test binary-77.2 {Tcl_SetByteArrayLength} testsetbytearraylength { + testsetbytearraylength [string cat \u0141 B C] 1 +} A + # ---------------------------------------------------------------------- # cleanup -- cgit v0.12 From 5d52fb6a3f7a73e612fadb45f4b0c09c45df7317 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 12 Mar 2020 17:37:16 +0000 Subject: Renumber tests to account for later releases. --- tests/binary.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/binary.test b/tests/binary.test index 92fb648..b872a30 100644 --- a/tests/binary.test +++ b/tests/binary.test @@ -2893,10 +2893,10 @@ test binary-76.2 {binary string appending growth algorithm} win { testConstraint testsetbytearraylength \ [expr {"testsetbytearraylength" in [info commands]}] -test binary-77.1 {Tcl_SetByteArrayLength} testsetbytearraylength { +test binary-79.1 {Tcl_SetByteArrayLength} testsetbytearraylength { testsetbytearraylength [string cat A B C] 1 } A -test binary-77.2 {Tcl_SetByteArrayLength} testsetbytearraylength { +test binary-79.2 {Tcl_SetByteArrayLength} testsetbytearraylength { testsetbytearraylength [string cat \u0141 B C] 1 } A -- cgit v0.12 From 442f4cfd687d3869bbaf7beb1431592c29934c33 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 12 Mar 2020 20:54:09 +0000 Subject: Minimal fix for crash bug. --- generic/tclBinary.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generic/tclBinary.c b/generic/tclBinary.c index f0fc866..f7fdd9f 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -535,6 +535,7 @@ Tcl_SetByteArrayLength( SET_BYTEARRAY(irPtr, byteArrayPtr); } TclInvalidateStringRep(objPtr); + objPtr->typePtr = &properByteArrayType; byteArrayPtr->used = newLength; return byteArrayPtr->bytes; } @@ -851,6 +852,7 @@ TclAppendBytesToByteArray( } byteArrayPtr->used += length; TclInvalidateStringRep(objPtr); + objPtr->typePtr = &properByteArrayType; } /* -- cgit v0.12 From 068df4904b6c2f08348f62aa2f06b2103c8aae79 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 13 Mar 2020 11:01:34 +0000 Subject: reformat assemble-15.* test-cases --- tests/assemble.test | 80 ++++++++++++++++++----------------------------------- 1 file changed, 27 insertions(+), 53 deletions(-) diff --git a/tests/assemble.test b/tests/assemble.test index 40c132d..45368de 100644 --- a/tests/assemble.test +++ b/tests/assemble.test @@ -1535,61 +1535,35 @@ test assemble-14.7 {incrArrayStkImm} { # assemble-15 - listIndexImm -test assemble-15.1 {listIndexImm - wrong # args} { - -body { - assemble {listIndexImm} - } - -returnCodes error - -match glob - -result {wrong # args*} -} -test assemble-15.2 {listIndexImm - wrong # args} { - -body { - assemble {listIndexImm too many} - } - -returnCodes error - -match glob - -result {wrong # args*} -} -test assemble-15.3 {listIndexImm - bad substitution} { - -body { - list [catch {assemble {listIndexImm $foo}} result] $result $::errorCode - } - -result {1 {assembly code may not contain substitutions} {TCL ASSEM NOSUBST}} - -cleanup {unset result} -} -test assemble-15.4 {listIndexImm - invalid index} { - -body { - assemble {listIndexImm rubbish} - } - -returnCodes error - -match glob - -result {bad index "rubbish"*} -} -test assemble-15.5 {listIndexImm} { - -body { - assemble {push {a b c}; listIndexImm 2} - } - -result c -} -test assemble-15.6 {listIndexImm} { - -body { - assemble {push {a b c}; listIndexImm end-1} - } - -result b -} -test assemble-15.7 {listIndexImm} { - -body { - assemble {push {a b c}; listIndexImm end} - } - -result c -} -test assemble-15.8 {listIndexImm} { +test assemble-15.1 {listIndexImm - wrong # args} -body { + assemble {listIndexImm} +} -returnCodes error -match glob -result {wrong # args*} +test assemble-15.2 {listIndexImm - wrong # args} -body { + assemble {listIndexImm too many} +} -returnCodes error -match glob -result {wrong # args*} +test assemble-15.3 {listIndexImm - bad substitution} -body { + list [catch {assemble {listIndexImm $foo}} result] $result $::errorCode +} -cleanup { + unset result +} -result {1 {assembly code may not contain substitutions} {TCL ASSEM NOSUBST}} +test assemble-15.4 {listIndexImm - invalid index} -body { + assemble {listIndexImm rubbish} +} -returnCodes error -match glob -result {bad index "rubbish"*} +test assemble-15.5 {listIndexImm} -body { + assemble {push {a b c}; listIndexImm 2} +} -result c +test assemble-15.6 {listIndexImm} -body { + assemble {push {a b c}; listIndexImm end-1} +} -result b +test assemble-15.7 {listIndexImm} -body { + assemble {push {a b c}; listIndexImm end} +} -result c +test assemble-15.8 {listIndexImm} -body { assemble {push {a b c}; listIndexImm end+2} -} {} -test assemble-15.9 {listIndexImm} { +} -result {} +test assemble-15.9 {listIndexImm} -body { assemble {push {a b c}; listIndexImm -1-1} -} {} +} -result {} # assemble-16 - invokeStk -- cgit v0.12 From 86581b5325d887b6e583cd607f1587f9dea918b2 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 13 Mar 2020 13:06:53 +0000 Subject: env.test: added test for windows illustrating bug [8f89e2e059] - loss of multi-byte chars in environment if single-byte system encoding used --- tests/env.test | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/env.test b/tests/env.test index e6ce44d..8eb5612 100644 --- a/tests/env.test +++ b/tests/env.test @@ -217,6 +217,26 @@ test env-2.4 { NAME2=more XYZZY=garbage} +test env-2.5 {different encoding (wide chars)} -constraints {win exec} -setup { + # be sure set of (unicode) environment occurs if single-byte encoding is used: + encodingswitch cp1252 + # german (cp1252) and russian (cp1251) characters together encoded as utf-8: + set val 2d2dc3a4c3b6c3bcc39f2dd182d0b5d181d1822d2d + set env(XYZZY) [encoding convertfrom utf-8 [binary decode hex $val]] + # now switch to utf-8 (to see correct values from test): + encoding system utf-8 +} -body { + exec [interpreter] << [string map [list \$val $val] { + encoding system utf-8; fconfigure stdout -encoding utf-8 + set test [encoding convertfrom utf-8 [binary decode hex $val]] + puts "[expr {$env(XYZZY) eq $test}] \ngot:\t\ + $env(XYZZY) ([binary encode hex [encoding convertto $env(XYZZY)]]) \nexp:\t\ + $test ([binary encode hex [encoding convertto $test]])" + }] +} -cleanup { + encodingrestore + unset -nocomplain val f env(XYZZY) +} -match glob -result {1 *} test env-3.1 { changing environment variables -- cgit v0.12 From 72a735d08976532d328dfd91150df8786a56e5c9 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 13 Mar 2020 13:08:15 +0000 Subject: fix back-ported from tclSE (with several modifications due to conflicts and compat reasons) --- generic/tclEnv.c | 65 +++++++++++++++++++++++++++++++++++++------------------- win/Makefile.in | 5 ++++- win/tclWinInit.c | 16 ++++++++++++-- 3 files changed, 61 insertions(+), 25 deletions(-) diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 487c1a2..9b5f80c 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -34,6 +34,27 @@ static struct { #endif } env; +#if defined(_WIN32) && (defined(_UNICODE) || defined(UNICODE)) +# define tenviron _wenviron +# define tenviron2utfdstr(tenvstr, len, dstr) \ + Tcl_WinTCharToUtf((TCHAR *)tenvstr, len, dstr) +# define utf2tenvirondstr(str, len, dstr) \ + (const char *)Tcl_WinUtfToTChar(str, len, dstr) +# define techar TCHAR +# ifdef USE_PUTENV +# define putenv(env) _wputenv((const wchar_t *)env) +# endif +#else +# define tenviron environ +# define tenviron2utfdstr(tenvstr, len, dstr) \ + Tcl_ExternalToUtfDString(NULL, tenvstr, len, dstr) +# define utf2tenvirondstr(str, len, dstr) \ + Tcl_UtfToExternalDString(NULL, str, len, dstr) +# define techar char +#endif + +#define tNTL sizeof(techar) + /* * Declarations for local functions defined in this file: */ @@ -113,16 +134,16 @@ TclSetupEnv( * will hold just the parts to remove. */ - if (environ[0] != NULL) { + if (tenviron[0] != NULL) { int i; Tcl_MutexLock(&envMutex); - for (i = 0; environ[i] != NULL; i++) { + for (i = 0; tenviron[i] != NULL; i++) { Tcl_Obj *obj1, *obj2; const char *p1; char *p2; - p1 = Tcl_ExternalToUtfDString(NULL, environ[i], -1, &envString); + p1 = tenviron2utfdstr(tenviron[i], -1, &envString); p2 = strchr(p1, '='); if (p2 == NULL) { /* @@ -238,18 +259,18 @@ TclSetEnv( * environment is the one we allocated. [Bug 979640] */ - if ((env.ourEnviron != environ) || (length+2 > env.ourEnvironSize)) { + if ((env.ourEnviron != (char *)tenviron) || (length+2 > env.ourEnvironSize)) { char **newEnviron = ckalloc((length + 5) * sizeof(char *)); - memcpy(newEnviron, environ, length * sizeof(char *)); + memcpy(newEnviron, tenviron, length * sizeof(char *)); if ((env.ourEnvironSize != 0) && (env.ourEnviron != NULL)) { ckfree(env.ourEnviron); } - environ = env.ourEnviron = newEnviron; + tenviron = (techar **)(env.ourEnviron = newEnviron); env.ourEnvironSize = length + 5; } index = length; - environ[index + 1] = NULL; + tenviron[index + 1] = NULL; #endif /* USE_PUTENV */ oldValue = NULL; nameLength = strlen(name); @@ -264,7 +285,7 @@ TclSetEnv( * interpreters. */ - oldEnv = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envString); + oldEnv = tenviron2utfdstr(tenviron[index], -1, &envString); if (strcmp(value, oldEnv + (length + 1)) == 0) { Tcl_DStringFree(&envString); Tcl_MutexUnlock(&envMutex); @@ -272,7 +293,7 @@ TclSetEnv( } Tcl_DStringFree(&envString); - oldValue = environ[index]; + oldValue = (char *)tenviron[index]; nameLength = (unsigned) length; } @@ -287,14 +308,14 @@ TclSetEnv( memcpy(p, name, nameLength); p[nameLength] = '='; memcpy(p+nameLength+1, value, valueLength+1); - p2 = Tcl_UtfToExternalDString(NULL, p, -1, &envString); + p2 = utf2tenvirondstr(p, -1, &envString); /* * Copy the native string to heap memory. */ - p = ckrealloc(p, Tcl_DStringLength(&envString) + 1); - memcpy(p, p2, (unsigned) Tcl_DStringLength(&envString) + 1); + p = ckrealloc(p, Tcl_DStringLength(&envString) + tNTL); + memcpy(p, p2, (unsigned) Tcl_DStringLength(&envString) + tNTL); Tcl_DStringFree(&envString); #ifdef USE_PUTENV @@ -305,7 +326,7 @@ TclSetEnv( putenv(p); index = TclpFindVariable(name, &length); #else - environ[index] = p; + tenviron[index] = (techar *)p; #endif /* USE_PUTENV */ /* @@ -314,7 +335,7 @@ TclSetEnv( * string in the cache. */ - if ((index != -1) && (environ[index] == p)) { + if ((index != -1) && (tenviron[index] == (techar *)p)) { ReplaceString(oldValue, p); #ifdef HAVE_PUTENV_THAT_COPIES } else { @@ -378,7 +399,7 @@ Tcl_PutEnv( * name and value parts, and call TclSetEnv to do all of the real work. */ - name = Tcl_ExternalToUtfDString(NULL, assignment, -1, &nameString); + name = tenviron2utfdstr(assignment, -1, &nameString); value = strchr(name, '='); if ((value != NULL) && (value != name)) { @@ -440,7 +461,7 @@ TclUnsetEnv( * Remember the old value so we can free it if Tcl created the string. */ - oldValue = environ[index]; + oldValue = (char *)tenviron[index]; /* * Update the system environment. This must be done before we update the @@ -464,10 +485,10 @@ TclUnsetEnv( string[length] = '\0'; #endif /* _WIN32 */ - Tcl_UtfToExternalDString(NULL, string, -1, &envString); - string = ckrealloc(string, Tcl_DStringLength(&envString) + 1); + utf2tenvirondstr(string, -1, &envString); + string = ckrealloc(string, Tcl_DStringLength(&envString) + tNTL); memcpy(string, Tcl_DStringValue(&envString), - (unsigned) Tcl_DStringLength(&envString)+1); + (unsigned) Tcl_DStringLength(&envString) + tNTL); Tcl_DStringFree(&envString); putenv(string); @@ -478,7 +499,7 @@ TclUnsetEnv( * string in the cache. */ - if (environ[index] == string) { + if (tenviron[index] == (techar *)string) { ReplaceString(oldValue, string); #ifdef HAVE_PUTENV_THAT_COPIES } else { @@ -490,7 +511,7 @@ TclUnsetEnv( #endif /* HAVE_PUTENV_THAT_COPIES */ } #else /* !USE_PUTENV_FOR_UNSET */ - for (envPtr = environ+index+1; ; envPtr++) { + for (envPtr = (char *)(tenviron+index+1); ; envPtr++) { envPtr[-1] = *envPtr; if (*envPtr == NULL) { break; @@ -539,7 +560,7 @@ TclGetEnv( if (index != -1) { Tcl_DString envStr; - result = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envStr); + result = tenviron2utfdstr(tenviron[index], -1, &envStr); result += length; if (*result == '=') { result++; diff --git a/win/Makefile.in b/win/Makefile.in index 70a6909..667a0be 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -528,11 +528,14 @@ ${ZLIB_DLL_FILE}: ${TCL_STUB_LIB_FILE} # Special case object targets +tclEnv.${OBJEXT}: tclEnv.c + $(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) -DUNICODE -D_UNICODE @DEPARG@ $(CC_OBJNAME) + tclTestMain.${OBJEXT}: tclAppInit.c $(CC) -c $(CC_SWITCHES) -DTCL_TEST -DUNICODE -D_UNICODE $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) tclWinInit.${OBJEXT}: tclWinInit.c - $(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) + $(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) -DUNICODE -D_UNICODE @DEPARG@ $(CC_OBJNAME) tclWinPipe.${OBJEXT}: tclWinPipe.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 6ca6a46..2d26482 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -683,6 +683,16 @@ TclpSetVariables( *---------------------------------------------------------------------- */ +#if defined(_WIN32) && (defined(_UNICODE) || defined(UNICODE)) +# define tenviron _wenviron +# define tenviron2utfdstr(tenvstr, len, dstr) \ + Tcl_WinTCharToUtf((TCHAR *)tenvstr, len, dstr) +#else +# define tenviron environ +# define tenviron2utfdstr(tenvstr, len, dstr) \ + Tcl_ExternalToUtfDString(NULL, tenvstr, len, dstr) +#endif + int TclpFindVariable( const char *name, /* Name of desired environment variable @@ -707,14 +717,16 @@ TclpFindVariable( Tcl_UtfToUpper(nameUpper); Tcl_DStringInit(&envString); - for (i = 0, env = environ[i]; env != NULL; i++, env = environ[i]) { + for (i = 0, env = (const char *)tenviron[i]; + env != NULL; + i++, env = (const char *)tenviron[i]) { /* * Chop the env string off after the equal sign, then Convert the name * to all upper case, so we do not have to convert all the characters * after the equal sign. */ - envUpper = Tcl_ExternalToUtfDString(NULL, env, -1, &envString); + envUpper = tenviron2utfdstr(env, -1, &envString); p1 = strchr(envUpper, '='); if (p1 == NULL) { continue; -- cgit v0.12 From fdfd0ad0b667f995f43147ca8504fc3bdb873e61 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 13 Mar 2020 18:32:45 +0000 Subject: New internal routine TclGetBytesFromObj(). Aimed to become public, see TIP 568 in progress. --- generic/tclBinary.c | 65 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/generic/tclBinary.c b/generic/tclBinary.c index f7fdd9f..b27a790 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -436,6 +436,53 @@ Tcl_SetByteArrayObj( /* *---------------------------------------------------------------------- * + * TclGetBytesFromObj -- + * + * Attempt to extract the value from objPtr in the representation + * of a byte sequence. On success return the extracted byte sequence. + * On failures, return NULL and record error message and code in + * interp (if not NULL). + * + * Results: + * Pointer to array of bytes, or NULL. representing the ByteArray object. + * Writes number of bytes in array to *lengthPtr. + * + *---------------------------------------------------------------------- + */ + +unsigned char * +TclGetBytesFromObj( + Tcl_Interp *interp, /* For error reporting */ + Tcl_Obj *objPtr, /* Value to extract from */ + int *lengthPtr) /* If non-NULL, filled with length of the + * array of bytes in the ByteArray object. */ +{ + ByteArray *baPtr; + const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &properByteArrayType); + + if (irPtr == NULL) { + SetByteArrayFromAny(NULL, objPtr); + irPtr = TclFetchIntRep(objPtr, &properByteArrayType); + if (irPtr == NULL) { + if (interp) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "expected bytes but got non-byte character")); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "BYTES", NULL); + } + return NULL; + } + } + baPtr = GET_BYTEARRAY(irPtr); + + if (lengthPtr != NULL) { + *lengthPtr = baPtr->used; + } + return baPtr->bytes; +} + +/* + *---------------------------------------------------------------------- + * * Tcl_GetByteArrayFromObj -- * * Attempt to get the array of bytes from the Tcl object. If the object @@ -458,18 +505,16 @@ Tcl_GetByteArrayFromObj( * array of bytes in the ByteArray object. */ { ByteArray *baPtr; - const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &properByteArrayType); + const Tcl_ObjIntRep *irPtr; + unsigned char *result = TclGetBytesFromObj(NULL, objPtr, lengthPtr); - if (irPtr == NULL) { - irPtr = TclFetchIntRep(objPtr, &tclByteArrayType); - if (irPtr == NULL) { - SetByteArrayFromAny(NULL, objPtr); - irPtr = TclFetchIntRep(objPtr, &properByteArrayType); - if (irPtr == NULL) { - irPtr = TclFetchIntRep(objPtr, &tclByteArrayType); - } - } + if (result) { + return result; } + + irPtr = TclFetchIntRep(objPtr, &tclByteArrayType); + assert(irPtr != NULL); + baPtr = GET_BYTEARRAY(irPtr); if (lengthPtr != NULL) { -- cgit v0.12 From e3e05a2cf9d003885956c76ba0dcf6a6e38d8884 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 13 Mar 2020 18:55:10 +0000 Subject: Need declaration too. --- generic/tclInt.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generic/tclInt.h b/generic/tclInt.h index 9126c3b..a2de2e9 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3026,6 +3026,8 @@ MODULE_SCOPE int TclNREvalFile(Tcl_Interp *interp, Tcl_Obj *pathPtr, MODULE_SCOPE void TclFSUnloadTempFile(Tcl_LoadHandle loadHandle); MODULE_SCOPE int * TclGetAsyncReadyPtr(void); MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler(Tcl_Interp *interp); +MODULE_SCOPE unsigned char * TclGetBytesFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, int *lengthPtr); MODULE_SCOPE int TclGetChannelFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Channel *chanPtr, int *modePtr, int flags); -- cgit v0.12 From 707032478736e33d1355358b98ce94e72478362a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 14 Mar 2020 21:21:10 +0000 Subject: Convert many test-cases to modern test syntax --- tests/lindex.test | 121 ++++++++++++++++----------------- tests/lrange.test | 25 ++++--- tests/lreplace.test | 32 ++++----- tests/regexp.test | 180 +++++++++++++++++++++++++------------------------- tests/regexpComp.test | 48 +++++++------- tests/string.test | 168 +++++++++++++++++++++++----------------------- tests/util.test | 24 +++---- 7 files changed, 295 insertions(+), 303 deletions(-) diff --git a/tests/lindex.test b/tests/lindex.test index bb3f005..2b1742e 100644 --- a/tests/lindex.test +++ b/tests/lindex.test @@ -51,22 +51,22 @@ test lindex-2.4 {malformed index list} testevalex { # Indices that are integers or convertible to integers -test lindex-3.1 {integer -1} testevalex { +test lindex-3.1 {integer -1} -constraints testevalex -body { set x ${minus}1 list [testevalex {lindex {a b c} $x}] [testevalex {lindex {a b c} $x}] -} {{} {}} -test lindex-3.2 {integer 0} testevalex { +} -result {{} {}} +test lindex-3.2 {integer 0} -constraints testevalex -body { set x [string range 00 0 0] list [testevalex {lindex {a b c} $x}] [testevalex {lindex {a b c} $x}] -} {a a} -test lindex-3.3 {integer 2} testevalex { +} -result {a a} +test lindex-3.3 {integer 2} -constraints testevalex -body { set x [string range 22 0 0] list [testevalex {lindex {a b c} $x}] [testevalex {lindex {a b c} $x}] -} {c c} -test lindex-3.4 {integer 3} testevalex { +} -result {c c} +test lindex-3.4 {integer 3} -constraints testevalex -body { set x [string range 33 0 0] list [testevalex {lindex {a b c} $x}] [testevalex {lindex {a b c} $x}] -} {{} {}} +} -result {{} {}} test lindex-3.5 {bad octal} -constraints testevalex -body { set x 0o8 list [catch { testevalex {lindex {a b c} $x} } result] $result @@ -75,19 +75,19 @@ test lindex-3.6 {bad octal} -constraints testevalex -body { set x -0o9 list [catch { testevalex {lindex {a b c} $x} } result] $result } -match glob -result {1 {*invalid octal number*}} -test lindex-3.7 {indexes don't shimmer wide ints} { +test lindex-3.7 {indexes don't shimmer wide ints} -body { set x [expr {(wide(1)<<31) - 2}] list $x [lindex {1 2 3} $x] [incr x] [incr x] -} {2147483646 {} 2147483647 2147483648} -test lindex-3.8 {compiled with static indices out of range, negative} { +} -result {2147483646 {} 2147483647 2147483648} +test lindex-3.8 {compiled with static indices out of range, negative} -body { list [lindex {a b c} -1] [lindex {a b c} -2] [lindex {a b c} -3] -} [lrepeat 3 {}] -test lindex-3.9 {compiled with calculated indices out of range, negative constant} { +} -result [lrepeat 3 {}] +test lindex-3.9 {compiled with calculated indices out of range, negative constant} -body { list [lindex {a b c} -1-1] [lindex {a b c} -2+0] [lindex {a b c} -2+1] -} [lrepeat 3 {}] -test lindex-3.10 {compiled with calculated indices out of range, after end} { +} -result [lrepeat 3 {}] +test lindex-3.10 {compiled with calculated indices out of range, after end} -body { list [lindex {a b c} end+1] [lindex {a b c} end+2] [lindex {a b c} end+3] -} [lrepeat 3 {}] +} -result [lrepeat 3 {}] # Indices relative to end @@ -165,34 +165,38 @@ test lindex-7.4 {quoted elements} { lindex {a b {c d "e} {f g"}} 2 } {c d "e} -test lindex-8.1 {data reuse} testevalex { +test lindex-8.1 {data reuse} -constraints testevalex -body { set x 0 testevalex {lindex $x $x} -} {0} -test lindex-8.2 {data reuse} testevalex { +} -result 0 +test lindex-8.2 {data reuse} -constraints testevalex -body { set a 0 testevalex {lindex $a $a $a} -} 0 -test lindex-8.3 {data reuse} testevalex { +} -result 0 +test lindex-8.3 {data reuse} -constraints { + testevalex +} -body { set a 1 testevalex {lindex $a $a $a} -} {} -test lindex-8.4 {data reuse} testevalex { +} -result {} +test lindex-8.4 {data reuse} -constraints testevalex -body { set x [list 0 0] testevalex {lindex $x $x} -} {0} -test lindex-8.5 {data reuse} testevalex { +} -result 0 +test lindex-8.5 {data reuse} -constraints testevalex -body { set x 0 testevalex {lindex $x [list $x $x]} -} {0} -test lindex-8.6 {data reuse} testevalex { +} -result 0 +test lindex-8.6 {data reuse} -constraints testevalex -body { set x [list 1 1] testevalex {lindex $x $x} -} {} -test lindex-8.7 {data reuse} testevalex { +} -result {} +test lindex-8.7 {data reuse} -constraints { + testevalex +} -body { set x 1 testevalex {lindex $x [list $x $x]} -} {} +} -result {} #---------------------------------------------------------------------- @@ -381,80 +385,69 @@ test lindex-15.3 {quoted elements} { } result set result } {c d " x} -test lindex-15.4 {quoted elements} { +test lindex-15.4 {quoted elements} -body { catch { lindex {a b {c d "e} {f g"}} 2 } result set result -} {c d "e} +} -result {c d "e} -test lindex-16.1 {data reuse} { +test lindex-16.1 {data reuse} -body { set x 0 catch { lindex $x $x } result set result -} {0} -test lindex-16.2 {data reuse} { +} -result {0} +test lindex-16.2 {data reuse} -body { set a 0 catch { lindex $a $a $a } result set result -} 0 -test lindex-16.3 {data reuse} { +} -result 0 +test lindex-16.3 {data reuse} -body { set a 1 catch { lindex $a $a $a } result set result -} {} -test lindex-16.4 {data reuse} { +} -result {} +test lindex-16.4 {data reuse} -body { set x [list 0 0] catch { lindex $x $x } result set result -} {0} -test lindex-16.5 {data reuse} { +} -result {0} +test lindex-16.5 {data reuse} -body { set x 0 catch { lindex $x [list $x $x] } result set result -} {0} -test lindex-16.6 {data reuse} { +} -result {0} +test lindex-16.6 {data reuse} -body { set x [list 1 1] catch { lindex $x $x } result set result -} {} -test lindex-16.7 {data reuse} { +} -result {} +test lindex-16.7 {data reuse} -body { set x 1 catch { lindex $x [list $x $x] } result set result -} {} - -test lindex-17.0 {Bug 1718580} {*}{ - -body { - lindex {} end foo - } - -match glob - -result {bad index "foo"*} - -returnCodes 1 -} - -test lindex-17.1 {Bug 1718580} {*}{ - -body { - lindex a end foo - } - -match glob - -result {bad index "foo"*} - -returnCodes 1 -} +} -result {} + +test lindex-17.0 {Bug 1718580} -body { + lindex {} end foo +} -match glob -result {bad index "foo"*} -returnCodes 1 +test lindex-17.1 {Bug 1718580} -body { + lindex a end foo +} -match glob -result {bad index "foo"*} -returnCodes 1 catch { unset minus } diff --git a/tests/lrange.test b/tests/lrange.test index 4f7c0d3..5798707 100644 --- a/tests/lrange.test +++ b/tests/lrange.test @@ -20,7 +20,6 @@ if {[lsearch [namespace children] ::tcltest] == -1} { catch [list package require -exact Tcltest [info patchlevel]] testConstraint testpurebytesobj [llength [info commands testpurebytesobj]] - test lrange-1.1 {range of list elements} { lrange {a b c d} 1 2 @@ -102,9 +101,9 @@ test lrange-3.2 {compiled with static indices out of range, negative} { test lrange-3.3 {compiled with calculated indices out of range, negative constant} { list [lrange {a b c} 0-1 -1-1] [lrange {a b c} -2+0 0-1] [lrange {a b c} -2-1 -2+1] [lrange {a b c} -2+1 -2-1] } [lrepeat 4 {}] -test lrange-3.4 {compiled with calculated indices out of range, after end} { +test lrange-3.4 {compiled with calculated indices out of range, after end} -body { list [lrange {a b c} end+1 end+2] [lrange {a b c} end+2 end+1] [lrange {a b c} end+2 end+3] [lrange {a b c} end+3 end+2] -} [lrepeat 4 {}] +} -result [lrepeat 4 {}] test lrange-3.5 {compiled with calculated indices, start out of range (negative)} { list [lrange {a b c} -1 1] [lrange {a b c} -1+0 end-1] [lrange {a b c} -2 1] [lrange {a b c} -2+0 0+1] @@ -117,22 +116,22 @@ test lrange-3.7a {compiled on empty not canonical list (with static and dynamic list [lrange { } 0 1] [lrange [format %c 32] 0 1] [lrange [set a { }] 0 1] \ [lrange { } 0-1 end+1] [lrange [format %c 32] 0-1 end+1] [lrange $a 0-1 end+1] } [lrepeat 6 {}] -test lrange-3.7b {not compiled on empty not canonical list (with static and dynamic indices), regression test, bug [cc1e91552c]} { +test lrange-3.7b {not compiled on empty not canonical list (with static and dynamic indices), regression test, bug [cc1e91552c]} -body { set cmd lrange list [$cmd { } 0 1] [$cmd [format %c 32] 0 1] [$cmd [set a { }] 0 1] \ [$cmd { } 0-1 end+1] [$cmd [format %c 32] 0-1 end+1] [$cmd $a 0-1 end+1] -} [lrepeat 6 {}] +} -result [lrepeat 6 {}] # following 4 tests could cause a segfault on empty non-lists with tclEmptyStringRep # (as before the fix [58c46e74b931d3a1]): test lrange-3.7a.2 {compiled on empty not list object, 2nd regression test, bug [cc1e91552c]} { list [lrange {} 0 1] [lrange [lindex a -1] 0 1] [lrange [set a {}] 0 1] \ [lrange {} 0-1 end+1] [lrange [lindex a -1] 0-1 end+1] [lrange $a 0-1 end+1] } [lrepeat 6 {}] -test lrange-3.7b.2 {not compiled on empty not list object, 2nd regression test, bug [cc1e91552c]} { +test lrange-3.7b.2 {not compiled on empty not list object, 2nd regression test, bug [cc1e91552c]} -body { set cmd lrange list [$cmd {} 0 1] [$cmd [lindex a -1] 0 1] [$cmd [set a {}] 0 1] \ [$cmd {} 0-1 end+1] [$cmd [lindex a -1] 0-1 end+1] [$cmd $a 0-1 end+1] -} [lrepeat 6 {}] +} -result [lrepeat 6 {}] test lrange-3.7c.2 {compiled on empty pure bytes object, 2nd regression test, bug [cc1e91552c]} -constraints { testpurebytesobj } -body { @@ -226,24 +225,24 @@ apply {{} { set tester [list lrange $ls $a $b] set script [list catch $tester m] set script "list \[$script\] \$m" - test lrange-5.[incr n].1 {lrange shared compiled} \ - [list apply [list {} $script]] $expected + test lrange-5.[incr n].1 {lrange shared compiled} -body \ + [list apply [list {} $script]] -result $expected # Unshared, uncompiled set tester [string map [list %l [list $ls] %a $a %b $b] { [string cat l range] [lrange %l 0 end] %a %b }] set script [list catch $tester m] set script "list \[$script\] \$m" - test lrange-5.$n.2 {lrange unshared uncompiled} \ - [list apply [list {} $script]] $expected + test lrange-5.$n.2 {lrange unshared uncompiled} -body \ + [list apply [list {} $script]] -result $expected # Unshared, compiled set tester [string map [list %l [list $ls] %a $a %b $b] { lrange [lrange %l 0 end] %a %b }] set script [list catch $tester m] set script "list \[$script\] \$m" - test lrange-5.$n.3 {lrange unshared compiled} \ - [list apply [list {} $script]] $expected + test lrange-5.$n.3 {lrange unshared compiled} -body \ + [list apply [list {} $script]] -result $expected } } } diff --git a/tests/lreplace.test b/tests/lreplace.test index fd2f7f8..4ce3ef4 100644 --- a/tests/lreplace.test +++ b/tests/lreplace.test @@ -111,27 +111,27 @@ test lreplace-1.30 {lreplace command} -body { lreplace {not {}alist} 0 0 [error foo] } -returnCodes 1 -result {foo} -test lreplace-2.1 {lreplace errors} { +test lreplace-2.1 {lreplace errors} -body { list [catch lreplace msg] $msg -} {1 {wrong # args: should be "lreplace list first last ?element ...?"}} -test lreplace-2.2 {lreplace errors} { +} -result {1 {wrong # args: should be "lreplace list first last ?element ...?"}} +test lreplace-2.2 {lreplace errors} -body { list [catch {lreplace a b} msg] $msg -} {1 {wrong # args: should be "lreplace list first last ?element ...?"}} -test lreplace-2.3 {lreplace errors} { +} -result {1 {wrong # args: should be "lreplace list first last ?element ...?"}} +test lreplace-2.3 {lreplace errors} -body { list [catch {lreplace x a 10} msg] $msg -} {1 {bad index "a": must be integer?[+-]integer? or end?[+-]integer?}} -test lreplace-2.4 {lreplace errors} { +} -result {1 {bad index "a": must be integer?[+-]integer? or end?[+-]integer?}} +test lreplace-2.4 {lreplace errors} -body { list [catch {lreplace x 10 x} msg] $msg -} {1 {bad index "x": must be integer?[+-]integer? or end?[+-]integer?}} -test lreplace-2.5 {lreplace errors} { +} -result {1 {bad index "x": must be integer?[+-]integer? or end?[+-]integer?}} +test lreplace-2.5 {lreplace errors} -body { list [catch {lreplace x 10 1x} msg] $msg -} {1 {bad index "1x": must be integer?[+-]integer? or end?[+-]integer?}} -test lreplace-2.6 {lreplace errors} { +} -result {1 {bad index "1x": must be integer?[+-]integer? or end?[+-]integer?}} +test lreplace-2.6 {lreplace errors} -body { list [catch {lreplace x 3 2} msg] $msg -} {0 x} -test lreplace-2.7 {lreplace errors} { +} -result {0 x} +test lreplace-2.7 {lreplace errors} -body { list [catch {lreplace x 2 2} msg] $msg -} {0 x} +} -result {0 x} test lreplace-3.1 {lreplace won't modify shared argument objects} { proc p {} { @@ -228,8 +228,8 @@ apply {{} { set tester [list lreplace $ls $a $b {*}$i] set script [list catch $tester m] set script "list \[$script\] \$m" - test lreplace-6.[incr n] {lreplace battery} \ - [list apply [list {} $script]] $expected + test lreplace-6.[incr n] {lreplace battery} -body \ + [list apply [list {} $script]] -result $expected } } } diff --git a/tests/regexp.test b/tests/regexp.test index 7367af7..bae1217 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -542,133 +542,133 @@ test regexp-14.3 {CompileRegexp: regexp cache, empty regexp and empty cache} -co removeFile junk.tcl } -result 1 -test regexp-15.1 {regexp -start} { +test regexp-15.1 {regexp -start} -body { unset -nocomplain x list [regexp -start -10 {\d} 1abc2de3 x] $x -} {1 1} -test regexp-15.2 {regexp -start} { +} -result {1 1} +test regexp-15.2 {regexp -start} -body { unset -nocomplain x list [regexp -start 2 {\d} 1abc2de3 x] $x -} {1 2} -test regexp-15.3 {regexp -start} { +} -result {1 2} +test regexp-15.3 {regexp -start} -body { unset -nocomplain x list [regexp -start 4 {\d} 1abc2de3 x] $x -} {1 2} -test regexp-15.4 {regexp -start} { +} -result {1 2} +test regexp-15.4 {regexp -start} -body { unset -nocomplain x list [regexp -start 5 {\d} 1abc2de3 x] $x -} {1 3} -test regexp-15.5 {regexp -start, over end of string} { +} -result {1 3} +test regexp-15.5 {regexp -start, over end of string} -body { unset -nocomplain x list [regexp -start [string length 1abc2de3] {\d} 1abc2de3 x] [info exists x] -} {0 0} -test regexp-15.6 {regexp -start, loss of ^$ behavior} { +} -result {0 0} +test regexp-15.6 {regexp -start, loss of ^$ behavior} -body { list [regexp -start 2 {^$} {}] -} {0} -test regexp-15.7 {regexp -start, double option} { +} -result {0} +test regexp-15.7 {regexp -start, double option} -body { regexp -start 2 -start 0 a abc -} 1 -test regexp-15.8 {regexp -start, double option} { +} -result 1 +test regexp-15.8 {regexp -start, double option} -body { regexp -start 0 -start 2 a abc -} 0 -test regexp-15.9 {regexp -start, end relative index} { +} -result 0 +test regexp-15.9 {regexp -start, end relative index} -body { unset -nocomplain x list [regexp -start end {\d} 1abc2de3 x] [info exists x] -} {0 0} -test regexp-15.10 {regexp -start, end relative index} { +} -result {0 0} +test regexp-15.10 {regexp -start, end relative index} -body { unset -nocomplain x list [regexp -start end-1 {\d} 1abc2de3 x] [info exists x] $x -} {1 1 3} -test regexp-15.11 {regexp -start, over end of string} { +} -result {1 1 3} +test regexp-15.11 {regexp -start, over end of string} -body { set x NA list [regexp -start 2 {.*} ab x] $x -} {1 {}} +} -result {1 {}} -test regexp-16.1 {regsub -start} { +test regexp-16.1 {regsub -start} -body { unset -nocomplain x list [regsub -all -start 2 {\d} a1b2c3d4e5 {/&} x] $x -} {4 a1b/2c/3d/4e/5} -test regexp-16.2 {regsub -start} { +} -result {4 a1b/2c/3d/4e/5} +test regexp-16.2 {regsub -start} -body { unset -nocomplain x list [regsub -all -start -25 {z} hello {/&} x] $x -} {0 hello} -test regexp-16.3 {regsub -start} { +} -result {0 hello} +test regexp-16.3 {regsub -start} -body { unset -nocomplain x list [regsub -all -start 3 {z} hello {/&} x] $x -} {0 hello} -test regexp-16.4 {regsub -start, \A behavior} { +} -result {0 hello} +test regexp-16.4 {regsub -start, \A behavior} -body { set out {} lappend out [regsub -start 0 -all {\A(\w)} {abcde} {/\1} x] $x lappend out [regsub -start 2 -all {\A(\w)} {abcde} {/\1} x] $x -} {5 /a/b/c/d/e 3 ab/c/d/e} -test regexp-16.5 {regsub -start, double option} { +} -result {5 /a/b/c/d/e 3 ab/c/d/e} +test regexp-16.5 {regsub -start, double option} -body { list [regsub -start 2 -start 0 a abc c x] $x -} {1 cbc} -test regexp-16.6 {regsub -start, double option} { +} -result {1 cbc} +test regexp-16.6 {regsub -start, double option} -body { list [regsub -start 0 -start 2 a abc c x] $x -} {0 abc} -test regexp-16.7 {regexp -start, end relative index} { +} -result {0 abc} +test regexp-16.7 {regexp -start, end relative index} -body { list [regsub -start end a aaa b x] $x -} {0 aaa} -test regexp-16.8 {regexp -start, end relative index} { +} -result {0 aaa} +test regexp-16.8 {regexp -start, end relative index} -body { list [regsub -start end-1 a aaa b x] $x -} {1 aab} -test regexp-16.9 {regsub -start and -all} { +} -result {1 aab} +test regexp-16.9 {regsub -start and -all} -body { set foo {} list [regsub -start 0 -all x+ axxxbxx |&| foo] $foo -} {2 a|xxx|b|xx|} -test regexp-16.10 {regsub -start and -all} { +} -result {2 a|xxx|b|xx|} +test regexp-16.10 {regsub -start and -all} -body { set foo {} list [regsub -start 1 -all x+ axxxbxx |&| foo] $foo -} {2 a|xxx|b|xx|} -test regexp-16.11 {regsub -start and -all} { +} -result {2 a|xxx|b|xx|} +test regexp-16.11 {regsub -start and -all} -body { set foo {} list [regsub -start 4 -all x+ axxxbxx |&| foo] $foo -} {1 axxxb|xx|} -test regexp-16.12 {regsub -start} { +} -result {1 axxxb|xx|} +test regexp-16.12 {regsub -start} -body { set foo {} list [regsub -start 4 x+ axxxbxx |&| foo] $foo -} {1 axxxb|xx|} -test regexp-16.13 {regsub -start and -all} { +} -result {1 axxxb|xx|} +test regexp-16.13 {regsub -start and -all} -body { set foo {} list [regsub -start 1 -all a+ "" & foo] $foo -} {0 {}} -test regexp-16.14 {regsub -start} { +} -result {0 {}} +test regexp-16.14 {regsub -start} -body { set foo {} list [regsub -start 1 a+ "" & foo] $foo -} {0 {}} -test regexp-16.15 {regsub -start and -all} { +} -result {0 {}} +test regexp-16.15 {regsub -start and -all} -body { set foo {} list [regsub -start 2 -all a+ "xy" & foo] $foo -} {0 xy} -test regexp-16.16 {regsub -start} { +} -result {0 xy} +test regexp-16.16 {regsub -start} -body { set foo {} list [regsub -start 2 a+ "xy" & foo] $foo -} {0 xy} -test regexp-16.17 {regsub -start and -all} { +} -result {0 xy} +test regexp-16.17 {regsub -start and -all} -body { set foo {} list [regsub -start 1 -all y+ "xy" & foo] $foo -} {1 xy} -test regexp-16.18 {regsub -start} { +} -result {1 xy} +test regexp-16.18 {regsub -start} -body { set foo {} list [regsub -start 1 y+ "xy" & foo] $foo -} {1 xy} -test regexp-16.19 {regsub -start} { +} -result {1 xy} +test regexp-16.19 {regsub -start} -body { set foo {} list [regsub -start -1 a+ "" & foo] $foo -} {0 {}} -test regexp-16.20 {regsub -start, loss of ^$ behavior} { +} -result {0 {}} +test regexp-16.20 {regsub -start, loss of ^$ behavior} -body { set foo NA list [regsub -start 1 {^$} {} & foo] $foo -} {0 {}} -test regexp-16.21 {regsub -start, loss of ^$ behavior} { +} -result {0 {}} +test regexp-16.21 {regsub -start, loss of ^$ behavior} -body { set foo NA list [regsub -start 1 {^.*$} abc & foo] $foo -} {0 abc} -test regexp-16.22 {regsub -start, loss of ^$ behavior} { +} -result {0 abc} +test regexp-16.22 {regsub -start, loss of ^$ behavior} -body { set foo NA list [regsub -all -start 1 {^.*$} abc & foo] $foo -} {0 abc} +} -result {0 abc} test regexp-17.1 {regexp -inline} { regexp -inline b ababa @@ -754,45 +754,45 @@ test regexp-19.2 {regsub null replacement} { string equal $result $expected } 1 -test regexp-20.1 {regsub shared object shimmering} { +test regexp-20.1 {regsub shared object shimmering} -body { # Bug #461322 set a abcdefghijklmnopqurstuvwxyz set b $a set c abcdefghijklmnopqurstuvwxyz0123456789 regsub $a $c $b d list $d [string length $d] [string bytelength $d] -} [list abcdefghijklmnopqurstuvwxyz0123456789 37 37] -test regexp-20.2 {regsub shared object shimmering with -about} { +} -result [list abcdefghijklmnopqurstuvwxyz0123456789 37 37] +test regexp-20.2 {regsub shared object shimmering with -about} -body { eval regexp -about abc -} {0 {}} +} -result {0 {}} -test regexp-21.1 {regsub works with empty string} { +test regexp-21.1 {regsub works with empty string} -body { regsub -- ^ {} foo -} {foo} -test regexp-21.2 {regsub works with empty string} { +} -result {foo} +test regexp-21.2 {regsub works with empty string} -body { regsub -- \$ {} foo -} {foo} -test regexp-21.3 {regsub works with empty string offset} { +} -result {foo} +test regexp-21.3 {regsub works with empty string offset} -body { regsub -start 0 -- ^ {} foo -} {foo} -test regexp-21.4 {regsub works with empty string offset} { +} -result {foo} +test regexp-21.4 {regsub works with empty string offset} -body { regsub -start 0 -- \$ {} foo -} {foo} -test regexp-21.5 {regsub works with empty string offset} { +} -result {foo} +test regexp-21.5 {regsub works with empty string offset} -body { regsub -start 3 -- \$ {123} foo -} {123foo} -test regexp-21.6 {regexp works with empty string} { +} -result {123foo} +test regexp-21.6 {regexp works with empty string} -body { regexp -- ^ {} -} {1} -test regexp-21.7 {regexp works with empty string} { +} -result {1} +test regexp-21.7 {regexp works with empty string} -body { regexp -start 0 -- ^ {} -} {1} -test regexp-21.8 {regexp works with empty string offset} { +} -result {1} +test regexp-21.8 {regexp works with empty string offset} -body { regexp -start 3 -- ^ {123} -} {0} -test regexp-21.9 {regexp works with empty string offset} { +} -result {0} +test regexp-21.9 {regexp works with empty string offset} -body { regexp -start 3 -- \$ {123} -} {1} +} -result {1} test regexp-21.10 {multiple matches handle newlines} { regsub -all -lineanchor -- {^#[^\n]*\n} "#one\n#two\n#three\n" foo\n } "foo\nfoo\nfoo\n" @@ -1096,13 +1096,13 @@ test regexp-26.1 {matches start of line 1 time} { test regexp-26.2 {matches start of line(s) 2 times} { regexp -all -inline -line -- {^a+} "aab\naaa" } {aa aaa} -test regexp-26.3 {effect of -line -all and -start} { +test regexp-26.3 {effect of -line -all and -start} -body { list \ [regexp -all -inline -line -start 0 -- {^a+} "aab\naaa"] \ [regexp -all -inline -line -start 1 -- {^a+} "aab\naaa"] \ [regexp -all -inline -line -start 3 -- {^a+} "aab\naaa"] \ [regexp -all -inline -line -start 4 -- {^a+} "aab\naaa"] \ -} {{aa aaa} aaa aaa aaa} +} -result {{aa aaa} aaa aaa aaa} # No regexp-26.4 test regexp-26.5 {match length 0, match length 1} { regexp -all -inline -line -- {^b*} "a\nb" diff --git a/tests/regexpComp.test b/tests/regexpComp.test index fbf8012..8819dd2 100644 --- a/tests/regexpComp.test +++ b/tests/regexpComp.test @@ -665,54 +665,54 @@ test regexpComp-14.3 {CompileRegexp: regexp cache, empty regexp and empty cache} removeFile junk.tcl } -result 1 -test regexpComp-15.1 {regexp -start} { +test regexpComp-15.1 {regexp -start} -body { unset -nocomplain x list [regexp -start -10 {\d} 1abc2de3 x] $x -} {1 1} -test regexpComp-15.2 {regexp -start} { +} -result {1 1} +test regexpComp-15.2 {regexp -start} -body { unset -nocomplain x list [regexp -start 2 {\d} 1abc2de3 x] $x -} {1 2} -test regexpComp-15.3 {regexp -start} { +} -result {1 2} +test regexpComp-15.3 {regexp -start} -body { unset -nocomplain x list [regexp -start 4 {\d} 1abc2de3 x] $x -} {1 2} -test regexpComp-15.4 {regexp -start} { +} -result {1 2} +test regexpComp-15.4 {regexp -start} -body { unset -nocomplain x list [regexp -start 5 {\d} 1abc2de3 x] $x -} {1 3} -test regexpComp-15.5 {regexp -start, over end of string} { +} -result {1 3} +test regexpComp-15.5 {regexp -start, over end of string} -body { unset -nocomplain x list [regexp -start [string length 1abc2de3] {\d} 1abc2de3 x] [info exists x] -} {0 0} -test regexpComp-15.6 {regexp -start, loss of ^$ behavior} { +} -result {0 0} +test regexpComp-15.6 {regexp -start, loss of ^$ behavior} -body { list [regexp -start 2 {^$} {}] -} {0} +} -result {0} -test regexpComp-16.1 {regsub -start} { +test regexpComp-16.1 {regsub -start} -body { unset -nocomplain x list [regsub -all -start 2 {\d} a1b2c3d4e5 {/&} x] $x -} {4 a1b/2c/3d/4e/5} -test regexpComp-16.2 {regsub -start} { +} -result {4 a1b/2c/3d/4e/5} +test regexpComp-16.2 {regsub -start} -body { unset -nocomplain x list [regsub -all -start -25 {z} hello {/&} x] $x -} {0 hello} -test regexpComp-16.3 {regsub -start} { +} -result {0 hello} +test regexpComp-16.3 {regsub -start} -body { unset -nocomplain x list [regsub -all -start 3 {z} hello {/&} x] $x -} {0 hello} -test regexpComp-16.4 {regsub -start, \A behavior} { +} -result {0 hello} +test regexpComp-16.4 {regsub -start, \A behavior} -body { set out {} lappend out [regsub -start 0 -all {\A(\w)} {abcde} {/\1} x] $x lappend out [regsub -start 2 -all {\A(\w)} {abcde} {/\1} x] $x -} {5 /a/b/c/d/e 3 ab/c/d/e} +} -result {5 /a/b/c/d/e 3 ab/c/d/e} -test regexpComp-17.1 {regexp -inline} { +test regexpComp-17.1 {regexp -inline} -body { regexp -inline b ababa -} {b} -test regexpComp-17.2 {regexp -inline} { +} -result {b} +test regexpComp-17.2 {regexp -inline} -body { regexp -inline (b) ababa -} {b b} +} -result {b b} test regexpComp-17.3 {regexp -inline -indices} { regexp -inline -indices (b) ababa } {{1 1} {1 1}} diff --git a/tests/string.test b/tests/string.test index e15787a..7117d4d 100644 --- a/tests/string.test +++ b/tests/string.test @@ -398,44 +398,44 @@ test string-4.10.$noComp {string first, unicode} { test string-4.11.$noComp {string first, start index} { run {string first \u7266 abc\u7266x 3} } 3 -test string-4.12.$noComp {string first, start index} { +test string-4.12.$noComp {string first, start index} -body { run {string first \u7266 abc\u7266x 4} -} -1 -test string-4.13.$noComp {string first, start index} { +} -result -1 +test string-4.13.$noComp {string first, start index} -body { run {string first \u7266 abc\u7266x end-2} -} 3 -test string-4.14.$noComp {string first, negative start index} { +} -result 3 +test string-4.14.$noComp {string first, negative start index} -body { run {string first b abc -1} -} 1 -test string-4.15.$noComp {string first, ability to two-byte encoded utf-8 chars} { +} -result 1 +test string-4.15.$noComp {string first, ability to two-byte encoded utf-8 chars} -body { # Test for a bug in Tcl 8.3 where test for all-single-byte-encoded # strings was incorrect, leading to an index returned by [string first] # which pointed past the end of the string. set uchar \u057E ;# character with two-byte encoding in utf-8 run {string first % %#$uchar$uchar#$uchar$uchar#% 3} -} 8 -test string-4.16.$noComp {string first, normal string vs pure unicode string} { +} -result 8 +test string-4.16.$noComp {string first, normal string vs pure unicode string} -body { set s hello regexp ll $s m # Representation checks are canaries run {list [representationpoke $s] [representationpoke $m] \ [string first $m $s]} -} {{string 1} {string 0} 2} -test string-4.17.$noComp {string first, corner case} { +} -result {{string 1} {string 0} 2} +test string-4.17.$noComp {string first, corner case} -body { run {string first a aaa 4294967295} -} {-1} -test string-4.18.$noComp {string first, corner case} { +} -result {-1} +test string-4.18.$noComp {string first, corner case} -body { run {string first a aaa -1} -} {0} -test string-4.19.$noComp {string first, corner case} { +} -result {0} +test string-4.19.$noComp {string first, corner case} -body { run {string first a aaa end-5} -} {0} -test string-4.20.$noComp {string last, corner case} { +} -result {0} +test string-4.20.$noComp {string last, corner case} -body { run {string last a aaa 4294967295} -} {2} -test string-4.21.$noComp {string last, corner case} { +} -result {2} +test string-4.21.$noComp {string last, corner case} -body { run {string last a aaa -1} -} {-1} +} -result {-1} test string-4.22.$noComp {string last, corner case} { run {string last a aaa end-5} } {-1} @@ -473,9 +473,9 @@ test string-5.10.$noComp {string index, unicode} { test string-5.11.$noComp {string index, unicode} { run {string index abc\u7266d 3} } \u7266 -test string-5.12.$noComp {string index, unicode over char length, under byte length} { +test string-5.12.$noComp {string index, unicode over char length, under byte length} -body { run {string index \334\374\334\374 6} -} {} +} -result {} test string-5.13.$noComp {string index, bytearray object} { run {string index [binary format a5 fuz] 0} } f @@ -502,12 +502,12 @@ test string-5.18.$noComp {string index, bad integer} -body { test string-5.19.$noComp {string index, bytearray object out of bounds} { run {string index [binary format I* {0x50515253 0x52}] -1} } {} -test string-5.20.$noComp {string index, bytearray object out of bounds} { +test string-5.20.$noComp {string index, bytearray object out of bounds} -body { run {string index [binary format I* {0x50515253 0x52}] 20} -} {} -test string-5.21.$noComp {string index, surrogates, bug [11ae2be95dac9417]} tip389 { +} -result {} +test string-5.21.$noComp {string index, surrogates, bug [11ae2be95dac9417]} -constraints {tip389} -body { run {list [string index a\U100000b 1] [string index a\U100000b 2] [string index a\U100000b 3]} -} [list \U100000 {} b] +} -result [list \U100000 {} b] proc largest_int {} { @@ -1564,9 +1564,9 @@ test string-14.4.$noComp {string replace} { test string-14.5.$noComp {string replace} { run {string replace abcdefghijklmnop 2 14} } {abp} -test string-14.6.$noComp {string replace} { +test string-14.6.$noComp {string replace} -body { run {string replace abcdefghijklmnop 7 1000} -} {abcdefg} +} -result {abcdefg} test string-14.7.$noComp {string replace} { run {string replace abcdefghijklmnop 10 end} } {abcdefghij} @@ -1579,9 +1579,9 @@ test string-14.9.$noComp {string replace} { test string-14.10.$noComp {string replace} { run {string replace abcdefghijklmnop -3 -2} } {abcdefghijklmnop} -test string-14.11.$noComp {string replace} { +test string-14.11.$noComp {string replace} -body { run {string replace abcdefghijklmnop 1000 1010} -} {abcdefghijklmnop} +} -result {abcdefghijklmnop} test string-14.12.$noComp {string replace} { run {string replace abcdefghijklmnop -100 end} } {} @@ -1814,88 +1814,88 @@ test string-20.6.$noComp {string trimright, unicode default} { run {string trimright ABC\u1361\x85\x00\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u2028\u2029\u202F\u205F\u3000} } ABC\u1361 -test string-21.1.$noComp {string wordend} { +test string-21.1.$noComp {string wordend} -body { list [catch {run {string wordend a}} msg] $msg -} {1 {wrong # args: should be "string wordend string index"}} -test string-21.2.$noComp {string wordend} { +} -result {1 {wrong # args: should be "string wordend string index"}} +test string-21.2.$noComp {string wordend} -body { list [catch {run {string wordend a b c}} msg] $msg -} {1 {wrong # args: should be "string wordend string index"}} -test string-21.3.$noComp {string wordend} { +} -result {1 {wrong # args: should be "string wordend string index"}} +test string-21.3.$noComp {string wordend} -body { list [catch {run {string wordend a gorp}} msg] $msg -} {1 {bad index "gorp": must be integer?[+-]integer? or end?[+-]integer?}} -test string-21.4.$noComp {string wordend} { +} -result {1 {bad index "gorp": must be integer?[+-]integer? or end?[+-]integer?}} +test string-21.4.$noComp {string wordend} -body { run {string wordend abc. -1} -} 3 -test string-21.5.$noComp {string wordend} { +} -result 3 +test string-21.5.$noComp {string wordend} -body { run {string wordend abc. 100} -} 4 -test string-21.6.$noComp {string wordend} { +} -result 4 +test string-21.6.$noComp {string wordend} -body { run {string wordend "word_one two three" 2} -} 8 -test string-21.7.$noComp {string wordend} { +} -result 8 +test string-21.7.$noComp {string wordend} -body { run {string wordend "one .&# three" 5} -} 6 -test string-21.8.$noComp {string wordend} { +} -result 6 +test string-21.8.$noComp {string wordend} -body { run {string worde "x.y" 0} -} 1 -test string-21.9.$noComp {string wordend} { +} -result 1 +test string-21.9.$noComp {string wordend} -body { run {string worde "x.y" end-1} -} 2 -test string-21.10.$noComp {string wordend, unicode} { +} -result 2 +test string-21.10.$noComp {string wordend, unicode} -body { run {string wordend "xyz\xC7de fg" 0} -} 6 -test string-21.11.$noComp {string wordend, unicode} { +} -result 6 +test string-21.11.$noComp {string wordend, unicode} -body { run {string wordend "xyz\uC700de fg" 0} -} 6 -test string-21.12.$noComp {string wordend, unicode} { +} -result 6 +test string-21.12.$noComp {string wordend, unicode} -body { run {string wordend "xyz\u203Fde fg" 0} -} 6 -test string-21.13.$noComp {string wordend, unicode} { +} -result 6 +test string-21.13.$noComp {string wordend, unicode} -body { run {string wordend "xyz\u2045de fg" 0} -} 3 -test string-21.14.$noComp {string wordend, unicode} { +} -result 3 +test string-21.14.$noComp {string wordend, unicode} -body { run {string wordend "\uC700\uC700 abc" 8} -} 6 +} -result 6 -test string-22.1.$noComp {string wordstart} { +test string-22.1.$noComp {string wordstart} -body { list [catch {run {string word a}} msg] $msg -} {1 {unknown or ambiguous subcommand "word": must be bytelength, cat, compare, equal, first, index, insert, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart}} -test string-22.2.$noComp {string wordstart} { +} -result {1 {unknown or ambiguous subcommand "word": must be bytelength, cat, compare, equal, first, index, insert, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart}} +test string-22.2.$noComp {string wordstart} -body { list [catch {run {string wordstart a}} msg] $msg -} {1 {wrong # args: should be "string wordstart string index"}} -test string-22.3.$noComp {string wordstart} { +} -result {1 {wrong # args: should be "string wordstart string index"}} +test string-22.3.$noComp {string wordstart} -body { list [catch {run {string wordstart a b c}} msg] $msg -} {1 {wrong # args: should be "string wordstart string index"}} -test string-22.4.$noComp {string wordstart} { +} -result {1 {wrong # args: should be "string wordstart string index"}} +test string-22.4.$noComp {string wordstart} -body { list [catch {run {string wordstart a gorp}} msg] $msg -} {1 {bad index "gorp": must be integer?[+-]integer? or end?[+-]integer?}} -test string-22.5.$noComp {string wordstart} { +} -result {1 {bad index "gorp": must be integer?[+-]integer? or end?[+-]integer?}} +test string-22.5.$noComp {string wordstart} -body { run {string wordstart "one two three_words" 400} -} 8 -test string-22.6.$noComp {string wordstart} { +} -result 8 +test string-22.6.$noComp {string wordstart} -body { run {string wordstart "one two three_words" 2} -} 0 -test string-22.7.$noComp {string wordstart} { +} -result 0 +test string-22.7.$noComp {string wordstart} -body { run {string wordstart "one two three_words" -2} -} 0 -test string-22.8.$noComp {string wordstart} { +} -result 0 +test string-22.8.$noComp {string wordstart} -body { run {string wordstart "one .*&^ three" 6} -} 6 -test string-22.9.$noComp {string wordstart} { +} -result 6 +test string-22.9.$noComp {string wordstart} -body { run {string wordstart "one two three" 4} -} 4 -test string-22.10.$noComp {string wordstart} { +} -result 4 +test string-22.10.$noComp {string wordstart} -body { run {string wordstart "one two three" end-5} -} 7 -test string-22.11.$noComp {string wordstart, unicode} { +} -result 7 +test string-22.11.$noComp {string wordstart, unicode} -body { run {string wordstart "one tw\xC7o three" 7} -} 4 -test string-22.12.$noComp {string wordstart, unicode} { +} -result 4 +test string-22.12.$noComp {string wordstart, unicode} -body { run {string wordstart "ab\uC700\uC700 cdef ghi" 12} -} 10 -test string-22.13.$noComp {string wordstart, unicode} { +} -result 10 +test string-22.13.$noComp {string wordstart, unicode} -body { run {string wordstart "\uC700\uC700 abc" 8} -} 3 +} -result 3 test string-23.0.$noComp {string is boolean, Bug 1187123} testindexobj { set x 5 diff --git a/tests/util.test b/tests/util.test index 053eb0c..35bb12d 100644 --- a/tests/util.test +++ b/tests/util.test @@ -732,16 +732,16 @@ test util-9.43 {Tcl_GetIntForIndex} -body { test util-9.44 {Tcl_GetIntForIndex} -body { string index a 0+1000000000000 } -result {} -test util-9.45 {Tcl_GetIntForIndex} { +test util-9.45 {Tcl_GetIntForIndex} -body { string index abcd end+2305843009213693950 -} {} -test util-9.46 {Tcl_GetIntForIndex} { +} -result {} +test util-9.46 {Tcl_GetIntForIndex} -body { string index abcd end+4294967294 -} {} +} -result {} # TIP 502 -test util-9.47 {Tcl_GetIntForIndex} { +test util-9.47 {Tcl_GetIntForIndex} -body { string index abcd 0x10000000000000000 -} {} +} -result {} test util-9.48 {Tcl_GetIntForIndex} { string index abcd -0x10000000000000000 } {} @@ -763,18 +763,18 @@ test util-9.53 {Tcl_GetIntForIndex} -body { test util-9.54 {Tcl_GetIntForIndex} { string index abcd end-0x10000000000000000 } {} -test util-9.55 {Tcl_GetIntForIndex} { +test util-9.55 {Tcl_GetIntForIndex} -body { string index abcd end+0x10000000000000000 -} {} -test util-9.56 {Tcl_GetIntForIndex} { +} -result {} +test util-9.56 {Tcl_GetIntForIndex} -body { string index abcd end--0x10000000000000000 -} {} +} -result {} test util-9.57 {Tcl_GetIntForIndex} { string index abcd end+-0x10000000000000000 } {} -test util-9.58 {Tcl_GetIntForIndex} { +test util-9.58 {Tcl_GetIntForIndex} -body { string index abcd end--0x8000000000000000 -} {} +} -result {} test util-10.1 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} { convertDouble 0x0000000000000000 -- cgit v0.12 From bb05d544ee15b5aeda1e4dce5bcbea977e0f0aa2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 14 Mar 2020 22:06:08 +0000 Subject: Fix one wrong type-cast (only causing warning, nothing serious) --- generic/tclEnv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclEnv.c b/generic/tclEnv.c index cdae21d..2f99c49 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -511,7 +511,7 @@ TclUnsetEnv( #endif /* HAVE_PUTENV_THAT_COPIES */ } #else /* !USE_PUTENV_FOR_UNSET */ - for (envPtr = (char *)(tenviron+index+1); ; envPtr++) { + for (envPtr = (char **)(tenviron+index+1); ; envPtr++) { envPtr[-1] = *envPtr; if (*envPtr == NULL) { break; -- cgit v0.12 From 13be49f5852a9f3bb1a82aa726f16322d00d38e7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 15 Mar 2020 12:03:21 +0000 Subject: Make ourEnviron type (techar **) not (char **), so we need less type-casts. --- generic/tclEnv.c | 64 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 2f99c49..e7cb962 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -17,23 +17,6 @@ TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */ -static struct { - int cacheSize; /* Number of env strings in cache. */ - char **cache; /* Array containing all of the environment - * strings that Tcl has allocated. */ -#ifndef USE_PUTENV - char **ourEnviron; /* Cache of the array that we allocate. We - * need to track this in case another - * subsystem swaps around the environ array - * like we do. */ - int ourEnvironSize; /* Non-zero means that the environ array was - * malloced and has this many total entries - * allocated to it (not all may be in use at - * once). Zero means that the environment - * array is in its original static state. */ -#endif -} env; - #if defined(_WIN32) # define tenviron _wenviron # define tenviron2utfdstr(tenvstr, len, dstr) \ @@ -53,6 +36,23 @@ static struct { # define techar char #endif +static struct { + int cacheSize; /* Number of env strings in cache. */ + char **cache; /* Array containing all of the environment + * strings that Tcl has allocated. */ +#ifndef USE_PUTENV + techar **ourEnviron; /* Cache of the array that we allocate. We + * need to track this in case another + * subsystem swaps around the environ array + * like we do. */ + int ourEnvironSize; /* Non-zero means that the environ array was + * malloced and has this many total entries + * allocated to it (not all may be in use at + * once). Zero means that the environment + * array is in its original static state. */ +#endif +} env; + #define tNTL sizeof(techar) /* @@ -144,7 +144,7 @@ TclSetupEnv( char *p2; p1 = tenviron2utfdstr(tenviron[i], -1, &envString); - p2 = strchr(p1, '='); + p2 = (char *)strchr(p1, '='); if (p2 == NULL) { /* * This condition seem to happen occasionally under some @@ -193,7 +193,7 @@ TclSetupEnv( for (hPtr=Tcl_FirstHashEntry(&namesHash, &search); hPtr!=NULL; hPtr=Tcl_NextHashEntry(&search)) { - Tcl_Obj *elemName = Tcl_GetHashValue(hPtr); + Tcl_Obj *elemName = (Tcl_Obj *)Tcl_GetHashValue(hPtr); TclObjUnsetVar2(interp, varNamePtr, elemName, TCL_GLOBAL_ONLY); } @@ -259,14 +259,14 @@ TclSetEnv( * environment is the one we allocated. [Bug 979640] */ - if ((env.ourEnviron != (char *)tenviron) || (length+2 > env.ourEnvironSize)) { - char **newEnviron = ckalloc((length + 5) * sizeof(char *)); + if ((env.ourEnviron != tenviron) || (length+2 > env.ourEnvironSize)) { + techar **newEnviron = (techar **)ckalloc((length + 5) * sizeof(techar *)); - memcpy(newEnviron, tenviron, length * sizeof(char *)); + memcpy(newEnviron, tenviron, length * sizeof(techar *)); if ((env.ourEnvironSize != 0) && (env.ourEnviron != NULL)) { ckfree(env.ourEnviron); } - tenviron = (techar **)(env.ourEnviron = newEnviron); + tenviron = (env.ourEnviron = newEnviron); env.ourEnvironSize = length + 5; } index = length; @@ -294,7 +294,7 @@ TclSetEnv( Tcl_DStringFree(&envString); oldValue = (char *)tenviron[index]; - nameLength = (unsigned) length; + nameLength = length; } /* @@ -304,7 +304,7 @@ TclSetEnv( */ valueLength = strlen(value); - p = ckalloc(nameLength + valueLength + 2); + p = (char *)ckalloc(nameLength + valueLength + 2); memcpy(p, name, nameLength); p[nameLength] = '='; memcpy(p+nameLength+1, value, valueLength+1); @@ -314,7 +314,7 @@ TclSetEnv( * Copy the native string to heap memory. */ - p = ckrealloc(p, Tcl_DStringLength(&envString) + tNTL); + p = (char *)ckrealloc(p, Tcl_DStringLength(&envString) + tNTL); memcpy(p, p2, Tcl_DStringLength(&envString) + tNTL); Tcl_DStringFree(&envString); @@ -400,7 +400,7 @@ Tcl_PutEnv( */ name = Tcl_ExternalToUtfDString(NULL, assignment, -1, &nameString); - value = strchr(name, '='); + value = (char *)strchr(name, '='); if ((value != NULL) && (value != name)) { value[0] = '\0'; @@ -475,20 +475,20 @@ TclUnsetEnv( */ #if defined(_WIN32) - string = ckalloc(length + 2); + string = (char *)ckalloc(length + 2); memcpy(string, name, length); string[length] = '='; string[length+1] = '\0'; #else - string = ckalloc(length + 1); + string = (char *)ckalloc(length + 1); memcpy(string, name, length); string[length] = '\0'; #endif /* _WIN32 */ utf2tenvirondstr(string, -1, &envString); - string = ckrealloc(string, Tcl_DStringLength(&envString) + tNTL); + string = (char *)ckrealloc(string, Tcl_DStringLength(&envString) + tNTL); memcpy(string, Tcl_DStringValue(&envString), - (unsigned) Tcl_DStringLength(&envString) + tNTL); + Tcl_DStringLength(&envString) + tNTL); Tcl_DStringFree(&envString); putenv(string); @@ -722,7 +722,7 @@ ReplaceString( const int growth = 5; - env.cache = ckrealloc(env.cache, + env.cache = (char **)ckrealloc(env.cache, (env.cacheSize + growth) * sizeof(char *)); env.cache[env.cacheSize] = newStr; (void) memset(env.cache+env.cacheSize+1, 0, -- cgit v0.12 From 07cfb2190f1ec3f06fb59425ad6fc3b5edd5dcff Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 15 Mar 2020 22:21:27 +0000 Subject: Add one more reserved stub entry, most likely will be Tcl_GetBytesFromObj() in Tcl 8.7. --- generic/tcl.decls | 6 +++--- generic/tclDecls.h | 9 ++++++--- generic/tclStubInit.c | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index f37c0f6..7b153f1 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2323,12 +2323,12 @@ declare 630 { Tcl_Obj *compressionDictionaryObj) } -declare 648 { +# ----- BASELINE -- FOR -- 8.6.0 ----- # + +declare 649 { void TclUnusedStubEntry(void) } -# ----- BASELINE -- FOR -- 8.6.0 ----- # - ############################################################################## # Define the platform specific public Tcl interface. These functions are only diff --git a/generic/tclDecls.h b/generic/tclDecls.h index a49121a..037b6e5 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1833,7 +1833,8 @@ EXTERN void Tcl_ZlibStreamSetCompressionDictionary( /* Slot 645 is reserved */ /* Slot 646 is reserved */ /* Slot 647 is reserved */ -/* 648 */ +/* Slot 648 is reserved */ +/* 649 */ EXTERN void TclUnusedStubEntry(void); typedef struct { @@ -2518,7 +2519,8 @@ typedef struct TclStubs { void (*reserved645)(void); void (*reserved646)(void); void (*reserved647)(void); - void (*tclUnusedStubEntry) (void); /* 648 */ + void (*reserved648)(void); + void (*tclUnusedStubEntry) (void); /* 649 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -3828,8 +3830,9 @@ extern const TclStubs *tclStubsPtr; /* Slot 645 is reserved */ /* Slot 646 is reserved */ /* Slot 647 is reserved */ +/* Slot 648 is reserved */ #define TclUnusedStubEntry \ - (tclStubsPtr->tclUnusedStubEntry) /* 648 */ + (tclStubsPtr->tclUnusedStubEntry) /* 649 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index a5de5f4..304b7d2 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -1630,7 +1630,8 @@ const TclStubs tclStubs = { 0, /* 645 */ 0, /* 646 */ 0, /* 647 */ - TclUnusedStubEntry, /* 648 */ + 0, /* 648 */ + TclUnusedStubEntry, /* 649 */ }; /* !END!: Do not edit above this line. */ -- cgit v0.12 From dc763386a9f92c39f6573be75aff10c6528003ef Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 17 Mar 2020 01:01:25 +0000 Subject: TIP 569 - remove lint comments --- generic/regcomp.c | 2 +- generic/regerror.c | 1 - generic/tclBasic.c | 3 --- generic/tclCkalloc.c | 2 -- generic/tclCmdAH.c | 16 +--------------- generic/tclCmdMZ.c | 1 - generic/tclEncoding.c | 4 ++-- generic/tclEnv.c | 1 - generic/tclEvent.c | 3 --- generic/tclFileName.c | 6 ++---- generic/tclHash.c | 2 -- generic/tclIO.c | 4 ---- generic/tclIOCmd.c | 14 -------------- generic/tclIOGT.c | 2 -- generic/tclIOUtil.c | 2 +- generic/tclInterp.c | 4 +--- generic/tclMain.c | 1 - generic/tclNamesp.c | 1 - generic/tclPanic.c | 2 -- generic/tclPkg.c | 1 - generic/tclPreserve.c | 1 - generic/tclProc.c | 2 -- generic/tclScan.c | 1 - generic/tclTest.c | 26 +------------------------- generic/tclThreadAlloc.c | 2 +- generic/tclThreadTest.c | 5 ----- generic/tclTimer.c | 2 -- generic/tclTrace.c | 3 --- generic/tclUtil.c | 3 +-- generic/tclVar.c | 19 ------------------- unix/tclUnixChan.c | 1 - unix/tclUnixFCmd.c | 4 ++-- unix/tclUnixPipe.c | 3 --- unix/tclUnixSock.c | 5 ----- win/tclWinFCmd.c | 2 +- win/tclWinPipe.c | 1 - win/tclWinSock.c | 7 ------- win/tclWinTest.c | 1 - win/tclWinTime.c | 1 - 39 files changed, 14 insertions(+), 147 deletions(-) diff --git a/generic/regcomp.c b/generic/regcomp.c index 79e6536..99dfef1 100644 --- a/generic/regcomp.c +++ b/generic/regcomp.c @@ -808,7 +808,7 @@ parseqatom( atom = NULL; assert(lp->nouts == 0); /* must string new code */ assert(rp->nins == 0); /* between lp and rp */ - subno = 0; /* just to shut lint up */ + subno = 0; /* * An atom or constraint... diff --git a/generic/regerror.c b/generic/regerror.c index f783217..500dfe2 100644 --- a/generic/regerror.c +++ b/generic/regerror.c @@ -54,7 +54,6 @@ static const struct rerr { /* - regerror - the interface to error numbers */ -/* ARGSUSED */ size_t /* Actual space needed (including NUL) */ regerror( int code, /* Error code, or REG_ATOI or REG_ITOA */ diff --git a/generic/tclBasic.c b/generic/tclBasic.c index f7f4f19..8597370 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -653,7 +653,6 @@ Tcl_CreateInterp(void) */ if (sizeof(Tcl_CallFrame) < sizeof(CallFrame)) { - /*NOTREACHED*/ Tcl_Panic("Tcl_CallFrame must not be smaller than CallFrame"); } @@ -666,7 +665,6 @@ Tcl_CreateInterp(void) */ if ((offsetof(Tcl_StatBuf,st_atime) != 32) || (offsetof(Tcl_StatBuf,st_ctime) != 40)) { - /*NOTREACHED*/ Tcl_Panic(" is not compatible with MSVC"); } #endif @@ -7339,7 +7337,6 @@ Tcl_VarEvalVA( * *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_VarEval( Tcl_Interp *interp, diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 0092c83..6fd2f40 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -808,7 +808,6 @@ Tcl_AttemptRealloc( * *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int MemoryCmd( ClientData clientData, @@ -1219,7 +1218,6 @@ Tcl_DbCkfree( * *---------------------------------------------------------------------- */ - /* ARGSUSED */ void Tcl_InitMemory( TCL_UNUSED(Tcl_Interp *) /*interp*/) diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index bd65f04..ffe0088 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -117,7 +117,6 @@ static Tcl_ObjCmdProc PathTypeCmd; *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_BreakObjCmd( TCL_UNUSED(ClientData), @@ -150,7 +149,6 @@ Tcl_BreakObjCmd( *---------------------------------------------------------------------- */ #if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - /* ARGSUSED */ int Tcl_CaseObjCmd( TCL_UNUSED(ClientData), @@ -286,7 +284,6 @@ Tcl_CaseObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_CatchObjCmd( ClientData clientData, @@ -392,7 +389,6 @@ CatchObjCmdCallback( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_CdObjCmd( TCL_UNUSED(ClientData), @@ -448,7 +444,6 @@ Tcl_CdObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_ConcatObjCmd( TCL_UNUSED(ClientData), @@ -483,7 +478,6 @@ Tcl_ConcatObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_ContinueObjCmd( TCL_UNUSED(ClientData), @@ -782,7 +776,6 @@ EncodingSystemObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_ErrorObjCmd( TCL_UNUSED(ClientData), @@ -832,7 +825,6 @@ Tcl_ErrorObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int EvalCmdErrMsg( TCL_UNUSED(ClientData *), @@ -915,7 +907,6 @@ TclNREvalObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_ExitObjCmd( TCL_UNUSED(ClientData), @@ -936,7 +927,6 @@ Tcl_ExitObjCmd( return TCL_ERROR; } Tcl_Exit((int)value); - /*NOTREACHED*/ return TCL_OK; /* Better not ever reach this! */ } @@ -964,7 +954,6 @@ Tcl_ExitObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_ExprObjCmd( ClientData clientData, @@ -2073,7 +2062,7 @@ FilesystemSeparatorCmd( return TCL_ERROR; } if (objc == 1) { - const char *separator = NULL; /* lint */ + const char *separator = NULL; switch (tclPlatform) { case TCL_PLATFORM_UNIX: @@ -2376,7 +2365,6 @@ GetTypeFromMode( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_ForObjCmd( ClientData clientData, @@ -2571,7 +2559,6 @@ ForPostNextCallback( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_ForeachObjCmd( ClientData clientData, @@ -2889,7 +2876,6 @@ ForeachCleanup( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_FormatObjCmd( TCL_UNUSED(ClientData), diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 2f5d399..645b852 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -3990,7 +3990,6 @@ SwitchPostProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_ThrowObjCmd( TCL_UNUSED(ClientData), diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index b02be21..4b99f27 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -3211,8 +3211,8 @@ EscapeToUtfProc( charLimit = *dstCharsPtr; } result = TCL_OK; - tablePrefixBytes = NULL; /* lint. */ - tableToUnicode = NULL; /* lint. */ + tablePrefixBytes = NULL; + tableToUnicode = NULL; prefixBytes = dataPtr->prefixBytes; encodingPtr = NULL; diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 143dab9..f5c5c5d 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -597,7 +597,6 @@ TclGetEnv( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static char * EnvTraceProc( TCL_UNUSED(ClientData), diff --git a/generic/tclEvent.c b/generic/tclEvent.c index d9f868c..db1f59a 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1396,7 +1396,6 @@ TclInThreadExit(void) *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_VwaitObjCmd( TCL_UNUSED(ClientData), @@ -1460,7 +1459,6 @@ Tcl_VwaitObjCmd( return TCL_OK; } - /* ARGSUSED */ static char * VwaitVarProc( void *clientData, /* Pointer to integer to set to 1. */ @@ -1494,7 +1492,6 @@ VwaitVarProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_UpdateObjCmd( TCL_UNUSED(ClientData), diff --git a/generic/tclFileName.c b/generic/tclFileName.c index a069ff1..32b217f 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -1217,7 +1217,6 @@ DoTildeSubst( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_GlobObjCmd( TCL_UNUSED(ClientData), @@ -1344,7 +1343,7 @@ Tcl_GlobObjCmd( return TCL_ERROR; } - separators = NULL; /* lint. */ + separators = NULL; switch (tclPlatform) { case TCL_PLATFORM_UNIX: separators = "/"; @@ -1704,7 +1703,6 @@ Tcl_GlobObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int TclGlob( Tcl_Interp *interp, /* Interpreter for returning error message or @@ -1723,7 +1721,7 @@ TclGlob( int result; Tcl_Obj *filenamesObj, *savedResultObj; - separators = NULL; /* lint. */ + separators = NULL; switch (tclPlatform) { case TCL_PLATFORM_UNIX: separators = "/"; diff --git a/generic/tclHash.c b/generic/tclHash.c index e48c816..584b5e1 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -927,7 +927,6 @@ HashStringKey( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static Tcl_HashEntry * BogusFind( TCL_UNUSED(Tcl_HashTable *), @@ -954,7 +953,6 @@ BogusFind( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static Tcl_HashEntry * BogusCreate( TCL_UNUSED(Tcl_HashTable *), diff --git a/generic/tclIO.c b/generic/tclIO.c index edb0f1e..d65f6e6 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -579,7 +579,6 @@ TclInitIOSubsystem(void) *------------------------------------------------------------------------- */ - /* ARGSUSED */ void TclFinalizeIOSubsystem(void) { @@ -3378,7 +3377,6 @@ Tcl_SpliceChannel( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_Close( Tcl_Interp *interp, /* Interpreter for errors. */ @@ -3582,7 +3580,6 @@ Tcl_Close( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_CloseEx( Tcl_Interp *interp, /* Interpreter for errors. */ @@ -8988,7 +8985,6 @@ TclChannelEventScriptInvoker( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_FileEventObjCmd( TCL_UNUSED(ClientData), diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 916936b..508a991 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -95,7 +95,6 @@ FinalizeIOCmdTSD( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_PutsObjCmd( TCL_UNUSED(ClientData), @@ -222,7 +221,6 @@ Tcl_PutsObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_FlushObjCmd( TCL_UNUSED(ClientData), @@ -287,7 +285,6 @@ Tcl_FlushObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_GetsObjCmd( TCL_UNUSED(ClientData), @@ -372,7 +369,6 @@ Tcl_GetsObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_ReadObjCmd( TCL_UNUSED(ClientData), @@ -516,7 +512,6 @@ Tcl_ReadObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_SeekObjCmd( TCL_UNUSED(ClientData), @@ -592,7 +587,6 @@ Tcl_SeekObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_TellObjCmd( TCL_UNUSED(ClientData), @@ -655,7 +649,6 @@ Tcl_TellObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_CloseObjCmd( TCL_UNUSED(ClientData), @@ -764,7 +757,6 @@ Tcl_CloseObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_FconfigureObjCmd( TCL_UNUSED(ClientData), @@ -840,7 +832,6 @@ Tcl_FconfigureObjCmd( *--------------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_EofObjCmd( TCL_UNUSED(ClientData), @@ -880,7 +871,6 @@ Tcl_EofObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_ExecObjCmd( TCL_UNUSED(ClientData), @@ -1048,7 +1038,6 @@ Tcl_ExecObjCmd( *--------------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_FblockedObjCmd( TCL_UNUSED(ClientData), @@ -1095,7 +1084,6 @@ Tcl_FblockedObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_OpenObjCmd( TCL_UNUSED(ClientData), @@ -1219,7 +1207,6 @@ Tcl_OpenObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void TcpAcceptCallbacksDeleteProc( ClientData clientData, /* Data which was passed when the assocdata @@ -1809,7 +1796,6 @@ Tcl_FcopyObjCmd( *--------------------------------------------------------------------------- */ - /* ARGSUSED */ static int ChanPendingObjCmd( TCL_UNUSED(ClientData), diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 3d0782c..353998f 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -257,7 +257,6 @@ ReleaseData( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int TclChannelTransform( Tcl_Interp *interp, /* Interpreter for result. */ @@ -1096,7 +1095,6 @@ TransformGetOptionProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void TransformWatchProc( ClientData instanceData, /* Channel to watch. */ diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 4a79962..db533d7 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -4680,7 +4680,7 @@ static Tcl_Obj * NativeFilesystemSeparator( TCL_UNUSED(Tcl_Obj *) /*pathPtr*/) { - const char *separator = NULL; /* lint */ + const char *separator = NULL; switch (tclPlatform) { case TCL_PLATFORM_UNIX: diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 5b0cd62..1570837 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -598,7 +598,7 @@ InterpInfoDeleteProc( * *---------------------------------------------------------------------- */ - /* ARGSUSED */ + int Tcl_InterpObjCmd( ClientData clientData, @@ -1474,8 +1474,6 @@ TclPreventAliasLoop( } nextAliasPtr = (Alias *)aliasCmdPtr->objClientData; } - - /* NOTREACHED */ } /* diff --git a/generic/tclMain.c b/generic/tclMain.c index faa0d31..4f44685 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -731,7 +731,6 @@ TclFullFinalizationRequested(void) *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void StdinProc( ClientData clientData, /* The state of interactive cmd line */ diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index c39c48b..26dca62 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -315,7 +315,6 @@ Tcl_PushCallFrame( if (nsPtr->flags & NS_DEAD) { Tcl_Panic("Trying to push call frame for dead namespace"); - /*NOTREACHED*/ } } diff --git a/generic/tclPanic.c b/generic/tclPanic.c index a3fc47d..da5c134 100644 --- a/generic/tclPanic.c +++ b/generic/tclPanic.c @@ -142,8 +142,6 @@ Tcl_PanicVA( *---------------------------------------------------------------------- */ -/* ARGSUSED */ - /* * The following comment is here so that Coverity's static analizer knows that * a Tcl_Panic() call can never return and avoids lots of false positives. diff --git a/generic/tclPkg.c b/generic/tclPkg.c index bb3795b..b39224e 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -1060,7 +1060,6 @@ Tcl_PackageObjCmd( return Tcl_NRCallObjProc(interp, TclNRPackageObjCmd, clientData, objc, objv); } - /* ARGSUSED */ int TclNRPackageObjCmd( TCL_UNUSED(ClientData), diff --git a/generic/tclPreserve.c b/generic/tclPreserve.c index 6930225..d60ebec 100644 --- a/generic/tclPreserve.c +++ b/generic/tclPreserve.c @@ -83,7 +83,6 @@ typedef struct HandleStruct { *---------------------------------------------------------------------- */ - /* ARGSUSED */ void TclFinalizePreserve(void) { diff --git a/generic/tclProc.c b/generic/tclProc.c index 9951249..5a1b589 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -148,7 +148,6 @@ static const Tcl_ObjType lambdaType = { *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_ProcObjCmd( TCL_UNUSED(ClientData), @@ -884,7 +883,6 @@ Uplevel_Callback( return result; } - /* ARGSUSED */ int Tcl_UplevelObjCmd( ClientData clientData, diff --git a/generic/tclScan.c b/generic/tclScan.c index 5aa6a10..354f3d6b 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -562,7 +562,6 @@ ValidateFormat( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_ScanObjCmd( TCL_UNUSED(ClientData), diff --git a/generic/tclTest.c b/generic/tclTest.c index 2a54dcf..403e6d6 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -717,7 +717,6 @@ Tcltest_SafeInit( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestasyncCmd( TCL_UNUSED(ClientData), @@ -963,7 +962,6 @@ TestbumpinterpepochObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestcmdinfoCmd( TCL_UNUSED(ClientData), @@ -1034,7 +1032,6 @@ TestcmdinfoCmd( return TCL_OK; } - /*ARGSUSED*/ static int CmdProc1( void *clientData, /* String to return. */ @@ -1046,7 +1043,6 @@ CmdProc1( return TCL_OK; } - /*ARGSUSED*/ static int CmdProc2( void *clientData, /* String to return. */ @@ -1093,7 +1089,6 @@ CmdDelProc2( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestcmdtokenCmd( TCL_UNUSED(ClientData), @@ -1157,7 +1152,6 @@ TestcmdtokenCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestcmdtraceCmd( TCL_UNUSED(ClientData), @@ -1440,7 +1434,6 @@ CreatedCommandProc2( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestdcallCmd( TCL_UNUSED(ClientData), @@ -1505,7 +1498,6 @@ DelCallbackProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestdelCmd( TCL_UNUSED(ClientData), @@ -1705,7 +1697,6 @@ TestdoubledigitsObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestdstringCmd( TCL_UNUSED(ClientData), @@ -1832,7 +1823,6 @@ static void SpecialFree( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestencodingObjCmd( TCL_UNUSED(ClientData), @@ -2690,7 +2680,6 @@ TestgetplatformCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestinterpdeleteCmd( TCL_UNUSED(ClientData), @@ -2731,7 +2720,6 @@ TestinterpdeleteCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestlinkCmd( TCL_UNUSED(ClientData), @@ -3378,7 +3366,7 @@ TestlocaleCmd( * *---------------------------------------------------------------------- */ - /* ARGSUSED */ + static void CleanupTestSetassocdataTests( void *clientData, /* Data to be released. */ @@ -3782,7 +3770,6 @@ TestprintObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestregexpObjCmd( TCL_UNUSED(ClientData), @@ -4106,7 +4093,6 @@ TestregexpXflags( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestreturnObjCmd( TCL_UNUSED(ClientData), @@ -4327,7 +4313,6 @@ TesttranslatefilenameCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestupvarCmd( TCL_UNUSED(ClientData), @@ -4380,7 +4365,6 @@ TestupvarCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestseterrorcodeCmd( TCL_UNUSED(ClientData), @@ -4433,7 +4417,6 @@ TestseterrorcodeCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestsetobjerrorcodeCmd( TCL_UNUSED(ClientData), @@ -4462,7 +4445,6 @@ TestsetobjerrorcodeCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestfeventCmd( TCL_UNUSED(ClientData), @@ -5112,7 +5094,6 @@ TestbytestringObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestsetCmd( void *data, /* Additional flags for Get/SetVar2. */ @@ -5195,7 +5176,6 @@ Testset2Cmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestsaveresultCmd( TCL_UNUSED(ClientData), @@ -5445,7 +5425,6 @@ TestexitmainloopCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestChannelCmd( TCL_UNUSED(ClientData), @@ -5507,7 +5486,6 @@ TestChannelCmd( chanPtr = statePtr->topChanPtr; chan = (Tcl_Channel) chanPtr; } else { - /* lint */ statePtr = NULL; chan = NULL; } @@ -5914,7 +5892,6 @@ TestChannelCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestChannelEventCmd( TCL_UNUSED(ClientData), @@ -6127,7 +6104,6 @@ TestChannelEventCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestSocketCmd( TCL_UNUSED(ClientData), diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index 1aa2be1..db9d65e 100644 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -1015,7 +1015,7 @@ GetBlocks( blockPtr = NULL; n = NBUCKETS; - size = 0; /* lint */ + size = 0; while (--n > bucket) { if (cachePtr->buckets[n].numFree > 0) { size = bucketInfo[n].blockSize; diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index 961a56a..b1b64f4 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -203,7 +203,6 @@ TclThread_Init( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ThreadObjCmd( TCL_UNUSED(ClientData), @@ -491,7 +490,6 @@ ThreadObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ThreadCreate( Tcl_Interp *interp, /* Current interpreter. */ @@ -1078,7 +1076,6 @@ ThreadEventProc( *------------------------------------------------------------------------ */ - /* ARGSUSED */ static void ThreadFreeProc( void *clientData) @@ -1105,7 +1102,6 @@ ThreadFreeProc( *------------------------------------------------------------------------ */ - /* ARGSUSED */ static int ThreadDeleteEvent( Tcl_Event *eventPtr, /* Really ThreadEvent */ @@ -1141,7 +1137,6 @@ ThreadDeleteEvent( *------------------------------------------------------------------------ */ - /* ARGSUSED */ static void ThreadExitProc( void *clientData) diff --git a/generic/tclTimer.c b/generic/tclTimer.c index db2c7d5..05a80b0 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.c @@ -776,7 +776,6 @@ TclServiceIdle(void) *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_AfterObjCmd( TCL_UNUSED(ClientData), @@ -1248,7 +1247,6 @@ FreeAfterPtr( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void AfterCleanupProc( ClientData clientData, /* Points to AfterAssocData for the diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 5d69a49..e05fa69 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -181,7 +181,6 @@ typedef struct { *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_TraceObjCmd( TCL_UNUSED(ClientData), @@ -1277,7 +1276,6 @@ Tcl_UntraceCommand( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void TraceCommandProc( ClientData clientData, /* Information about the command trace. */ @@ -1961,7 +1959,6 @@ TraceExecutionProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static char * TraceVarProc( ClientData clientData, /* Information about the variable trace. */ diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 7a05d95..6a6f6ae 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -581,7 +581,7 @@ FindElement( const char *limit; /* Points just after list/dict's last byte. */ int openBraces = 0; /* Brace nesting level during parse. */ int inQuotes = 0; - int size = 0; /* lint. */ + int size = 0; int numChars; int literal = 1; const char *p2; @@ -3436,7 +3436,6 @@ Tcl_PrintDouble( */ #if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 - /* ARGSUSED */ char * TclPrecTraceProc( ClientData clientData, diff --git a/generic/tclVar.c b/generic/tclVar.c index 40170dc..72724a4 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -1524,7 +1524,6 @@ TclPtrGetVarIdx( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_SetObjCmd( TCL_UNUSED(ClientData), @@ -2819,7 +2818,6 @@ UnsetVarStruct( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_UnsetObjCmd( TCL_UNUSED(ClientData), @@ -2887,7 +2885,6 @@ Tcl_UnsetObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_AppendObjCmd( TCL_UNUSED(ClientData), @@ -2953,7 +2950,6 @@ Tcl_AppendObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_LappendObjCmd( TCL_UNUSED(ClientData), @@ -3399,8 +3395,6 @@ ArrayPopulateSearch( *---------------------------------------------------------------------- */ - /* ARGSUSED */ - static int ArrayStartSearchCmd( TCL_UNUSED(ClientData), @@ -3496,7 +3490,6 @@ ArrayDoneSearch( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ArrayAnyMoreCmd( TCL_UNUSED(ClientData), @@ -3575,7 +3568,6 @@ ArrayAnyMoreCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ArrayNextElementCmd( TCL_UNUSED(ClientData), @@ -3656,7 +3648,6 @@ ArrayNextElementCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ArrayDoneSearchCmd( TCL_UNUSED(ClientData), @@ -3717,7 +3708,6 @@ ArrayDoneSearchCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ArrayExistsCmd( TCL_UNUSED(ClientData), @@ -3758,7 +3748,6 @@ ArrayExistsCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ArrayGetCmd( TCL_UNUSED(ClientData), @@ -3918,7 +3907,6 @@ ArrayGetCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ArrayNamesCmd( TCL_UNUSED(ClientData), @@ -4086,7 +4074,6 @@ TclFindArrayPtrElements( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ArraySetCmd( TCL_UNUSED(ClientData), @@ -4262,7 +4249,6 @@ ArraySetCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ArraySizeCmd( TCL_UNUSED(ClientData), @@ -4322,7 +4308,6 @@ ArraySizeCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ArrayStatsCmd( TCL_UNUSED(ClientData), @@ -4377,7 +4362,6 @@ ArrayStatsCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ArrayUnsetCmd( TCL_UNUSED(ClientData), @@ -4514,7 +4498,6 @@ ArrayUnsetCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ Tcl_Command TclInitArrayCmd( Tcl_Interp *interp) /* Current interpreter. */ @@ -5241,7 +5224,6 @@ Tcl_VariableObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_UpvarObjCmd( TCL_UNUSED(ClientData), @@ -6642,7 +6624,6 @@ CompareVarKeys( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ArrayDefaultCmd( TCL_UNUSED(ClientData), diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 045aad0..f670349 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -228,7 +228,6 @@ static const Tcl_ChannelType ttyChannelType = { *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int FileBlockModeProc( void *instanceData, /* File state. */ diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index bd93ad2..2ea98a0 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -134,7 +134,7 @@ enum { MACOSX_CREATOR_ATTRIBUTE, MACOSX_TYPE_ATTRIBUTE, MACOSX_HIDDEN_ATTRIBUTE, MACOSX_RSRCLENGTH_ATTRIBUTE, #endif - UNIX_INVALID_ATTRIBUTE /* lint - last enum value needs no trailing , */ + UNIX_INVALID_ATTRIBUTE }; const char *const tclpFileAttrStrings[] = { @@ -964,7 +964,7 @@ TraverseUnixTree( errfile = NULL; result = TCL_OK; - targetLen = 0; /* lint. */ + targetLen = 0; source = Tcl_DStringValue(sourcePtr); if (TclOSlstat(source, &statBuf) != 0) { /* INTL: Native. */ diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index f47e021..681ee64 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -374,7 +374,6 @@ TclpCloseFile( *--------------------------------------------------------------------------- */ - /* ARGSUSED */ int TclpCreateProcess( Tcl_Interp *interp, /* Interpreter in which to leave errors that @@ -900,7 +899,6 @@ TclGetAndDetachPids( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int PipeBlockModeProc( void *instanceData, /* Pipe state. */ @@ -1249,7 +1247,6 @@ Tcl_WaitPid( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_PidObjCmd( TCL_UNUSED(ClientData), diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 325e361..80de491 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -382,7 +382,6 @@ TclpFinalizeSockets(void) * ---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TcpBlockModeProc( void *instanceData, /* Socket state. */ @@ -528,7 +527,6 @@ WaitForConnect( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TcpInputProc( void *instanceData, /* Socket state. */ @@ -621,7 +619,6 @@ TcpOutputProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TcpCloseProc( void *instanceData, /* The socket to close. */ @@ -1102,7 +1099,6 @@ TcpWatchProc( * ---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TcpGetHandleProc( void *instanceData, /* The socket state. */ @@ -1758,7 +1754,6 @@ Tcl_OpenTcpServerEx( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void TcpAccept( void *data, /* Callback token. */ diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 347c5e9..9bb22b0 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -1195,7 +1195,7 @@ TraverseWinTree( nativeErrfile = NULL; result = TCL_OK; - oldTargetLen = 0; /* lint. */ + oldTargetLen = 0; nativeSource = (WCHAR *) Tcl_DStringValue(sourcePtr); nativeTarget = (WCHAR *) diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 67cca32..754e9ed 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -2740,7 +2740,6 @@ TclWinAddProcess( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tcl_PidObjCmd( TCL_UNUSED(ClientData), diff --git a/win/tclWinSock.c b/win/tclWinSock.c index cd07a8f..87e0dc6 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -546,7 +546,6 @@ TclpFinalizeSockets(void) *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TcpBlockModeProc( ClientData instanceData, /* Socket state. */ @@ -778,7 +777,6 @@ WaitForConnect( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TcpInputProc( ClientData instanceData, /* Socket state. */ @@ -1038,7 +1036,6 @@ TcpOutputProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TcpCloseProc( ClientData instanceData, /* The socket to close. */ @@ -1664,7 +1661,6 @@ TcpWatchProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TcpGetHandleProc( ClientData instanceData, /* The socket state. */ @@ -2395,7 +2391,6 @@ Tcl_OpenTcpServerEx( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void TcpAccept( TcpFdList *fds, /* Server socket that accepted newSocket. */ @@ -2584,7 +2579,6 @@ InitSockets(void) *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int SocketsEnabled(void) { @@ -2614,7 +2608,6 @@ SocketsEnabled(void) *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void SocketExitHandler( TCL_UNUSED(ClientData)) diff --git a/win/tclWinTest.c b/win/tclWinTest.c index d78d5f1..973ec47 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -411,7 +411,6 @@ TestExceptionCmd( /* SMASH! */ RaiseException(exceptions[cmd], EXCEPTION_NONCONTINUABLE, 0, NULL); - /* NOTREACHED */ return TCL_OK; } diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 8546fc2..2ea256b 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -1017,7 +1017,6 @@ CalibrationThread( UpdateTimeEachSecond(); } - /* lint */ return (DWORD) 0; } -- cgit v0.12 From cb291b4c47b87c9080c820a1b28c381167a5fa74 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 17 Mar 2020 01:03:05 +0000 Subject: a few more --- generic/tclCompCmdsSZ.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 34f0fab..081b141 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -3129,7 +3129,7 @@ IssueTryClausesInstructions( OP( STR_EQ); JUMP4( JUMP_FALSE, notECJumpSource); } else { - notECJumpSource = -1; /* LINT */ + notECJumpSource = -1; } OP( POP); @@ -3340,7 +3340,7 @@ IssueTryClausesFinallyInstructions( OP( STR_EQ); JUMP4( JUMP_FALSE, notECJumpSource); } else { - notECJumpSource = -1; /* LINT */ + notECJumpSource = -1; } OP( POP); -- cgit v0.12 From af7fa225c1d0ec592c7af29ead5922f45c1c15fb Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 18 Mar 2020 12:51:30 +0000 Subject: More uppercase HEX representations in source-code. --- compat/fake-rfc2553.c | 2 +- generic/tclAlloc.c | 8 +++---- generic/tclAssembly.c | 16 +++++++------- generic/tclBasic.c | 8 +++---- generic/tclBinary.c | 54 ++++++++++++++++++++++++------------------------ generic/tclCkalloc.c | 4 ++-- generic/tclCmdMZ.c | 4 ++-- generic/tclDisassemble.c | 10 ++++----- generic/tclEncoding.c | 26 +++++++++++------------ generic/tclEnv.c | 2 +- generic/tclExecute.c | 18 ++++++++-------- generic/tclObj.c | 8 +++---- generic/tclParse.c | 2 +- generic/tclStrToD.c | 46 ++++++++++++++++++++--------------------- generic/tclTest.c | 2 +- generic/tclUtf.c | 14 ++++++------- generic/tclUtil.c | 8 +++---- tools/encoding/txt2enc.c | 6 +++--- unix/tclUnixFCmd.c | 8 +++---- 19 files changed, 122 insertions(+), 124 deletions(-) diff --git a/compat/fake-rfc2553.c b/compat/fake-rfc2553.c index c8e69400..f308cd0 100644 --- a/compat/fake-rfc2553.c +++ b/compat/fake-rfc2553.c @@ -217,7 +217,7 @@ fake_getaddrinfo(const char *hostname, const char *servname, } if (!hostname) { - *res = malloc_ai(port, htonl(0x7f000001), hints); + *res = malloc_ai(port, htonl(0x7F000001), hints); if (*res == NULL) return (EAI_MEMORY); return (0); diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c index cda1f38..f4755b3 100644 --- a/generic/tclAlloc.c +++ b/generic/tclAlloc.c @@ -68,7 +68,7 @@ union overhead { }; -#define MAGIC 0xef /* magic # on accounting info */ +#define MAGIC 0xEF /* magic # on accounting info */ #define RMAGIC 0x5555 /* magic # on range info */ #ifndef NDEBUG @@ -288,7 +288,7 @@ TclpAlloc( overPtr = (union overhead *) (bigBlockPtr + 1); overPtr->overMagic0 = overPtr->overMagic1 = MAGIC; - overPtr->bucketIndex = 0xff; + overPtr->bucketIndex = 0xFF; #ifdef MSTATS numMallocs[NBUCKETS]++; #endif @@ -469,7 +469,7 @@ TclpFree( RANGE_ASSERT(overPtr->rangeCheckMagic == RMAGIC); RANGE_ASSERT(BLOCK_END(overPtr) == RMAGIC); size = overPtr->bucketIndex; - if (size == 0xff) { + if (size == 0xFF) { #ifdef MSTATS numMallocs[NBUCKETS]--; #endif @@ -543,7 +543,7 @@ TclpRealloc( * If the block isn't in a bin, just realloc it. */ - if (i == 0xff) { + if (i == 0xFF) { struct block *prevPtr, *nextPtr; bigBlockPtr = (struct block *) overPtr - 1; prevPtr = bigBlockPtr->prevPtr; diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 15e36ac..d154bcf 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -663,7 +663,7 @@ BBEmitOpcode( /* Compilation environment */ BasicBlock* bbPtr = assemEnvPtr->curr_bb; /* Current basic block */ - int op = TalInstructionTable[tblIdx].tclInstCode & 0xff; + int op = TalInstructionTable[tblIdx].tclInstCode & 0xFF; /* * If this is the first instruction in a basic block, record its line @@ -725,13 +725,13 @@ BBEmitInst1or4( /* Current basic block */ int op = TalInstructionTable[tblIdx].tclInstCode; - if (param <= 0xff) { + if (param <= 0xFF) { op >>= 8; } else { - op &= 0xff; + op &= 0xFF; } TclEmitInt1(op, envPtr); - if (param <= 0xff) { + if (param <= 0xFF) { TclEmitInt1(param, envPtr); } else { TclEmitInt4(param, envPtr); @@ -2224,7 +2224,7 @@ GetIntegerOperand( * TCL_ERROR (with an appropriate error message) if the parse fails. * * Side effects: - * Stores the list index at '*index'. Values between -1 and 0x7fffffff + * Stores the list index at '*index'. Values between -1 and 0x7FFFFFFF * have their natural meaning; values between -2 and -0x80000000 * represent 'end-2-N'. * @@ -2387,7 +2387,7 @@ CheckOneByte( { Tcl_Obj* result; /* Error message */ - if (value < 0 || value > 0xff) { + if (value < 0 || value > 0xFF) { result = Tcl_NewStringObj("operand does not fit in one byte", -1); Tcl_SetObjResult(interp, result); Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL); @@ -2422,7 +2422,7 @@ CheckSignedOneByte( { Tcl_Obj* result; /* Error message */ - if (value > 0x7f || value < -0x80) { + if (value > 0x7F || value < -0x80) { result = Tcl_NewStringObj("operand does not fit in one byte", -1); Tcl_SetObjResult(interp, result); Tcl_SetErrorCode(interp, "TCL", "ASSEM", "1BYTE", NULL); @@ -2836,7 +2836,7 @@ CalculateJumpRelocations( if (bbPtr->flags & BB_JUMP1) { offset = jumpTarget->startOffset - (bbPtr->jumpOffset + motion); - if (offset < -0x80 || offset > 0x7f) { + if (offset < -0x80 || offset > 0x7F) { opcode = TclGetUInt1AtPtr(envPtr->codeStart + bbPtr->jumpOffset); ++opcode; diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 68f32c2..fe64f18 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -7779,8 +7779,8 @@ ExprRandFunc( * Make sure 1 <= randSeed <= (2^31) - 2. See below. */ - iPtr->randSeed &= (unsigned long) 0x7fffffff; - if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7fffffff)) { + iPtr->randSeed &= (unsigned long) 0x7FFFFFFF; + if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7FFFFFFF)) { iPtr->randSeed ^= 123459876; } } @@ -7957,8 +7957,8 @@ ExprSrandFunc( iPtr->flags |= RAND_SEED_INITIALIZED; iPtr->randSeed = i; - iPtr->randSeed &= (unsigned long) 0x7fffffff; - if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7fffffff)) { + iPtr->randSeed &= (unsigned long) 0x7FFFFFFF; + if ((iPtr->randSeed == 0) || (iPtr->randSeed == 0x7FFFFFFF)) { iPtr->randSeed ^= 123459876; } diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 8bd65a8..81c56e7 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -1084,7 +1084,7 @@ BinaryFormatCmd( if (c > 16) { c += ('A' - 'a'); } - value |= (c & 0xf); + value |= (c & 0xF); if (offset % 2) { *cursor++ = (char) value; value = 0; @@ -1106,9 +1106,9 @@ BinaryFormatCmd( if (c > 16) { c += ('A' - 'a'); } - value |= ((c << 4) & 0xf0); + value |= ((c << 4) & 0xF0); if (offset % 2) { - *cursor++ = UCHAR(value & 0xff); + *cursor++ = UCHAR(value & 0xFF); value = 0; } } @@ -1442,7 +1442,7 @@ BinaryScanCmd( } else { value = *src++; } - *dest++ = hexdigit[value & 0xf]; + *dest++ = hexdigit[value & 0xF]; } } else { for (i = 0; i < count; i++) { @@ -1451,7 +1451,7 @@ BinaryScanCmd( } else { value = *src++; } - *dest++ = hexdigit[(value >> 4) & 0xf]; + *dest++ = hexdigit[(value >> 4) & 0xF]; } } @@ -2339,8 +2339,8 @@ BinaryEncodeHex( data = Tcl_GetByteArrayFromObj(objv[1], &count); cursor = Tcl_SetByteArrayLength(resultObj, count * 2); for (offset = 0; offset < count; ++offset) { - *cursor++ = HexDigits[(data[offset] >> 4) & 0x0f]; - *cursor++ = HexDigits[data[offset] & 0x0f]; + *cursor++ = HexDigits[(data[offset] >> 4) & 0x0F]; + *cursor++ = HexDigits[data[offset] & 0x0F]; } Tcl_SetObjResult(interp, resultObj); return TCL_OK; @@ -2423,7 +2423,7 @@ BinaryDecodeHex( if (c > 16) { c += ('A' - 'a'); } - value |= c & 0xf; + value |= c & 0xF; } if (i < 2) { cut++; @@ -2552,12 +2552,12 @@ BinaryEncode64( OUTPUT(B64Digits[d[0] >> 2]); OUTPUT(B64Digits[((d[0] & 0x03) << 4) | (d[1] >> 4)]); if (offset + 1 < count) { - OUTPUT(B64Digits[((d[1] & 0x0f) << 2) | (d[2] >> 6)]); + OUTPUT(B64Digits[((d[1] & 0x0F) << 2) | (d[2] >> 6)]); } else { OUTPUT(B64Digits[64]); } if (offset+2 < count) { - OUTPUT(B64Digits[d[2] & 0x3f]); + OUTPUT(B64Digits[d[2] & 0x3F]); } else { OUTPUT(B64Digits[64]); } @@ -2666,12 +2666,12 @@ BinaryEncodeUu( n <<= 8; n |= data[offset++]; for (bits += 8; bits > 6 ; bits -= 6) { - *cursor++ = UueDigits[(n >> (bits - 6)) & 0x3f]; + *cursor++ = UueDigits[(n >> (bits - 6)) & 0x3F]; } } if (bits > 0) { n <<= 8; - *cursor++ = UueDigits[(n >> (bits + 2)) & 0x3f]; + *cursor++ = UueDigits[(n >> (bits + 2)) & 0x3F]; bits = 0; } for (j = 0 ; j < wrapcharlen ; ++j) { @@ -2762,7 +2762,7 @@ BinaryDecodeUu( i--; continue; } - lineLen = (c - 32) & 0x3f; + lineLen = (c - 32) & 0x3F; } /* @@ -2791,14 +2791,14 @@ BinaryDecodeUu( */ if (lineLen > 0) { - *cursor++ = (((d[0] - 0x20) & 0x3f) << 2) - | (((d[1] - 0x20) & 0x3f) >> 4); + *cursor++ = (((d[0] - 0x20) & 0x3F) << 2) + | (((d[1] - 0x20) & 0x3F) >> 4); if (--lineLen > 0) { - *cursor++ = (((d[1] - 0x20) & 0x3f) << 4) - | (((d[2] - 0x20) & 0x3f) >> 2); + *cursor++ = (((d[1] - 0x20) & 0x3F) << 4) + | (((d[2] - 0x20) & 0x3F) >> 2); if (--lineLen > 0) { - *cursor++ = (((d[2] - 0x20) & 0x3f) << 6) - | (((d[3] - 0x20) & 0x3f)); + *cursor++ = (((d[2] - 0x20) & 0x3F) << 6) + | (((d[3] - 0x20) & 0x3F)); lineLen--; } } @@ -2957,15 +2957,15 @@ BinaryDecode64( goto bad64; } } else if (c >= 'A' && c <= 'Z') { - value = (value << 6) | ((c - 'A') & 0x3f); + value = (value << 6) | ((c - 'A') & 0x3F); } else if (c >= 'a' && c <= 'z') { - value = (value << 6) | ((c - 'a' + 26) & 0x3f); + value = (value << 6) | ((c - 'a' + 26) & 0x3F); } else if (c >= '0' && c <= '9') { - value = (value << 6) | ((c - '0' + 52) & 0x3f); + value = (value << 6) | ((c - '0' + 52) & 0x3F); } else if (c == '+') { - value = (value << 6) | 0x3e; + value = (value << 6) | 0x3E; } else if (c == '/') { - value = (value << 6) | 0x3f; + value = (value << 6) | 0x3F; } else if (c == '=' && (!strict || i > 1)) { /* * "=" and "a=" is rather bad64 error case in strict mode. @@ -2981,9 +2981,9 @@ BinaryDecode64( i--; } } - *cursor++ = UCHAR((value >> 16) & 0xff); - *cursor++ = UCHAR((value >> 8) & 0xff); - *cursor++ = UCHAR(value & 0xff); + *cursor++ = UCHAR((value >> 16) & 0xFF); + *cursor++ = UCHAR((value >> 8) & 0xFF); + *cursor++ = UCHAR(value & 0xFF); /* * Since = is only valid within the final block, if it was encountered diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 26f092f..9c3cbff 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -244,7 +244,7 @@ ValidateMemory( if (byte != GUARD_VALUE) { guard_failed = TRUE; fflush(stdout); - byte &= 0xff; + byte &= 0xFF; fprintf(stderr, "low guard byte %d is 0x%x \t%c\n", (int)idx, byte, (isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */ } @@ -265,7 +265,7 @@ ValidateMemory( if (byte != GUARD_VALUE) { guard_failed = TRUE; fflush(stdout); - byte &= 0xff; + byte &= 0xFF; fprintf(stderr, "hi guard byte %d is 0x%x \t%c\n", (int)idx, byte, (isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */ } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 193eac4..75989c7 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1088,7 +1088,7 @@ Tcl_SplitObjCmd( #if TCL_UTF_MAX == 4 if ((ch >= 0xD800) && (len < 3)) { len += TclUtfToUniChar(stringPtr + len, &ch); - fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000; } #endif @@ -1803,7 +1803,7 @@ StringIsCmd( #if TCL_UTF_MAX == 4 if ((ch >= 0xD800) && (length2 < 3)) { length2 += TclUtfToUniChar(string1 + length2, &ch); - fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000; } #endif if (!chcomp(fullchar)) { diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index f62c260..b60edca 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -894,23 +894,23 @@ PrintSourceToObj( continue; default: #if TCL_UTF_MAX > 4 - if (ch > 0xffff) { + if (ch > 0xFFFF) { Tcl_AppendPrintfToObj(appendObj, "\\U%08x", ch); i += 10; } else #elif TCL_UTF_MAX > 3 - /* If len == 0, this means we have a char > 0xffff, resulting in + /* If len == 0, this means we have a char > 0xFFFF, resulting in * TclUtfToUniChar producing a surrogate pair. We want to output * this pair as a single Unicode character. */ if (len == 0) { - int upper = ((ch & 0x3ff) + 1) << 10; + int upper = ((ch & 0x3FF) + 1) << 10; len = TclUtfToUniChar(p, &ch); - Tcl_AppendPrintfToObj(appendObj, "\\U%08x", upper + (ch & 0x3ff)); + Tcl_AppendPrintfToObj(appendObj, "\\U%08x", upper + (ch & 0x3FF)); i += 10; } else #endif - if (ch < 0x20 || ch >= 0x7f) { + if (ch < 0x20 || ch >= 0x7F) { Tcl_AppendPrintfToObj(appendObj, "\\u%04x", ch); i += 6; } else { diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 8990385..b879ec8 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1771,7 +1771,7 @@ LoadTableEncoding( dataPtr->toUnicode[hi] = pageMemPtr; p += 2; for (lo = 0; lo < 256; lo++) { - if ((lo & 0x0f) == 0) { + if ((lo & 0x0F) == 0) { p++; } ch = (staticHex[UCHAR(p[0])] << 12) + (staticHex[UCHAR(p[1])] << 8) @@ -1832,7 +1832,7 @@ LoadTableEncoding( pageMemPtr += 256; dataPtr->fromUnicode[ch >> 8] = page; } - page[ch & 0xff] = (unsigned short) ((hi << 8) + lo); + page[ch & 0xFF] = (unsigned short) ((hi << 8) + lo); } } } @@ -1938,7 +1938,7 @@ LoadTableEncoding( if (from == 0) { continue; } - dataPtr->fromUnicode[from >> 8][from & 0xff] = to; + dataPtr->fromUnicode[from >> 8][from & 0xFF] = to; } } doneParse: @@ -2157,7 +2157,7 @@ BinaryProc( * UtfIntToUtfExtProc -- * * Convert from UTF-8 to UTF-8. While converting null-bytes from the - * Tcl's internal representation (0xc0, 0x80) to the official + * Tcl's internal representation (0xC0, 0x80) to the official * representation (0x00). See UtfToUtfProc for details. * * Results: @@ -2206,7 +2206,7 @@ UtfIntToUtfExtProc( * UtfExtToUtfIntProc -- * * Convert from UTF-8 to UTF-8 while converting null-bytes from the - * official representation (0x00) to Tcl's internal representation (0xc0, + * official representation (0x00) to Tcl's internal representation (0xC0, * 0x80). See UtfToUtfProc for details. * * Results: @@ -2337,14 +2337,14 @@ UtfToUtfProc( if (UCHAR(*src) < 0x80 && !(UCHAR(*src) == 0 && pureNullMode == 0)) { /* * Copy 7bit characters, but skip null-bytes when we are in input - * mode, so that they get converted to 0xc080. + * mode, so that they get converted to 0xC080. */ *dst++ = *src++; - } else if (pureNullMode == 1 && UCHAR(*src) == 0xc0 && + } else if (pureNullMode == 1 && UCHAR(*src) == 0xC0 && (src + 1 < srcEnd) && UCHAR(*(src+1)) == 0x80) { /* - * Convert 0xc080 to real nulls when we are in output mode. + * Convert 0xC080 to real nulls when we are in output mode. */ *dst++ = 0; @@ -2808,7 +2808,7 @@ TableFromUtfProc( * full support of int Tcl_UniChar. [Bug 1004065] */ - if (ch & 0xffff0000) { + if (ch & 0xFFFF0000) { word = 0; } else #elif TCL_UTF_MAX == 4 @@ -2816,7 +2816,7 @@ TableFromUtfProc( word = 0; } else #endif - word = fromUnicode[(ch >> 8)][ch & 0xff]; + word = fromUnicode[(ch >> 8)][ch & 0xFF]; if ((word == 0) && (ch != 0)) { if (flags & TCL_ENCODING_STOPONERROR) { @@ -3012,7 +3012,7 @@ Iso88591FromUtfProc( * Check for illegal characters. */ - if (ch > 0xff + if (ch > 0xFF #if TCL_UTF_MAX == 4 || ((ch >= 0xD800) && (len < 3)) #endif @@ -3399,7 +3399,7 @@ EscapeFromUtfProc( break; } len = TclUtfToUniChar(src, &ch); - word = tableFromUnicode[(ch >> 8)][ch & 0xff]; + word = tableFromUnicode[(ch >> 8)][ch & 0xFF]; if ((word == 0) && (ch != 0)) { int oldState; @@ -3409,7 +3409,7 @@ EscapeFromUtfProc( for (state = 0; state < dataPtr->numSubTables; state++) { encodingPtr = GetTableEncoding(dataPtr, state); tableDataPtr = encodingPtr->clientData; - word = tableDataPtr->fromUnicode[(ch >> 8)][ch & 0xff]; + word = tableDataPtr->fromUnicode[(ch >> 8)][ch & 0xFF]; if (word != 0) { break; } diff --git a/generic/tclEnv.c b/generic/tclEnv.c index e7cb962..1f61e07 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -27,7 +27,7 @@ TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */ # ifdef USE_PUTENV # define putenv(env) _wputenv((const wchar_t *)env) # endif -#else +#else # define tenviron environ # define tenviron2utfdstr(tenvstr, len, dstr) \ Tcl_ExternalToUtfDString(NULL, tenvstr, len, dstr) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 171515d..f38e752 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -586,7 +586,7 @@ VarHashCreateVar( * Auxiliary tables used to compute powers of small integers. */ -#if (LONG_MAX == 0x7fffffff) +#if (LONG_MAX == 0x7FFFFFFF) /* * Maximum base that, when raised to powers 2, 3, ... 8, fits in a 32-bit @@ -616,9 +616,9 @@ static const long Exp32Value[] = { 1000000000 }; static const size_t Exp32ValueSize = sizeof(Exp32Value)/sizeof(long); -#endif /* LONG_MAX == 0x7fffffff -- 32 bit machine */ +#endif /* LONG_MAX == 0x7FFFFFFF -- 32 bit machine */ -#if (LONG_MAX > 0x7fffffff) || !defined(TCL_WIDE_INT_IS_LONG) +#if (LONG_MAX > 0x7FFFFFFF) || !defined(TCL_WIDE_INT_IS_LONG) /* * Maximum base that, when