Index: generic/tcl.h ================================================================== --- generic/tcl.h +++ generic/tcl.h @@ -1249,11 +1249,11 @@ /* * Positions to pass to Tcl_QueueEvent/Tcl_ThreadQueueEvent: */ -typedef enum { +typedef enum Tcl_QueuePosition { TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK, TCL_QUEUE_ALERT_IF_EMPTY=4 } Tcl_QueuePosition; /* Index: generic/tclAssembly.c ================================================================== --- generic/tclAssembly.c +++ generic/tclAssembly.c @@ -125,11 +125,11 @@ /* * Source instruction type recognized by the assembler. */ -typedef enum { +typedef enum TalInstType { ASSEM_1BYTE, /* Fixed arity, 1-byte instruction */ ASSEM_BEGIN_CATCH, /* Begin catch: one 4-byte jump offset to be * converted to appropriate exception * ranges */ ASSEM_BOOL, /* One Boolean operand */ Index: generic/tclBinary.c ================================================================== --- generic/tclBinary.c +++ generic/tclBinary.c @@ -2456,11 +2456,11 @@ unsigned char *data, *datastart, *dataend; unsigned char *begin, *cursor, c; int i, index, value, pure = 1, strict = 0; Tcl_Size size, cut = 0, count = 0; int ucs4; - enum {OPT_STRICT }; + enum Option { OPT_STRICT }; static const char *const optStrings[] = { "-strict", NULL }; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "?options? data"); return TCL_ERROR; @@ -2584,11 +2584,11 @@ Tcl_WideInt maxlen = 0; const char *wrapchar = "\n"; Tcl_Size wrapcharlen = 1; int index, purewrap = 1; Tcl_Size i, offset, size, outindex = 0, count = 0; - enum { OPT_MAXLEN, OPT_WRAPCHAR }; + enum Option { OPT_MAXLEN, OPT_WRAPCHAR }; static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL }; if (objc < 2 || objc % 2 != 0) { Tcl_WrongNumArgs(interp, 1, objv, "?-maxlen len? ?-wrapchar char? data"); @@ -2713,11 +2713,11 @@ unsigned int n; int lineLength = 61; const unsigned char SingleNewline[] = { UCHAR('\n') }; const unsigned char *wrapchar = SingleNewline; Tcl_Size j, rawLength, offset, count = 0, wrapcharlen = sizeof(SingleNewline); - enum { OPT_MAXLEN, OPT_WRAPCHAR } index; + enum Option { OPT_MAXLEN, OPT_WRAPCHAR } index; static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL }; if (objc < 2 || objc % 2 != 0) { Tcl_WrongNumArgs(interp, 1, objv, "?-maxlen len? ?-wrapchar char? data"); @@ -2862,11 +2862,11 @@ unsigned char *begin, *cursor; int i, index, pure = 1, strict = 0, lineLen; Tcl_Size size, count = 0; unsigned char c; int ucs4; - enum { OPT_STRICT }; + enum Option { OPT_STRICT }; static const char *const optStrings[] = { "-strict", NULL }; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "?options? data"); return TCL_ERROR; @@ -3039,11 +3039,11 @@ unsigned char *cursor = NULL; int pure = 1, strict = 0; int i, index, cut = 0; Tcl_Size size, count = 0; int ucs4; - enum { OPT_STRICT }; + enum Option { OPT_STRICT }; static const char *const optStrings[] = { "-strict", NULL }; if (objc < 2 || objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "?options? data"); return TCL_ERROR; Index: generic/tclCmdIL.c ================================================================== --- generic/tclCmdIL.c +++ generic/tclCmdIL.c @@ -100,14 +100,14 @@ * Definitions for [lseq] command */ static const char *const seq_operations[] = { "..", "to", "count", "by", NULL }; -typedef enum { +typedef enum SequenceOperators { LSEQ_DOTS, LSEQ_TO, LSEQ_COUNT, LSEQ_BY } SequenceOperators; -typedef enum { +typedef enum SequenceDecoded { NoneArg, NumericArg, RangeKeywordArg, ErrArg, LastArg = 8 } SequenceDecoded; /* * Forward declarations for procedures defined in this file: Index: generic/tclCompile.h ================================================================== --- generic/tclCompile.h +++ generic/tclCompile.h @@ -105,11 +105,11 @@ * for the "next" subcommands of for loops since a break there terminates the * for command. This means a for command actually generates two LoopInfo * structures. */ -typedef enum { +typedef enum ExceptionRangeType { LOOP_EXCEPTION_RANGE, /* Exception's range is part of a loop. Break * and continue "exceptions" cause jumps to * appropriate PC offsets. */ CATCH_EXCEPTION_RANGE /* Exception's range is controlled by a catch * command. Errors in the range cause a jump @@ -1038,11 +1038,11 @@ * replace the single-byte jump with a four byte jump instruction, move the * instructions after the jump down, and update the code offsets for any * commands between the jump and the target. */ -typedef enum { +typedef enum TclJumpType { TCL_UNCONDITIONAL_JUMP, TCL_TRUE_JUMP, TCL_FALSE_JUMP } TclJumpType; Index: generic/tclIOCmd.c ================================================================== --- generic/tclIOCmd.c +++ generic/tclIOCmd.c @@ -1819,11 +1819,11 @@ Tcl_Channel inChan, outChan; int mode, i, index; Tcl_WideInt toRead; Tcl_Obj *cmdPtr; static const char *const switches[] = { "-size", "-command", NULL }; - enum { FcopySize, FcopyCommand }; + enum FcopySwitch { FcopySize, FcopyCommand }; if ((objc < 3) || (objc > 7) || (objc == 4) || (objc == 6)) { Tcl_WrongNumArgs(interp, 1, objv, "input output ?-size size? ?-command callback?"); return TCL_ERROR; Index: generic/tclIORChan.c ================================================================== --- generic/tclIORChan.c +++ generic/tclIORChan.c @@ -148,11 +148,11 @@ */ static const char *const eventOptions[] = { "read", "write", NULL }; -typedef enum { +typedef enum EventOption { EVENT_READ, EVENT_WRITE } EventOption; /* * Method literals. ================================================== @@ -170,11 +170,11 @@ "truncate", /* OPT */ "watch", /* */ "write", /* OPT */ NULL }; -typedef enum { +typedef enum MethodName { METH_BLOCKING, METH_CGET, METH_CGETALL, METH_CONFIGURE, METH_FINAL, @@ -211,11 +211,11 @@ /* * Enumeration of all operations which can be forwarded. */ -typedef enum { +typedef enum ForwardedOperation { ForwardedClose, ForwardedInput, ForwardedOutput, ForwardedSeek, ForwardedWatch, Index: generic/tclIORTrans.c ================================================================== --- generic/tclIORTrans.c +++ generic/tclIORTrans.c @@ -189,11 +189,11 @@ "limit?", /* OPT */ "read", /* OPT */ "write", /* OPT */ NULL }; -typedef enum { +typedef enum MethodName { METH_CLEAR, METH_DRAIN, METH_FINAL, METH_FLUSH, METH_INIT, @@ -222,11 +222,11 @@ /* * Enumeration of all operations which can be forwarded. */ -typedef enum { +typedef enum ForwardedOperation { ForwardedClear, ForwardedClose, ForwardedDrain, ForwardedFlush, ForwardedInput, Index: generic/tclIcu.c ================================================================== --- generic/tclIcu.c +++ generic/tclIcu.c @@ -33,11 +33,11 @@ } UErrorCodex; #define U_SUCCESS(x) ((x)<=U_ZERO_ERRORZ) #define U_FAILURE(x) ((x)>U_ZERO_ERRORZ) -typedef enum { +typedef enum UConverterCallbackReasonx { UCNV_UNASSIGNED = 0, UCNV_ILLEGAL = 1, UCNV_IRREGULAR = 2, UCNV_RESET = 3, UCNV_CLOSE = 4, @@ -255,12 +255,13 @@ TCL_DECLARE_MUTEX(icu_mutex); /* Options used by multiple normalization functions */ static const char *normalizationForms[] = {"nfc", "nfd", "nfkc", "nfkd", NULL}; -typedef enum { MODE_NFC, MODE_NFD, MODE_NFKC, MODE_NFKD } NormalizationMode; - +typedef enum NormalizationMode { + MODE_NFC, MODE_NFD, MODE_NFKC, MODE_NFKD +} NormalizationMode; /* Error handlers. */ static int FunctionNotAvailableError( @@ -965,11 +966,11 @@ objc -= 2; /* truncate fixed arguments */ /* Use GetIndexFromObj for option parsing so -failindex can be added later */ static const char *optNames[] = {"-profile", "-failindex", NULL}; - enum { OPT_PROFILE, OPT_FAILINDEX } opt; + enum Option { OPT_PROFILE, OPT_FAILINDEX } opt; int i; int strict = 1; for (i = 1; i < objc; ++i) { if (Tcl_GetIndexFromObj( interp, objv[i], optNames, "option", 0, &opt) != TCL_OK) { @@ -1128,11 +1129,11 @@ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *optNames[] = {"-profile", "-mode", NULL}; - enum { OPT_PROFILE, OPT_MODE } opt; + enum Option { OPT_PROFILE, OPT_MODE } opt; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "?-profile PROFILE? ?-mode MODE? STRING"); return TCL_ERROR; } Index: generic/tclInt.h ================================================================== --- generic/tclInt.h +++ generic/tclInt.h @@ -524,11 +524,11 @@ * the length of the list in the parameterList * field. */ } EnsembleConfig; /* - * Various bits for the EnsembleConfig.flags field. + * Various bits for the EnsembleConfig::flags field. */ enum EnsembleConfigFlags { ENSEMBLE_DEAD = 0x1, /* Flag value to say that the ensemble is dead * and on its way out. */ ENSEMBLE_COMPILE = 0x4 /* Flag to enable bytecode compilation of an @@ -2453,15 +2453,17 @@ * that the script in progress has been * canceled thereby allowing the evaluation * stack for the interp to be fully unwound. */ }; +#ifndef MAX_NESTING_DEPTH /* * Default maximum number of levels of nesting permitted in Tcl commands (used * to catch infinite recursion). */ #define MAX_NESTING_DEPTH 1000 +#endif /* * The macro below is used to modify a "char" value (e.g. by casting it to an * unsigned character) so that it can be used safely with macros such as * isspace. @@ -2521,11 +2523,11 @@ /* * The following enum values are used to specify the runtime platform setting * of the tclPlatform variable. */ -typedef enum { +typedef enum TclPlatformType { TCL_PLATFORM_UNIX = 0, /* Any Unix-like OS. */ TCL_PLATFORM_WINDOWS = 2 /* Any Microsoft Windows OS. */ } TclPlatformType; /* @@ -2585,12 +2587,13 @@ size_t refCount; /* Number of references to this instance. */ int flags; /* LISTSTORE_* flags */ Tcl_Obj *slots[TCLFLEXARRAY]; /* Variable size array. Grown as needed */ } ListStore; + enum ListStoreFlags { - LISTSTORE_CANONICAL = 1 /* All Tcl_Obj's referencing this + LISTSTORE_CANONICAL = 0x1 /* All Tcl_Obj's referencing this * store have their string representation * derived from the list representation */ }; /* Max number of elements that can be contained in a list */ Index: generic/tclMain.c ================================================================== --- generic/tclMain.c +++ generic/tclMain.c @@ -88,11 +88,11 @@ * Structure definition for information used to keep the state of an * interactive command processor that reads lines from standard input and * writes prompts and results to standard output. */ -typedef enum { +typedef enum PromptType { PROMPT_NONE, /* Print no prompt */ PROMPT_START, /* Print prompt for command start */ PROMPT_CONTINUE /* Print prompt for command continuation */ } PromptType; Index: generic/tclNamesp.c ================================================================== --- generic/tclNamesp.c +++ generic/tclNamesp.c @@ -4718,11 +4718,11 @@ Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const opts[] = { "-command", "-variable", NULL }; - enum { OPT_COMMAND, OPT_VARIABLE } lookupType = OPT_COMMAND; + enum WhichOpt { OPT_COMMAND, OPT_VARIABLE } lookupType = OPT_COMMAND; Tcl_Obj *resultPtr; if (objc < 2 || objc > 3) { badArgs: Tcl_WrongNumArgs(interp, 1, objv, "?-command? ?-variable? name"); Index: generic/tclObj.c ================================================================== --- generic/tclObj.c +++ generic/tclObj.c @@ -667,11 +667,11 @@ * Continuation lines coming before the string and affecting us * should not happen, due to the proper maintenance of clNext * during compilation. */ - if (clLocPtr->loc[i] < 0) { + if (clLocPtr->loc[i] <= CLL_END) { Tcl_Panic("Derived ICL data for object using offsets from before the script"); } } } } Index: generic/tclTest.c ================================================================== --- generic/tclTest.c +++ generic/tclTest.c @@ -3847,11 +3847,11 @@ "describe", "config", "validate", NULL }; - enum { + enum Subcommand { LISTREP_NEW, LISTREP_DESCRIBE, LISTREP_CONFIG, LISTREP_VALIDATE } cmdIndex; Index: macosx/tclMacOSXFCmd.c ================================================================== --- macosx/tclMacOSXFCmd.c +++ macosx/tclMacOSXFCmd.c @@ -78,11 +78,11 @@ UpdateStringOfOSType, /* updateStringProc */ SetOSTypeFromAny, /* setFromAnyProc */ TCL_OBJTYPE_V0 }; -enum { +enum TclMacosxMagicConstants { kIsInvisible = 0x4000, }; #define kFinfoIsInvisible (OSSwapHostToBigConstInt16(kIsInvisible)) Index: unix/tclUnixSock.c ================================================================== --- unix/tclUnixSock.c +++ unix/tclUnixSock.c @@ -1643,11 +1643,11 @@ /* * Try to record and return the most meaningful error message, i.e. the * one from the first socket that went the farthest before it failed. */ - enum { LOOKUP, SOCKET, BIND, LISTEN } howfar = LOOKUP; + enum Status { LOOKUP, SOCKET, BIND, LISTEN } howfar = LOOKUP; int my_errno = 0; /* * If we were called with port 0 to listen on a random port number, we * copy the port number from the first member of the addrinfo list to all Index: win/tclWinPipe.c ================================================================== --- win/tclWinPipe.c +++ win/tclWinPipe.c @@ -1583,11 +1583,11 @@ * Quote flags: * CL_ESCAPE - escape argument; * CL_QUOTE - enclose in quotes; * CL_UNPAIRED - previous arguments chain contains unpaired quote-char; */ - enum {CL_ESCAPE = 1, CL_QUOTE = 2, CL_UNPAIRED = 4}; + enum QuoteFlags {CL_ESCAPE = 1, CL_QUOTE = 2, CL_UNPAIRED = 4}; Tcl_DStringInit(&ds); /* * Prime the path. Add a space separator if we were primed with something.