diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCmdIL.c | 21 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 8 | ||||
-rw-r--r-- | generic/tclEnsemble.c | 15 | ||||
-rw-r--r-- | generic/tclIndexObj.c | 13 | ||||
-rw-r--r-- | generic/tclInterp.c | 47 | ||||
-rw-r--r-- | generic/tclTest.c | 3 | ||||
-rw-r--r-- | generic/tclTestObj.c | 6 | ||||
-rw-r--r-- | generic/tclThreadTest.c | 10 | ||||
-rw-r--r-- | generic/tclTrace.c | 65 | ||||
-rw-r--r-- | generic/tclZlib.c | 12 |
10 files changed, 105 insertions, 95 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 4eff6f5..b1d55ce 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -3145,7 +3145,7 @@ Tcl_LsearchObjCmd( int i, match, index, result=TCL_OK, listc, bisect; size_t length = 0, elemLen, start, groupSize, groupOffset, lower, upper; int allocatedIndexVector = 0; - int dataType, isIncreasing; + int isIncreasing; Tcl_WideInt patWide, objWide, wide; int allMatches, inlineReturn, negatedMatch, returnSubindices, noCase; double patDouble, objDouble; @@ -3169,7 +3169,7 @@ Tcl_LsearchObjCmd( }; enum datatypes { ASCII, DICTIONARY, INTEGER, REAL - }; + } dataType; enum modes { EXACT, GLOB, REGEXP, SORTED }; @@ -3203,12 +3203,13 @@ Tcl_LsearchObjCmd( } for (i = 1; i < objc-2; i++) { - if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, &index) + enum lsearchoptions idx; + if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, &idx) != TCL_OK) { result = TCL_ERROR; goto done; } - switch ((enum lsearchoptions) index) { + switch (idx) { case LSEARCH_ALL: /* -all */ allMatches = 1; break; @@ -3536,7 +3537,7 @@ Tcl_LsearchObjCmd( patObj = objv[objc - 1]; patternBytes = NULL; if (mode == EXACT || mode == SORTED) { - switch ((enum datatypes) dataType) { + switch (dataType) { case ASCII: case DICTIONARY: patternBytes = Tcl_GetStringFromObj(patObj, &length); @@ -3606,7 +3607,7 @@ Tcl_LsearchObjCmd( } else { itemPtr = listv[i+groupOffset]; } - switch ((enum datatypes) dataType) { + switch (dataType) { case ASCII: bytes = TclGetString(itemPtr); match = strCmpFn(patternBytes, bytes); @@ -3711,7 +3712,7 @@ Tcl_LsearchObjCmd( switch (mode) { case SORTED: case EXACT: - switch ((enum datatypes) dataType) { + switch (dataType) { case ASCII: bytes = Tcl_GetStringFromObj(itemPtr, &elemLen); if (length == elemLen) { @@ -3986,7 +3987,7 @@ Tcl_LsortObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - int i, index, indices, length, nocase = 0, indexc; + int i, indices, length, nocase = 0, indexc; int sortMode = SORTMODE_ASCII; int group, allocatedIndexVector = 0; size_t j, idx, groupSize, groupOffset; @@ -4012,7 +4013,7 @@ Tcl_LsortObjCmd( LSORT_ASCII, LSORT_COMMAND, LSORT_DECREASING, LSORT_DICTIONARY, LSORT_INCREASING, LSORT_INDEX, LSORT_INDICES, LSORT_INTEGER, LSORT_NOCASE, LSORT_REAL, LSORT_STRIDE, LSORT_UNIQUE - }; + } index; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "?-option value ...? list"); @@ -4042,7 +4043,7 @@ Tcl_LsortObjCmd( sortInfo.resultCode = TCL_ERROR; goto done; } - switch ((enum Lsort_Switches) index) { + switch (index) { case LSORT_ASCII: sortInfo.sortMode = SORTMODE_ASCII; break; diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 4d946ab..65d763c 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4139,7 +4139,7 @@ Tcl_TimeRateObjCmd( ByteCode *codePtr = NULL; for (i = 1; i < objc - 1; i++) { - int index; + enum timeRateOptionsEnum index; if (Tcl_GetIndexFromObj(NULL, objv[i], options, "option", TCL_EXACT, &index) != TCL_OK) { @@ -4149,7 +4149,7 @@ Tcl_TimeRateObjCmd( i++; break; } - switch ((enum timeRateOptionsEnum)index) { + switch (index) { case TMRT_EV_DIRECT: direct = objv[i]; break; @@ -4688,7 +4688,7 @@ TclNRTryObjCmd( bodyShared = 0; haveHandlers = 0; for (i=2 ; i<objc ; i++) { - int type; + enum Handlers type; Tcl_Obj *info[5]; if (Tcl_GetIndexFromObj(interp, objv[i], handlerNames, "handler type", @@ -4696,7 +4696,7 @@ TclNRTryObjCmd( Tcl_DecrRefCount(handlersObj); return TCL_ERROR; } - switch ((enum Handlers) type) { + switch (type) { case TryFinally: /* finally script */ if (i < objc-2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 3a4ecd6..6ff5df4 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -220,14 +220,15 @@ TclNamespaceEnsembleCmd( */ for (; objc>1 ; objc-=2,objv+=2) { + enum EnsCreateOpts idx; if (Tcl_GetIndexFromObj(interp, objv[0], ensembleCreateOptions, - "option", 0, &index) != TCL_OK) { + "option", 0, &idx) != TCL_OK) { if (allocatedMapFlag) { Tcl_DecrRefCount(mapObj); } return TCL_ERROR; } - switch ((enum EnsCreateOpts) index) { + switch (idx) { case CRT_CMD: name = TclGetString(objv[1]); cxtPtr = nsPtr; @@ -399,13 +400,14 @@ TclNamespaceEnsembleCmd( } if (objc == 4) { + enum EnsConfigOpts idx; Tcl_Obj *resultObj = NULL; /* silence gcc 4 warning */ if (Tcl_GetIndexFromObj(interp, objv[3], ensembleConfigOptions, - "option", 0, &index) != TCL_OK) { + "option", 0, &idx) != TCL_OK) { return TCL_ERROR; } - switch ((enum EnsConfigOpts) index) { + switch (idx) { case CONF_SUBCMDS: Tcl_GetEnsembleSubcommandList(NULL, token, &resultObj); if (resultObj != NULL) { @@ -522,15 +524,16 @@ TclNamespaceEnsembleCmd( */ for (; objc>0 ; objc-=2,objv+=2) { + enum EnsConfigOpts idx; if (Tcl_GetIndexFromObj(interp, objv[0],ensembleConfigOptions, - "option", 0, &index) != TCL_OK) { + "option", 0, &idx) != TCL_OK) { freeMapAndError: if (allocatedMapFlag) { Tcl_DecrRefCount(mapObj); } return TCL_ERROR; } - switch ((enum EnsConfigOpts) index) { + switch (idx) { case CONF_SUBCMDS: if (TclListObjLength(interp, objv[1], &len) != TCL_OK) { goto freeMapAndError; diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index c989313..c369827 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -360,6 +360,9 @@ Tcl_GetIndexFromObjStruct( } return TCL_ERROR; } +/* #define again, needed below */ +#define Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags, indexPtr) \ + ((Tcl_GetIndexFromObjStruct)((interp), (objPtr), (tablePtr), (offset), (msg), (flags)|(int)(sizeof(*(indexPtr))<<8), (indexPtr))) /* *---------------------------------------------------------------------- @@ -504,7 +507,7 @@ PrefixMatchObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int flags = 0, result, index; + int flags = 0, result, dummy; int dummyLength, i, errorLength; Tcl_Obj *errorPtr = NULL; const char *message = "option"; @@ -514,7 +517,7 @@ PrefixMatchObjCmd( }; enum matchOptionsEnum { PRFMATCH_ERROR, PRFMATCH_EXACT, PRFMATCH_MESSAGE - }; + } index; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "?options? table string"); @@ -526,7 +529,7 @@ PrefixMatchObjCmd( sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } - switch ((enum matchOptionsEnum) index) { + switch (index) { case PRFMATCH_EXACT: flags |= TCL_EXACT; break; @@ -578,7 +581,7 @@ PrefixMatchObjCmd( } result = GetIndexFromObjList(interp, objPtr, tablePtr, message, flags, - &index); + &dummy); if (result != TCL_OK) { if (errorPtr != NULL && errorLength == 0) { Tcl_ResetResult(interp); @@ -597,7 +600,7 @@ PrefixMatchObjCmd( return Tcl_SetReturnOptions(interp, errorPtr); } - result = Tcl_ListObjIndex(interp, tablePtr, index, &resultPtr); + result = Tcl_ListObjIndex(interp, tablePtr, dummy, &resultPtr); if (result != TCL_OK) { return result; } diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 2e57ff5..ccb0aae 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -649,20 +649,20 @@ NRInterpCmd( OPT_SLAVES, #endif OPT_TARGET, OPT_TRANSFER - }; + } index1; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "cmd ?arg ...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObj(NULL, objv[1], options, - "option", 0, &index) != TCL_OK) { + "option", 0, &index1) != TCL_OK) { /* Don't report the "slaves" option as possibility */ Tcl_GetIndexFromObj(interp, objv[1], optionsNoSlaves, - "option", 0, &index); + "option", 0, &index1); return TCL_ERROR; } - switch ((enum interpOptionEnum)index) { + switch (index1) { case OPT_ALIAS: { Tcl_Interp *parentInterp; @@ -722,15 +722,16 @@ NRInterpCmd( flags = 0; for (i = 2; i < objc; i++) { + enum optionCancelEnum idx; if (TclGetString(objv[i])[0] != '-') { break; } if (Tcl_GetIndexFromObj(interp, objv[i], cancelOptions, "option", - 0, &index) != TCL_OK) { + 0, &idx) != TCL_OK) { return TCL_ERROR; } - switch ((enum optionCancelEnum) index) { + switch (idx) { case OPT_UNWIND: /* * The evaluation stack in the target interp is to be unwound. @@ -991,8 +992,7 @@ NRInterpCmd( }; enum LimitTypes { LIMIT_TYPE_COMMANDS, LIMIT_TYPE_TIME - }; - int limitType; + } limitType; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, @@ -1007,7 +1007,7 @@ NRInterpCmd( &limitType) != TCL_OK) { return TCL_ERROR; } - switch ((enum LimitTypes) limitType) { + switch (limitType) { case LIMIT_TYPE_COMMANDS: return ChildCommandLimitCmd(interp, childInterp, 4, objc,objv); case LIMIT_TYPE_TIME: @@ -2564,7 +2564,6 @@ NRChildCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Interp *childInterp = (Tcl_Interp *)clientData; - int index; static const char *const options[] = { "alias", "aliases", "bgerror", "debug", "eval", "expose", "hide", "hidden", @@ -2576,7 +2575,7 @@ NRChildCmd( OPT_EVAL, OPT_EXPOSE, OPT_HIDE, OPT_HIDDEN, OPT_ISSAFE, OPT_INVOKEHIDDEN, OPT_LIMIT, OPT_MARKTRUSTED, OPT_RECLIMIT - }; + } index; if (childInterp == NULL) { Tcl_Panic("TclChildObjCmd: interpreter has been deleted"); @@ -2591,7 +2590,7 @@ NRChildCmd( return TCL_ERROR; } - switch ((enum childCmdOptionsEnum) index) { + switch (index) { case OPT_ALIAS: if (objc > 2) { if (objc == 3) { @@ -2669,7 +2668,7 @@ NRChildCmd( }; enum hiddenOption { OPT_GLOBAL, OPT_NAMESPACE, OPT_LAST - }; + } idx; namespaceName = NULL; for (i = 2; i < objc; i++) { @@ -2677,12 +2676,12 @@ NRChildCmd( break; } if (Tcl_GetIndexFromObj(interp, objv[i], hiddenOptions, "option", - 0, &index) != TCL_OK) { + 0, &idx) != TCL_OK) { return TCL_ERROR; } - if (index == OPT_GLOBAL) { + if (idx == OPT_GLOBAL) { namespaceName = "::"; - } else if (index == OPT_NAMESPACE) { + } else if (idx == OPT_NAMESPACE) { if (++i == objc) { /* There must be more arguments. */ break; } else { @@ -2707,8 +2706,7 @@ NRChildCmd( }; enum LimitTypes { LIMIT_TYPE_COMMANDS, LIMIT_TYPE_TIME - }; - int limitType; + } limitType; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "limitType ?-option value ...?"); @@ -2718,7 +2716,7 @@ NRChildCmd( &limitType) != TCL_OK) { return TCL_ERROR; } - switch ((enum LimitTypes) limitType) { + switch (limitType) { case LIMIT_TYPE_COMMANDS: return ChildCommandLimitCmd(interp, childInterp, 3, objc,objv); case LIMIT_TYPE_TIME: @@ -4491,9 +4489,8 @@ ChildCommandLimitCmd( }; enum Options { OPT_CMD, OPT_GRAN, OPT_VAL - }; + } index; Interp *iPtr = (Interp *) interp; - int index; ScriptLimitCallbackKey key; ScriptLimitCallback *limitCBPtr; Tcl_HashEntry *hPtr; @@ -4556,7 +4553,7 @@ ChildCommandLimitCmd( 0, &index) != TCL_OK) { return TCL_ERROR; } - switch ((enum Options) index) { + switch (index) { case OPT_CMD: key.interp = childInterp; key.type = TCL_LIMIT_COMMANDS; @@ -4594,7 +4591,7 @@ ChildCommandLimitCmd( &index) != TCL_OK) { return TCL_ERROR; } - switch ((enum Options) index) { + switch (index) { case OPT_CMD: scriptObj = objv[i+1]; (void) Tcl_GetStringFromObj(scriptObj, &scriptLen); @@ -4751,7 +4748,7 @@ ChildTimeLimitCmd( 0, &index) != TCL_OK) { return TCL_ERROR; } - switch ((enum Options) index) { + switch (index) { case OPT_CMD: key.interp = childInterp; key.type = TCL_LIMIT_TIME; @@ -4804,7 +4801,7 @@ ChildTimeLimitCmd( &index) != TCL_OK) { return TCL_ERROR; } - switch ((enum Options) index) { + switch (index) { case OPT_CMD: scriptObj = objv[i+1]; (void) Tcl_GetStringFromObj(objv[i+1], &scriptLen); diff --git a/generic/tclTest.c b/generic/tclTest.c index 485d15d..7db35e1 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -7157,7 +7157,8 @@ TestGetIntForIndexCmd( if (Tcl_GetIntForIndex(interp, objv[1], endvalue, &result) != TCL_OK) { return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result)); + /* Make sure that (size_t)-2 is output as "-2" and (size_t)-3 as "-3", even for 32-bit */ + Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(result + 3U)) - 3)); return TCL_OK; } diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index 7ea1723..cb3fc79 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -151,7 +151,7 @@ TestbignumobjCmd( enum options { BIGNUM_SET, BIGNUM_GET, BIGNUM_MULT10, BIGNUM_DIV10, BIGNUM_ISEVEN, BIGNUM_RADIXSIZE - }; + } idx; int index; size_t varIndex; const char *string; @@ -163,7 +163,7 @@ TestbignumobjCmd( return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[1], subcmds, "option", 0, - &index) != TCL_OK) { + &idx) != TCL_OK) { return TCL_ERROR; } if (GetVariableIndex(interp, objv[2], &varIndex) != TCL_OK) { @@ -171,7 +171,7 @@ TestbignumobjCmd( } varPtr = GetVarPtr(interp); - switch ((enum options)index) { + switch (idx) { case BIGNUM_SET: if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "var value"); diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index 984a583..900af4a 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -270,7 +270,7 @@ ThreadObjCmd( } else { result = NULL; } - return ThreadCancel(interp, (Tcl_ThreadId) (size_t) id, result, flags); + return ThreadCancel(interp, (Tcl_ThreadId) INT2PTR(id), result, flags); } case THREAD_CREATE: { const char *script; @@ -334,11 +334,11 @@ ThreadObjCmd( */ if (objc == 2) { - idObj = Tcl_NewWideIntObj((Tcl_WideInt)(size_t)Tcl_GetCurrentThread()); + idObj = Tcl_NewWideIntObj((Tcl_WideInt)PTR2INT(Tcl_GetCurrentThread())); } else if (objc == 3 && strcmp("-main", Tcl_GetString(objv[2])) == 0) { Tcl_MutexLock(&threadMutex); - idObj = Tcl_NewWideIntObj((Tcl_WideInt)(size_t)mainThreadId); + idObj = Tcl_NewWideIntObj((Tcl_WideInt)PTR2INT(mainThreadId)); Tcl_MutexUnlock(&threadMutex); } else { Tcl_WrongNumArgs(interp, 2, objv, NULL); @@ -363,7 +363,7 @@ ThreadObjCmd( return TCL_ERROR; } - result = Tcl_JoinThread((Tcl_ThreadId)(size_t)id, &status); + result = Tcl_JoinThread((Tcl_ThreadId)INT2PTR(id), &status); if (result == TCL_OK) { Tcl_SetIntObj(Tcl_GetObjResult(interp), status); } else { @@ -405,7 +405,7 @@ ThreadObjCmd( } arg++; script = Tcl_GetString(objv[arg]); - return ThreadSend(interp, (Tcl_ThreadId)(size_t)id, script, wait); + return ThreadSend(interp, (Tcl_ThreadId)INT2PTR(id), script, wait); } case THREAD_EVENT: { if (objc > 2) { diff --git a/generic/tclTrace.c b/generic/tclTrace.c index a039f66..a7c7b5d 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -92,7 +92,13 @@ typedef struct { * Forward declarations for functions defined in this file: */ -typedef int (Tcl_TraceTypeObjCmd)(Tcl_Interp *interp, int optionIndex, +enum traceOptions { + TRACE_ADD, TRACE_INFO, TRACE_REMOVE +#ifndef TCL_REMOVE_OBSOLETE_TRACES + ,TRACE_OLD_VARIABLE, TRACE_OLD_VDELETE, TRACE_OLD_VINFO +#endif +}; +typedef int (Tcl_TraceTypeObjCmd)(Tcl_Interp *interp, enum traceOptions optionIndex, int objc, Tcl_Obj *const objv[]); static Tcl_TraceTypeObjCmd TraceVariableObjCmd; @@ -201,12 +207,7 @@ Tcl_TraceObjCmd( NULL }; /* 'OLD' options are pre-Tcl-8.4 style */ - enum traceOptionsEnum { - TRACE_ADD, TRACE_INFO, TRACE_REMOVE, -#ifndef TCL_REMOVE_OBSOLETE_TRACES - TRACE_OLD_VARIABLE, TRACE_OLD_VDELETE, TRACE_OLD_VINFO -#endif - } optionIndex; + enum traceOptions optionIndex; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -397,25 +398,21 @@ Tcl_TraceObjCmd( static int TraceExecutionObjCmd( Tcl_Interp *interp, /* Current interpreter. */ - int optionIndex, /* Add, info or remove */ + enum traceOptions optionIndex, /* Add, info or remove */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int index; const char *name, *command; size_t commandLength, length; - enum traceOptions { - TRACE_ADD, TRACE_INFO, TRACE_REMOVE - }; static const char *const opStrings[] = { "enter", "leave", "enterstep", "leavestep", NULL }; enum operations { TRACE_EXEC_ENTER, TRACE_EXEC_LEAVE, TRACE_EXEC_ENTER_STEP, TRACE_EXEC_LEAVE_STEP - }; + } index; - switch ((enum traceOptions) optionIndex) { + switch (optionIndex) { case TRACE_ADD: case TRACE_REMOVE: { int flags = 0; @@ -449,7 +446,7 @@ TraceExecutionObjCmd( "operation", TCL_EXACT, &index) != TCL_OK) { return TCL_ERROR; } - switch ((enum operations) index) { + switch (index) { case TRACE_EXEC_ENTER: flags |= TCL_TRACE_ENTER_EXEC; break; @@ -466,7 +463,7 @@ TraceExecutionObjCmd( } command = Tcl_GetStringFromObj(objv[5], &commandLength); length = commandLength; - if ((enum traceOptions) optionIndex == TRACE_ADD) { + if (optionIndex == TRACE_ADD) { TraceCommandInfo *tcmdPtr = (TraceCommandInfo *)Tcl_Alloc( offsetof(TraceCommandInfo, command) + 1 + length); @@ -619,6 +616,10 @@ TraceExecutionObjCmd( Tcl_SetObjResult(interp, resultListPtr); break; } +#ifndef TCL_REMOVE_OBSOLETE_TRACES + default: + break; +#endif } return TCL_OK; } @@ -645,18 +646,16 @@ TraceExecutionObjCmd( static int TraceCommandObjCmd( Tcl_Interp *interp, /* Current interpreter. */ - int optionIndex, /* Add, info or remove */ + enum traceOptions optionIndex, /* Add, info or remove */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int index; const char *name, *command; size_t commandLength, length; - enum traceOptions { TRACE_ADD, TRACE_INFO, TRACE_REMOVE }; static const char *const opStrings[] = { "delete", "rename", NULL }; - enum operations { TRACE_CMD_DELETE, TRACE_CMD_RENAME }; + enum operations { TRACE_CMD_DELETE, TRACE_CMD_RENAME } index; - switch ((enum traceOptions) optionIndex) { + switch (optionIndex) { case TRACE_ADD: case TRACE_REMOVE: { int flags = 0; @@ -691,7 +690,7 @@ TraceCommandObjCmd( "operation", TCL_EXACT, &index) != TCL_OK) { return TCL_ERROR; } - switch ((enum operations) index) { + switch (index) { case TRACE_CMD_RENAME: flags |= TCL_TRACE_RENAME; break; @@ -703,7 +702,7 @@ TraceCommandObjCmd( command = Tcl_GetStringFromObj(objv[5], &commandLength); length = commandLength; - if ((enum traceOptions) optionIndex == TRACE_ADD) { + if (optionIndex == TRACE_ADD) { TraceCommandInfo *tcmdPtr = (TraceCommandInfo *)Tcl_Alloc( offsetof(TraceCommandInfo, command) + 1 + length); @@ -813,6 +812,10 @@ TraceCommandObjCmd( Tcl_SetObjResult(interp, resultListPtr); break; } +#ifndef TCL_REMOVE_OBSOLETE_TRACES + default: + break; +#endif } return TCL_OK; } @@ -839,23 +842,21 @@ TraceCommandObjCmd( static int TraceVariableObjCmd( Tcl_Interp *interp, /* Current interpreter. */ - int optionIndex, /* Add, info or remove */ + enum traceOptions optionIndex, /* Add, info or remove */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int index; const char *name, *command; size_t commandLength, length; ClientData clientData; - enum traceOptions { TRACE_ADD, TRACE_INFO, TRACE_REMOVE }; static const char *const opStrings[] = { "array", "read", "unset", "write", NULL }; enum operations { TRACE_VAR_ARRAY, TRACE_VAR_READ, TRACE_VAR_UNSET, TRACE_VAR_WRITE - }; + } index; - switch ((enum traceOptions) optionIndex) { + switch (optionIndex) { case TRACE_ADD: case TRACE_REMOVE: { int flags = 0; @@ -889,7 +890,7 @@ TraceVariableObjCmd( "operation", TCL_EXACT, &index) != TCL_OK) { return TCL_ERROR; } - switch ((enum operations) index) { + switch (index) { case TRACE_VAR_ARRAY: flags |= TCL_TRACE_ARRAY; break; @@ -906,7 +907,7 @@ TraceVariableObjCmd( } command = Tcl_GetStringFromObj(objv[5], &commandLength); length = commandLength; - if ((enum traceOptions) optionIndex == TRACE_ADD) { + if (optionIndex == TRACE_ADD) { CombinedTraceVarInfo *ctvarPtr = (CombinedTraceVarInfo *)Tcl_Alloc( offsetof(CombinedTraceVarInfo, traceCmdInfo.command) + 1 + length); @@ -1005,6 +1006,10 @@ TraceVariableObjCmd( Tcl_SetObjResult(interp, resultListPtr); break; } +#ifndef TCL_REMOVE_OBSOLETE_TRACES + default: + break; +#endif } return TCL_OK; } diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 8b3c8a8..fa87a10 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -2237,7 +2237,7 @@ ZlibStreamSubcmd( enum zlibFormats { FMT_COMPRESS, FMT_DECOMPRESS, FMT_DEFLATE, FMT_GUNZIP, FMT_GZIP, FMT_INFLATE - }; + } fmt; int i, format, mode = 0, option, level; enum objIndices { OPT_COMPRESSION_DICTIONARY = 0, @@ -2278,7 +2278,7 @@ ZlibStreamSubcmd( return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[2], stream_formats, "mode", 0, - &format) != TCL_OK) { + &fmt) != TCL_OK) { return TCL_ERROR; } @@ -2287,7 +2287,7 @@ ZlibStreamSubcmd( * specified. */ - switch ((enum zlibFormats) format) { + switch (fmt) { case FMT_DEFLATE: desc = compressionOpts; mode = TCL_ZLIB_STREAM_DEFLATE; @@ -2397,7 +2397,7 @@ ZlibPushSubcmd( enum zlibFormats { FMT_COMPRESS, FMT_DECOMPRESS, FMT_DEFLATE, FMT_GUNZIP, FMT_GZIP, FMT_INFLATE - }; + } fmt; Tcl_Channel chan; int chanMode, format, mode = 0, level, i; static const char *const pushCompressOptions[] = { @@ -2417,10 +2417,10 @@ ZlibPushSubcmd( } if (Tcl_GetIndexFromObj(interp, objv[2], stream_formats, "mode", 0, - &format) != TCL_OK) { + &fmt) != TCL_OK) { return TCL_ERROR; } - switch ((enum zlibFormats) format) { + switch (fmt) { case FMT_DEFLATE: mode = TCL_ZLIB_STREAM_DEFLATE; format = TCL_ZLIB_FORMAT_RAW; |