summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-04-01 13:36:46 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-04-01 13:36:46 (GMT)
commitbbfcd52f865c1fe426d2a3b54b3d79ed39606af1 (patch)
treecfc02cf61fc3528110aeb751f04ef536ebcdc4e6
parentd0fec7532c33f0b3da8057e2e0fda10524f22905 (diff)
parent6dc1f8021ed597b13289a02c41c2e9660525a81a (diff)
downloadtcl-bbfcd52f865c1fe426d2a3b54b3d79ed39606af1.zip
tcl-bbfcd52f865c1fe426d2a3b54b3d79ed39606af1.tar.gz
tcl-bbfcd52f865c1fe426d2a3b54b3d79ed39606af1.tar.bz2
Rebase to Tcl 9.0
-rw-r--r--generic/regc_locale.c3
-rw-r--r--generic/tclCmdMZ.c28
-rw-r--r--generic/tclCompCmdsSZ.c10
-rw-r--r--generic/tclConfig.c6
-rw-r--r--generic/tclDictObj.c6
-rw-r--r--generic/tclDisassemble.c6
-rw-r--r--generic/tclEnsemble.c5
-rw-r--r--generic/tclEvent.c5
-rw-r--r--generic/tclFileName.c6
-rw-r--r--generic/tclIOCmd.c12
-rw-r--r--generic/tclLoad.c14
-rw-r--r--generic/tclOOBasic.c5
-rw-r--r--generic/tclOOInfo.c20
-rw-r--r--generic/tclPkg.c6
-rw-r--r--generic/tclProcess.c6
-rw-r--r--generic/tclTest.c29
-rw-r--r--generic/tclThreadTest.c5
-rw-r--r--generic/tclTrace.c5
-rw-r--r--generic/tclVar.c12
-rw-r--r--generic/tclZlib.c24
20 files changed, 104 insertions, 109 deletions
diff --git a/generic/regc_locale.c b/generic/regc_locale.c
index 73d4bf1..0847a8d 100644
--- a/generic/regc_locale.c
+++ b/generic/regc_locale.c
@@ -997,12 +997,11 @@ cclass(
const chr *endp, /* just past the end of the name */
int cases) /* case-independent? */
{
- size_t len;
+ size_t i, len;
struct cvec *cv = NULL;
Tcl_DString ds;
const char *np;
const char *const *namePtr;
- size_t i;
int index;
/*
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 85174ec..4d946ab 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -141,7 +141,7 @@ Tcl_RegexpObjCmd(
REGEXP_ALL, REGEXP_ABOUT, REGEXP_INDICES, REGEXP_INLINE,
REGEXP_EXPANDED,REGEXP_LINE, REGEXP_LINESTOP,REGEXP_LINEANCHOR,
REGEXP_NOCASE, REGEXP_START, REGEXP_LAST
- };
+ } index;
indices = 0;
about = 0;
@@ -152,7 +152,6 @@ Tcl_RegexpObjCmd(
for (i = 1; i < objc; i++) {
const char *name;
- int index;
name = TclGetString(objv[i]);
if (name[0] != '-') {
@@ -162,7 +161,7 @@ Tcl_RegexpObjCmd(
&index) != TCL_OK) {
goto optionError;
}
- switch ((enum regexpoptions) index) {
+ switch (index) {
case REGEXP_ALL:
all = 1;
break;
@@ -504,7 +503,7 @@ Tcl_RegsubObjCmd(
REGSUB_ALL, REGSUB_COMMAND, REGSUB_EXPANDED, REGSUB_LINE,
REGSUB_LINESTOP, REGSUB_LINEANCHOR, REGSUB_NOCASE, REGSUB_START,
REGSUB_LAST
- };
+ } index;
cflags = TCL_REG_ADVANCED;
all = 0;
@@ -514,7 +513,6 @@ Tcl_RegsubObjCmd(
for (idx = 1; idx < (size_t)objc; idx++) {
const char *name;
- int index;
name = TclGetString(objv[idx]);
if (name[0] != '-') {
@@ -524,7 +522,7 @@ Tcl_RegsubObjCmd(
TCL_EXACT, &index) != TCL_OK) {
goto optionError;
}
- switch ((enum regsubobjoptions) index) {
+ switch (index) {
case REGSUB_ALL:
all = 1;
break;
@@ -1525,7 +1523,7 @@ StringIsCmd(
{
const char *string1, *end, *stop;
int (*chcomp)(int) = NULL; /* The UniChar comparison function. */
- int i, result = 1, strict = 0, index, length3;
+ int i, result = 1, strict = 0, length3;
size_t failat = 0;
size_t length1, length2;
Tcl_Obj *objPtr, *failVarObj = NULL;
@@ -1546,13 +1544,13 @@ StringIsCmd(
STR_IS_LIST, STR_IS_LOWER, STR_IS_PRINT, STR_IS_PUNCT,
STR_IS_SPACE, STR_IS_TRUE, STR_IS_UPPER, STR_IS_UNICODE,
STR_IS_WIDE, STR_IS_WORD, STR_IS_XDIGIT
- };
+ } index;
static const char *const isOptions[] = {
"-strict", "-failindex", NULL
};
enum isOptionsEnum {
OPT_STRICT, OPT_FAILIDX
- };
+ } idx2;
if (objc < 3 || objc > 6) {
Tcl_WrongNumArgs(interp, 1, objv,
@@ -1566,13 +1564,11 @@ StringIsCmd(
if (objc != 3) {
for (i = 2; i < objc-1; i++) {
- int idx2;
-
if (Tcl_GetIndexFromObj(interp, objv[i], isOptions, "option", 0,
&idx2) != TCL_OK) {
return TCL_ERROR;
}
- switch ((enum isOptionsEnum) idx2) {
+ switch (idx2) {
case OPT_STRICT:
strict = 1;
break;
@@ -1601,7 +1597,7 @@ StringIsCmd(
* When entering here, result == 1 and failat == 0.
*/
- switch ((enum isClassesEnum) index) {
+ switch (index) {
case STR_IS_ALNUM:
chcomp = Tcl_UniCharIsAlnum;
break;
@@ -3426,7 +3422,7 @@ TclNRSwitchObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int i, index, mode, foundmode, splitObjs, numMatchesSaved;
+ int i, mode, foundmode, splitObjs, numMatchesSaved;
int noCase;
size_t patternLength, j;
const char *pattern;
@@ -3452,7 +3448,7 @@ TclNRSwitchObjCmd(
enum switchOptionsEnum {
OPT_EXACT, OPT_GLOB, OPT_INDEXV, OPT_MATCHV, OPT_NOCASE, OPT_REGEXP,
OPT_LAST
- };
+ } index;
typedef int (*strCmpFn_t)(const char *, const char *);
strCmpFn_t strCmpFn = TclUtfCmp;
@@ -3470,7 +3466,7 @@ TclNRSwitchObjCmd(
&index) != TCL_OK) {
return TCL_ERROR;
}
- switch ((enum switchOptionsEnum) index) {
+ switch (index) {
/*
* General options.
*/
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index 0dad757..64c6fcc 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -518,8 +518,8 @@ TclCompileStringIsCmd(
STR_IS_LIST, STR_IS_LOWER, STR_IS_PRINT, STR_IS_PUNCT,
STR_IS_SPACE, STR_IS_TRUE, STR_IS_UPPER, STR_IS_UNICODE,
STR_IS_WIDE, STR_IS_WORD, STR_IS_XDIGIT
- };
- int t, range, allowEmpty = 0, end;
+ } t;
+ int range, allowEmpty = 0, end;
InstStringClassType strClassType;
Tcl_Obj *isClass;
@@ -575,7 +575,7 @@ TclCompileStringIsCmd(
CompileWord(envPtr, tokenPtr, interp, parsePtr->numWords-1);
- switch ((enum isClassesEnum) t) {
+ switch (t) {
case STR_IS_ALNUM:
strClassType = STR_CLASS_ALNUM;
goto compileStrClass;
@@ -683,6 +683,8 @@ TclCompileStringIsCmd(
FIXJUMP1( over);
OP( LNOT);
return TCL_OK;
+ default:
+ break;
}
break;
@@ -748,6 +750,8 @@ TclCompileStringIsCmd(
PUSH( "3");
OP( LE);
break;
+ default:
+ break;
}
FIXJUMP1( end);
return TCL_OK;
diff --git a/generic/tclConfig.c b/generic/tclConfig.c
index 09b1b27..ee53461 100644
--- a/generic/tclConfig.c
+++ b/generic/tclConfig.c
@@ -200,13 +200,13 @@ QueryConfigObjCmd(
Tcl_Obj *pkgName = cdPtr->pkg;
Tcl_Obj *pDB, *pkgDict, *val, *listPtr;
size_t n = 0;
- int index, m;
+ int m;
static const char *const subcmdStrings[] = {
"get", "list", NULL
};
enum subcmds {
CFG_GET, CFG_LIST
- };
+ } index;
Tcl_DString conv;
Tcl_Encoding venc = NULL;
const char *value;
@@ -234,7 +234,7 @@ QueryConfigObjCmd(
return TCL_ERROR;
}
- switch ((enum subcmds) index) {
+ switch (index) {
case CFG_GET:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "key");
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index c316d4d..26a4586 100644
--- a/generic/tclDictObj.c
+++ b/generic/tclDictObj.c
@@ -2987,11 +2987,11 @@ DictFilterCmd(
};
enum FilterTypes {
FILTER_KEYS, FILTER_SCRIPT, FILTER_VALUES
- };
+ } index;
Tcl_Obj *scriptObj, *keyVarObj, *valueVarObj;
Tcl_Obj **varv, *keyObj = NULL, *valueObj = NULL, *resultObj, *boolObj;
Tcl_DictSearch search;
- int index, varc, done, result, satisfied;
+ int varc, done, result, satisfied;
const char *pattern;
if (objc < 3) {
@@ -3003,7 +3003,7 @@ DictFilterCmd(
return TCL_ERROR;
}
- switch ((enum FilterTypes) index) {
+ switch (index) {
case FILTER_KEYS:
/*
* Create a dictionary whose keys all match a certain pattern.
diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c
index f946221..1ab1af6 100644
--- a/generic/tclDisassemble.c
+++ b/generic/tclDisassemble.c
@@ -1279,8 +1279,8 @@ Tcl_DisassembleObjCmd(
DISAS_CLASS_CONSTRUCTOR, DISAS_CLASS_DESTRUCTOR,
DISAS_LAMBDA, DISAS_CLASS_METHOD, DISAS_OBJECT_METHOD, DISAS_PROC,
DISAS_SCRIPT
- };
- int idx, result;
+ } idx;
+ int result;
Tcl_Obj *codeObjPtr = NULL;
Proc *procPtr = NULL;
Tcl_HashEntry *hPtr;
@@ -1296,7 +1296,7 @@ Tcl_DisassembleObjCmd(
return TCL_ERROR;
}
- switch ((enum Types) idx) {
+ switch (idx) {
case DISAS_LAMBDA: {
Command cmd;
Tcl_Obj *nsObjPtr;
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 5949fe9..3a4ecd6 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -163,7 +163,8 @@ TclNamespaceEnsembleCmd(
Tcl_DictSearch search;
Tcl_Obj *listObj;
const char *simpleName;
- int index, done;
+ enum EnsSubcmds index;
+ int done;
if (nsPtr == NULL || nsPtr->flags & NS_DEAD) {
if (!Tcl_InterpDeleted(interp)) {
@@ -184,7 +185,7 @@ TclNamespaceEnsembleCmd(
return TCL_ERROR;
}
- switch ((enum EnsSubcmds) index) {
+ switch (index) {
case ENS_CREATE: {
const char *name;
int len, allocatedMapFlag = 0;
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index acc74f8..49c61da 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -1572,10 +1572,9 @@ Tcl_UpdateObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int optionIndex;
int flags = 0; /* Initialized to avoid compiler warning. */
static const char *const updateOptions[] = {"idletasks", NULL};
- enum updateOptionsEnum {OPT_IDLETASKS};
+ enum updateOptionsEnum {OPT_IDLETASKS} optionIndex;
if (objc == 1) {
flags = TCL_ALL_EVENTS|TCL_DONT_WAIT;
@@ -1584,7 +1583,7 @@ Tcl_UpdateObjCmd(
"option", 0, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
- switch ((enum updateOptionsEnum) optionIndex) {
+ switch (optionIndex) {
case OPT_IDLETASKS:
flags = TCL_IDLE_EVENTS|TCL_DONT_WAIT;
break;
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 67c0048..7980878 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -1230,7 +1230,7 @@ Tcl_GlobObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int index, i, globFlags, length, join, dir, result;
+ int i, globFlags, length, join, dir, result;
char *string;
const char *separators;
Tcl_Obj *typePtr, *look;
@@ -1243,7 +1243,7 @@ Tcl_GlobObjCmd(
enum globOptionsEnum {
GLOB_DIR, GLOB_JOIN, GLOB_NOCOMPLAIN, GLOB_PATH, GLOB_TAILS,
GLOB_TYPE, GLOB_LAST
- };
+ } index;
enum pathDirOptions {PATH_NONE = -1 , PATH_GENERAL = 0, PATH_DIR = 1};
Tcl_GlobTypeData *globTypes = NULL;
@@ -1273,7 +1273,7 @@ Tcl_GlobObjCmd(
}
}
- switch ((enum globOptionsEnum) index) {
+ switch (index) {
case GLOB_NOCOMPLAIN: /* -nocomplain */
globFlags |= TCL_GLOBMODE_NO_COMPLAIN;
break;
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index 61aa585..2728637 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -1446,8 +1446,8 @@ Tcl_SocketObjCmd(
enum socketOptionsEnum {
SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_REUSEADDR, SKT_REUSEPORT,
SKT_SERVER
- };
- int optionIndex, a, server = 0, myport = 0, async = 0, reusep = -1,
+ } optionIndex;
+ int a, server = 0, myport = 0, async = 0, reusep = -1,
reusea = -1;
unsigned int flags = 0;
const char *host, *port, *myaddr = NULL;
@@ -1468,7 +1468,7 @@ Tcl_SocketObjCmd(
TCL_EXACT, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
- switch ((enum socketOptionsEnum) optionIndex) {
+ switch (optionIndex) {
case SKT_ASYNC:
if (server == 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -1777,9 +1777,9 @@ ChanPendingObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Channel chan;
- int index, mode;
+ int mode;
static const char *const options[] = {"input", "output", NULL};
- enum pendingOptionsEnum {PENDING_INPUT, PENDING_OUTPUT};
+ enum pendingOptionsEnum {PENDING_INPUT, PENDING_OUTPUT} index;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "mode channelId");
@@ -1795,7 +1795,7 @@ ChanPendingObjCmd(
return TCL_ERROR;
}
- switch ((enum pendingOptionsEnum) index) {
+ switch (index) {
case PENDING_INPUT:
if (!(mode & TCL_READABLE)) {
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(-1));
diff --git a/generic/tclLoad.c b/generic/tclLoad.c
index 88f4724..4017438 100644
--- a/generic/tclLoad.c
+++ b/generic/tclLoad.c
@@ -141,14 +141,14 @@ Tcl_LoadObjCmd(
Tcl_LoadHandle loadHandle;
Tcl_UniChar ch = 0;
size_t len;
- int index, flags = 0;
+ int flags = 0;
Tcl_Obj *const *savedobjv = objv;
static const char *const options[] = {
"-global", "-lazy", "--", NULL
};
enum loadOptionsEnum {
LOAD_GLOBAL, LOAD_LAZY, LOAD_LAST
- };
+ } index;
while (objc > 2) {
if (TclGetString(objv[1])[0] != '-') {
@@ -159,9 +159,9 @@ Tcl_LoadObjCmd(
return TCL_ERROR;
}
++objv; --objc;
- if (LOAD_GLOBAL == (enum loadOptionsEnum) index) {
+ if (LOAD_GLOBAL == index) {
flags |= TCL_LOAD_GLOBAL;
- } else if (LOAD_LAZY == (enum loadOptionsEnum) index) {
+ } else if (LOAD_LAZY == index) {
flags |= TCL_LOAD_LAZY;
} else {
break;
@@ -559,7 +559,7 @@ Tcl_UnloadObjCmd(
LoadedLibrary *libraryPtr;
Tcl_DString pfx, tmp;
InterpLibrary *ipFirstPtr, *ipPtr;
- int i, index, code, complain = 1, keepLibrary = 0;
+ int i, code, complain = 1, keepLibrary = 0;
const char *fullFileName = "";
const char *prefix;
static const char *const options[] = {
@@ -567,7 +567,7 @@ Tcl_UnloadObjCmd(
};
enum unloadOptionsEnum {
UNLOAD_NOCOMPLAIN, UNLOAD_KEEPLIB, UNLOAD_LAST
- };
+ } index;
for (i = 1; i < objc; i++) {
if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
@@ -590,7 +590,7 @@ Tcl_UnloadObjCmd(
break;
}
}
- switch ((enum unloadOptionsEnum)index) {
+ switch (index) {
case UNLOAD_NOCOMPLAIN: /* -nocomplain */
complain = 0;
break;
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c
index 41ce034..83c2dc0 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.c
@@ -1045,12 +1045,11 @@ TclOOSelfObjCmd(
enum SelfCmds {
SELF_CALL, SELF_CALLER, SELF_CLASS, SELF_FILTER, SELF_METHOD, SELF_NS,
SELF_NEXT, SELF_OBJECT, SELF_TARGET
- };
+ } index;
Interp *iPtr = (Interp *) interp;
CallFrame *framePtr = iPtr->varFramePtr;
CallContext *contextPtr;
Tcl_Obj *result[3];
- int index;
#define CurrentlyInvoked(contextPtr) \
((contextPtr)->callPtr->chain[(contextPtr)->index])
@@ -1084,7 +1083,7 @@ TclOOSelfObjCmd(
return TCL_ERROR;
}
- switch ((enum SelfCmds) index) {
+ switch (index) {
case SELF_OBJECT:
Tcl_SetObjResult(interp, TclOOObjectName(interp, contextPtr->oPtr));
return TCL_OK;
diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c
index ede00b8..86018dd 100644
--- a/generic/tclOOInfo.c
+++ b/generic/tclOOInfo.c
@@ -408,9 +408,9 @@ InfoObjectIsACmd(
};
enum IsACats {
IsClass, IsMetaclass, IsMixin, IsObject, IsType
- };
+ } idx;
Object *oPtr, *o2Ptr;
- int idx, i, result = 0;
+ int i, result = 0;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "category objName ?arg ...?");
@@ -426,7 +426,7 @@ InfoObjectIsACmd(
* number of arguments.
*/
- switch ((enum IsACats) idx) {
+ switch (idx) {
case IsObject:
case IsClass:
case IsMetaclass:
@@ -454,7 +454,7 @@ InfoObjectIsACmd(
goto failPrecondition;
}
- switch ((enum IsACats) idx) {
+ switch (idx) {
case IsObject:
result = 1;
break;
@@ -532,7 +532,7 @@ InfoObjectMethodsCmd(
};
enum Options {
OPT_ALL, OPT_LOCALPRIVATE, OPT_PRIVATE, OPT_SCOPE
- };
+ } idx;
static const char *const scopes[] = {
"private", "public", "unexported"
};
@@ -550,14 +550,14 @@ InfoObjectMethodsCmd(
return TCL_ERROR;
}
if (objc != 2) {
- int i, idx;
+ int i;
for (i=2 ; i<objc ; i++) {
if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
&idx) != TCL_OK) {
return TCL_ERROR;
}
- switch ((enum Options) idx) {
+ switch (idx) {
case OPT_ALL:
recurse = 1;
break;
@@ -1291,7 +1291,7 @@ InfoClassMethodsCmd(
};
enum Options {
OPT_ALL, OPT_LOCALPRIVATE, OPT_PRIVATE, OPT_SCOPE
- };
+ } idx;
static const char *const scopes[] = {
"private", "public", "unexported"
};
@@ -1308,14 +1308,14 @@ InfoClassMethodsCmd(
return TCL_ERROR;
}
if (objc != 2) {
- int i, idx;
+ int i;
for (i=2 ; i<objc ; i++) {
if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
&idx) != TCL_OK) {
return TCL_ERROR;
}
- switch ((enum Options) idx) {
+ switch (idx) {
case OPT_ALL:
recurse = 1;
break;
diff --git a/generic/tclPkg.c b/generic/tclPkg.c
index 2871068..4297207 100644
--- a/generic/tclPkg.c
+++ b/generic/tclPkg.c
@@ -1077,9 +1077,9 @@ TclNRPackageObjCmd(
PKG_FILES, PKG_FORGET, PKG_IFNEEDED, PKG_NAMES, PKG_PREFER,
PKG_PRESENT, PKG_PROVIDE, PKG_REQUIRE, PKG_UNKNOWN, PKG_VCOMPARE,
PKG_VERSIONS, PKG_VSATISFIES
- };
+ } optionIndex;
Interp *iPtr = (Interp *) interp;
- int optionIndex, exact, i, newobjc, satisfies;
+ int exact, i, newobjc, satisfies;
PkgAvail *availPtr, *prevPtr;
Package *pkgPtr;
Tcl_HashEntry *hPtr;
@@ -1099,7 +1099,7 @@ TclNRPackageObjCmd(
&optionIndex) != TCL_OK) {
return TCL_ERROR;
}
- switch ((enum pkgOptionsEnum) optionIndex) {
+ switch (optionIndex) {
case PKG_FILES: {
PkgFiles *pkgFiles;
diff --git a/generic/tclProcess.c b/generic/tclProcess.c
index c7139aa..a76ede5 100644
--- a/generic/tclProcess.c
+++ b/generic/tclProcess.c
@@ -459,7 +459,7 @@ ProcessStatusObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *dict;
- int index, options = WNOHANG;
+ int options = WNOHANG;
Tcl_HashEntry *entry;
Tcl_HashSearch search;
ProcessInfo *info;
@@ -474,7 +474,7 @@ ProcessStatusObjCmd(
};
enum switchesEnum {
STATUS_WAIT, STATUS_LAST
- };
+ } index;
while (objc > 1) {
if (TclGetString(objv[1])[0] != '-') {
@@ -485,7 +485,7 @@ ProcessStatusObjCmd(
return TCL_ERROR;
}
++objv; --objc;
- if (STATUS_WAIT == (enum switchesEnum) index) {
+ if (STATUS_WAIT == index) {
options = 0;
} else {
break;
diff --git a/generic/tclTest.c b/generic/tclTest.c
index f1b95b6..485d15d 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -1923,7 +1923,7 @@ TestencodingObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Encoding encoding;
- int index, length;
+ int length;
const char *string;
TclEncoding *encodingPtr;
static const char *const optionStrings[] = {
@@ -1931,14 +1931,14 @@ TestencodingObjCmd(
};
enum options {
ENC_CREATE, ENC_DELETE
- };
+ } index;
if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
&index) != TCL_OK) {
return TCL_ERROR;
}
- switch ((enum options) index) {
+ switch (index) {
case ENC_CREATE: {
Tcl_EncodingType type;
@@ -3290,7 +3290,7 @@ TestlinkarrayCmd(
static const char *LinkOption[] = {
"update", "remove", "create", NULL
};
- enum LinkOptionEnum { LINK_UPDATE, LINK_REMOVE, LINK_CREATE };
+ enum LinkOptionEnum {LINK_UPDATE, LINK_REMOVE, LINK_CREATE} optionIndex;
static const char *LinkType[] = {
"char", "uchar", "short", "ushort", "int", "uint", "long", "ulong",
"wide", "uwide", "float", "double", "string", "char*", "binary", NULL
@@ -3303,7 +3303,7 @@ TestlinkarrayCmd(
TCL_LINK_FLOAT, TCL_LINK_DOUBLE, TCL_LINK_STRING, TCL_LINK_CHARS,
TCL_LINK_BINARY
};
- int optionIndex, typeIndex, readonly, i, size, length;
+ int typeIndex, readonly, i, size, length;
char *name, *arg;
Tcl_WideInt addr;
@@ -3315,7 +3315,7 @@ TestlinkarrayCmd(
&optionIndex) != TCL_OK) {
return TCL_ERROR;
}
- switch ((enum LinkOptionEnum) optionIndex) {
+ switch (optionIndex) {
case LINK_UPDATE:
for (i=2; i<objc; i++) {
Tcl_UpdateLinkedVar(interp, Tcl_GetString(objv[i]));
@@ -3888,7 +3888,7 @@ TestregexpObjCmd(
REGEXP_MULTI, REGEXP_NOCROSS, REGEXP_NEWL,
REGEXP_XFLAGS,
REGEXP_LAST
- };
+ } index;
indices = 0;
about = 0;
@@ -3898,7 +3898,6 @@ TestregexpObjCmd(
for (i = 1; i < objc; i++) {
const char *name;
- int index;
name = Tcl_GetString(objv[i]);
if (name[0] != '-') {
@@ -3908,7 +3907,7 @@ TestregexpObjCmd(
&index) != TCL_OK) {
return TCL_ERROR;
}
- switch ((enum optionsEnum) index) {
+ switch (index) {
case REGEXP_INDICES:
indices = 1;
break;
@@ -5281,7 +5280,7 @@ TestsaveresultCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
- int discard, result, index;
+ int discard, result;
Tcl_SavedResult state;
Tcl_Obj *objPtr;
static const char *const optionStrings[] = {
@@ -5289,7 +5288,7 @@ TestsaveresultCmd(
};
enum options {
RESULT_APPEND, RESULT_DYNAMIC, RESULT_FREE, RESULT_OBJECT, RESULT_SMALL
- };
+ } index;
/*
* Parse arguments
@@ -5308,8 +5307,8 @@ TestsaveresultCmd(
}
freeCount = 0;
- objPtr = NULL; /* Lint. */
- switch ((enum options) index) {
+ objPtr = NULL;
+ switch (index) {
case RESULT_SMALL:
Tcl_AppendResult(interp, "small result", NULL);
break;
@@ -5334,7 +5333,7 @@ TestsaveresultCmd(
Tcl_SaveResult(interp, &state);
- if (((enum options) index) == RESULT_OBJECT) {
+ if (index == RESULT_OBJECT) {
result = Tcl_EvalObjEx(interp, objv[2], 0);
} else {
result = Tcl_EvalEx(interp, Tcl_GetString(objv[2]), -1, 0);
@@ -5347,7 +5346,7 @@ TestsaveresultCmd(
result = TCL_OK;
}
- switch ((enum options) index) {
+ switch (index) {
case RESULT_DYNAMIC:
Tcl_AppendElement(interp, freeCount ? "freed" : "leak");
break;
diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c
index f440ec0..984a583 100644
--- a/generic/tclThreadTest.c
+++ b/generic/tclThreadTest.c
@@ -211,7 +211,6 @@ ThreadObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- int option;
static const char *const threadOptions[] = {
"cancel", "create", "event", "exit", "id",
"join", "names", "send", "wait", "errorproc",
@@ -221,7 +220,7 @@ ThreadObjCmd(
THREAD_CANCEL, THREAD_CREATE, THREAD_EVENT, THREAD_EXIT,
THREAD_ID, THREAD_JOIN, THREAD_NAMES, THREAD_SEND,
THREAD_WAIT, THREAD_ERRORPROC
- };
+ } option;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
@@ -244,7 +243,7 @@ ThreadObjCmd(
Tcl_MutexUnlock(&threadMutex);
}
- switch ((enum options)option) {
+ switch (option) {
case THREAD_CANCEL: {
Tcl_WideInt id;
const char *result;
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index bc4cbfc..a039f66 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -188,7 +188,6 @@ Tcl_TraceObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int optionIndex;
#ifndef TCL_REMOVE_OBSOLETE_TRACES
const char *name;
const char *flagOps, *p;
@@ -207,7 +206,7 @@ Tcl_TraceObjCmd(
#ifndef TCL_REMOVE_OBSOLETE_TRACES
TRACE_OLD_VARIABLE, TRACE_OLD_VDELETE, TRACE_OLD_VINFO
#endif
- };
+ } optionIndex;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
@@ -218,7 +217,7 @@ Tcl_TraceObjCmd(
&optionIndex) != TCL_OK) {
return TCL_ERROR;
}
- switch ((enum traceOptionsEnum) optionIndex) {
+ switch (optionIndex) {
case TRACE_ADD:
case TRACE_REMOVE: {
/*
diff --git a/generic/tclVar.c b/generic/tclVar.c
index a90a194..71489e1 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -3771,12 +3771,12 @@ ArrayNamesCmd(
static const char *const options[] = {
"-exact", "-glob", "-regexp", NULL
};
- enum arrayNamesOptionsEnum { OPT_EXACT, OPT_GLOB, OPT_REGEXP };
+ enum arrayNamesOptionsEnum {OPT_EXACT, OPT_GLOB, OPT_REGEXP} mode = OPT_GLOB;
Var *varPtr, *varPtr2;
Tcl_Obj *nameObj, *resultObj, *patternObj;
Tcl_HashSearch search;
const char *pattern = NULL;
- int isArray, mode = OPT_GLOB;
+ int isArray;
if ((objc < 2) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 1, objv, "arrayName ?mode? ?pattern?");
@@ -3839,7 +3839,7 @@ ArrayNamesCmd(
const char *name = TclGetString(nameObj);
int matched = 0;
- switch ((enum arrayNamesOptionsEnum) mode) {
+ switch (mode) {
case OPT_EXACT:
Tcl_Panic("exact matching shouldn't get here");
case OPT_GLOB:
@@ -6436,10 +6436,10 @@ ArrayDefaultCmd(
static const char *const options[] = {
"get", "set", "exists", "unset", NULL
};
- enum arrayDefaultOptionsEnum { OPT_GET, OPT_SET, OPT_EXISTS, OPT_UNSET };
+ enum arrayDefaultOptionsEnum { OPT_GET, OPT_SET, OPT_EXISTS, OPT_UNSET } option;
Tcl_Obj *arrayNameObj, *defaultValueObj;
Var *varPtr, *arrayPtr;
- int isArray, option;
+ int isArray;
/*
* Parse arguments.
@@ -6460,7 +6460,7 @@ ArrayDefaultCmd(
return TCL_ERROR;
}
- switch ((enum arrayDefaultOptionsEnum)option) {
+ switch (option) {
case OPT_GET:
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "arrayName");
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index ebff94b..046140a 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -2399,7 +2399,7 @@ ZlibPushSubcmd(
FMT_INFLATE
};
Tcl_Channel chan;
- int chanMode, format, mode = 0, level, i, option;
+ int chanMode, format, mode = 0, level, i;
static const char *const pushCompressOptions[] = {
"-dictionary", "-header", "-level", NULL
};
@@ -2407,7 +2407,7 @@ ZlibPushSubcmd(
"-dictionary", "-header", "-level", "-limit", NULL
};
const char *const *pushOptions = pushDecompressOptions;
- enum pushOptionsEnum {poDictionary, poHeader, poLevel, poLimit};
+ enum pushOptionsEnum {poDictionary, poHeader, poLevel, poLimit} option;
Tcl_Obj *headerObj = NULL, *compDictObj = NULL;
int limit = DEFAULT_BUFFER_SIZE, dummy;
@@ -2489,7 +2489,7 @@ ZlibPushSubcmd(
Tcl_SetErrorCode(interp, "TCL", "ZIP", "NOVAL", NULL);
return TCL_ERROR;
}
- switch ((enum pushOptionsEnum) option) {
+ switch (option) {
case poHeader:
headerObj = objv[i];
if (Tcl_DictObjSize(interp, headerObj, &dummy) != TCL_OK) {
@@ -2569,7 +2569,7 @@ ZlibStreamCmd(
Tcl_Obj *const objv[])
{
Tcl_ZlibStream zstream = (Tcl_ZlibStream)cd;
- int command, count, code;
+ int count, code;
Tcl_Obj *obj;
static const char *const cmds[] = {
"add", "checksum", "close", "eof", "finalize", "flush",
@@ -2579,7 +2579,7 @@ ZlibStreamCmd(
enum zlibStreamCommands {
zs_add, zs_checksum, zs_close, zs_eof, zs_finalize, zs_flush,
zs_fullflush, zs_get, zs_header, zs_put, zs_reset
- };
+ } command;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option data ?...?");
@@ -2591,7 +2591,7 @@ ZlibStreamCmd(
return TCL_ERROR;
}
- switch ((enum zlibStreamCommands) command) {
+ switch (command) {
case zs_add: /* $strm add ?$flushopt? $data */
return ZlibStreamAddCmd(zstream, interp, objc, objv);
case zs_header: /* $strm header */
@@ -2695,14 +2695,14 @@ ZlibStreamAddCmd(
Tcl_Obj *const objv[])
{
Tcl_ZlibStream zstream = (Tcl_ZlibStream)cd;
- int index, code, buffersize = -1, flush = -1, i;
+ int code, buffersize = -1, flush = -1, i;
Tcl_Obj *obj, *compDictObj = NULL;
static const char *const add_options[] = {
"-buffer", "-dictionary", "-finalize", "-flush", "-fullflush", NULL
};
enum addOptions {
ao_buffer, ao_dictionary, ao_finalize, ao_flush, ao_fullflush
- };
+ } index;
for (i=2; i<objc-1; i++) {
if (Tcl_GetIndexFromObj(interp, objv[i], add_options, "option", 0,
@@ -2710,7 +2710,7 @@ ZlibStreamAddCmd(
return TCL_ERROR;
}
- switch ((enum addOptions) index) {
+ switch (index) {
case ao_flush: /* -flush */
if (flush >= 0) {
flush = -2;
@@ -2822,14 +2822,14 @@ ZlibStreamPutCmd(
Tcl_Obj *const objv[])
{
Tcl_ZlibStream zstream = (Tcl_ZlibStream)cd;
- int index, flush = -1, i;
+ int flush = -1, i;
Tcl_Obj *compDictObj = NULL;
static const char *const put_options[] = {
"-dictionary", "-finalize", "-flush", "-fullflush", NULL
};
enum putOptions {
po_dictionary, po_finalize, po_flush, po_fullflush
- };
+ } index;
for (i=2; i<objc-1; i++) {
if (Tcl_GetIndexFromObj(interp, objv[i], put_options, "option", 0,
@@ -2837,7 +2837,7 @@ ZlibStreamPutCmd(
return TCL_ERROR;
}
- switch ((enum putOptions) index) {
+ switch (index) {
case po_flush: /* -flush */
if (flush >= 0) {
flush = -2;