summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-03-15 15:26:24 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-03-15 15:26:24 (GMT)
commitc698498d6dea2e7b6507e0a2b724c4fb7da502b1 (patch)
tree2ad8ebaadbb24145b469e39a5050477514127825
parentfb115db64ceb2b31b68345ef5fa6a0c2442cab8e (diff)
parent9daf0e2a9975554c4473e2233f05dac5131ff6cf (diff)
downloadtcl-c698498d6dea2e7b6507e0a2b724c4fb7da502b1.zip
tcl-c698498d6dea2e7b6507e0a2b724c4fb7da502b1.tar.gz
tcl-c698498d6dea2e7b6507e0a2b724c4fb7da502b1.tar.bz2
Merge 9.0
-rw-r--r--.github/workflows/linux-build.yml2
-rw-r--r--.github/workflows/win-build.yml2
-rw-r--r--generic/rege_dfa.c2
-rw-r--r--generic/regexec.c2
-rw-r--r--generic/tcl.h5
-rw-r--r--generic/tclBasic.c26
-rw-r--r--generic/tclBinary.c42
-rw-r--r--generic/tclExecute.c11
-rw-r--r--generic/tclInt.h31
-rw-r--r--generic/tclOOCall.c12
-rw-r--r--generic/tclStubInit.c3
-rw-r--r--generic/tclTest.c6
-rw-r--r--generic/tclVar.c66
-rw-r--r--unix/tclUnixCompat.c9
-rw-r--r--win/makefile.vc3
-rw-r--r--win/rules.vc6
16 files changed, 110 insertions, 118 deletions
diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml
index 92e17b6..cb93bd4 100644
--- a/.github/workflows/linux-build.yml
+++ b/.github/workflows/linux-build.yml
@@ -7,8 +7,8 @@ jobs:
matrix:
cfgopt:
- ""
- - "CFLAGS=-DTCL_NO_DEPRECATED=1"
- "CFLAGS=-DTCL_UTF_MAX=3"
+ - "CFLAGS=-DTCL_NO_DEPRECATED=1"
- "--disable-shared"
- "--enable-symbols"
- "--enable-symbols=mem"
diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml
index 287d0f5..547d27e 100644
--- a/.github/workflows/win-build.yml
+++ b/.github/workflows/win-build.yml
@@ -13,6 +13,7 @@ jobs:
matrix:
cfgopt:
- ""
+ - "OPTS=utf16"
- "CHECKS=nodep"
- "OPTS=static"
- "OPTS=symbols"
@@ -51,6 +52,7 @@ jobs:
matrix:
cfgopt:
- ""
+ - "CFLAGS=-DTCL_UTF_MAX=3"
- "CFLAGS=-DTCL_NO_DEPRECATED=1"
- "--disable-shared"
- "--enable-symbols"
diff --git a/generic/rege_dfa.c b/generic/rege_dfa.c
index f38c8c9..eddfea2 100644
--- a/generic/rege_dfa.c
+++ b/generic/rege_dfa.c
@@ -419,7 +419,7 @@ freeDFA(
static unsigned
hash(
unsigned *const uv,
- const int n)
+ int n)
{
int i;
unsigned h;
diff --git a/generic/regexec.c b/generic/regexec.c
index 82b08cc..fdbdef0 100644
--- a/generic/regexec.c
+++ b/generic/regexec.c
@@ -145,7 +145,7 @@ static chr *shortest(struct vars *const, struct dfa *const, chr *const, chr *con
static chr *lastCold(struct vars *const, struct dfa *const);
static struct dfa *newDFA(struct vars *const, struct cnfa *const, struct colormap *const, struct smalldfa *);
static void freeDFA(struct dfa *const);
-static unsigned hash(unsigned *const, const int);
+static unsigned hash(unsigned *const, int);
static struct sset *initialize(struct vars *const, struct dfa *const, chr *const);
static struct sset *miss(struct vars *const, struct dfa *const, struct sset *const, const pcolor, chr *const, chr *const);
static int checkLAConstraint(struct vars *const, struct cnfa *const, chr *const, const pcolor);
diff --git a/generic/tcl.h b/generic/tcl.h
index 9025c50..e522a78 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -718,16 +718,11 @@ typedef struct Tcl_Namespace {
typedef struct Tcl_CallFrame {
Tcl_Namespace *nsPtr;
int dummy1;
-#if TCL_MAJOR_VERSION > 8
- int dummy6;
-#endif
size_t dummy2;
void *dummy3;
void *dummy4;
void *dummy5;
-#if TCL_MAJOR_VERSION < 9
int dummy6;
-#endif
void *dummy7;
void *dummy8;
size_t dummy9;
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 9214994..5cf15ce 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -217,8 +217,8 @@ MODULE_SCOPE const TclStubs tclStubs;
* after particular kinds of [yield].
*/
-#define CORO_ACTIVATE_YIELD PTR2INT(NULL)
-#define CORO_ACTIVATE_YIELDM PTR2INT(NULL)+1
+#define CORO_ACTIVATE_YIELD NULL
+#define CORO_ACTIVATE_YIELDM INT2PTR(1)
#define COROUTINE_ARGUMENTS_SINGLE_OPTIONAL ((size_t)-1)
#define COROUTINE_ARGUMENTS_ARBITRARY ((size_t)-2)
@@ -1643,7 +1643,7 @@ Tcl_DeleteAssocData(
*----------------------------------------------------------------------
*/
-ClientData
+void *
Tcl_GetAssocData(
Tcl_Interp *interp, /* Interpreter associated with. */
const char *name, /* Name of association. */
@@ -4565,7 +4565,7 @@ TEOV_PushExceptionHandlers(
*/
TclNRAddCallback(interp, TEOV_Error, INT2PTR(objc),
- (ClientData) objv, NULL, NULL);
+ objv, NULL, NULL);
}
if (iPtr->numLevels == 1) {
@@ -8795,7 +8795,7 @@ TclNRYieldToObjCmd(
corPtr->yieldPtr = listPtr;
iPtr->execEnvPtr = corPtr->eePtr;
- return TclNRYieldObjCmd(INT2PTR(CORO_ACTIVATE_YIELDM), interp, 1, objv);
+ return TclNRYieldObjCmd(CORO_ACTIVATE_YIELDM, interp, 1, objv);
}
static int
@@ -8955,7 +8955,6 @@ TclNRCoroutineActivateCallback(
Tcl_Interp *interp,
TCL_UNUSED(int) /*result*/)
{
- size_t numLevels, type = PTR2INT(data[1]);
CoroutineData *corPtr = (CoroutineData *)data[0];
if (!corPtr->stackLevel) {
@@ -8974,7 +8973,7 @@ TclNRCoroutineActivateCallback(
*/
corPtr->stackLevel = &corPtr;
- numLevels = corPtr->auxNumLevels;
+ size_t numLevels = corPtr->auxNumLevels;
corPtr->auxNumLevels = iPtr->numLevels;
SAVE_CONTEXT(corPtr->caller);
@@ -9011,6 +9010,7 @@ TclNRCoroutineActivateCallback(
return TCL_ERROR;
}
+ void *type = data[1];
if (type == CORO_ACTIVATE_YIELD) {
corPtr->nargs = COROUTINE_ARGUMENTS_SINGLE_OPTIONAL;
} else if (type == CORO_ACTIVATE_YIELDM) {
@@ -9022,7 +9022,7 @@ TclNRCoroutineActivateCallback(
corPtr->yieldPtr = NULL;
corPtr->stackLevel = NULL;
- numLevels = iPtr->numLevels;
+ size_t numLevels = iPtr->numLevels;
iPtr->numLevels = corPtr->auxNumLevels;
corPtr->auxNumLevels = numLevels - corPtr->auxNumLevels;
@@ -9169,7 +9169,6 @@ TclNRCoroInjectObjCmd(
Tcl_Obj *const objv[])
{
CoroutineData *corPtr;
- ExecEnv *savedEEPtr = iPtr->execEnvPtr;
/*
* Usage more or less like tailcall:
@@ -9198,6 +9197,7 @@ TclNRCoroInjectObjCmd(
* to happen when the coro is resumed.
*/
+ ExecEnv *savedEEPtr = iPtr->execEnvPtr;
iPtr->execEnvPtr = corPtr->eePtr;
TclNRAddCallback(interp, InjectHandler, corPtr,
Tcl_NewListObj(objc - 2, objv + 2), INT2PTR(corPtr->nargs), NULL);
@@ -9213,8 +9213,6 @@ TclNRCoroProbeObjCmd(
int objc,
Tcl_Obj *const objv[])
{
- ExecEnv *savedEEPtr = iPtr->execEnvPtr;
- size_t numLevels;
CoroutineData *corPtr;
/*
@@ -9245,6 +9243,7 @@ TclNRCoroProbeObjCmd(
* to happen when the coro is resumed.
*/
+ ExecEnv *savedEEPtr = iPtr->execEnvPtr;
iPtr->execEnvPtr = corPtr->eePtr;
TclNRAddCallback(interp, InjectHandler, corPtr,
Tcl_NewListObj(objc - 2, objv + 2), INT2PTR(corPtr->nargs), corPtr);
@@ -9266,7 +9265,7 @@ TclNRCoroProbeObjCmd(
*/
corPtr->stackLevel = &corPtr;
- numLevels = corPtr->auxNumLevels;
+ size_t numLevels = corPtr->auxNumLevels;
corPtr->auxNumLevels = iPtr->numLevels;
/*
@@ -9358,7 +9357,6 @@ InjectHandlerPostCall(
Tcl_Obj *listPtr = (Tcl_Obj *)data[1];
size_t nargs = PTR2INT(data[2]);
void *isProbe = data[3];
- size_t numLevels;
/*
* Delete the command words for what we just executed.
@@ -9380,7 +9378,7 @@ InjectHandlerPostCall(
}
corPtr->nargs = nargs;
corPtr->stackLevel = NULL;
- numLevels = iPtr->numLevels;
+ size_t numLevels = iPtr->numLevels;
iPtr->numLevels = corPtr->auxNumLevels;
corPtr->auxNumLevels = numLevels - corPtr->auxNumLevels;
iPtr->execEnvPtr = corPtr->callerEEPtr;
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 8a5e033..65e9f6c 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -183,7 +183,9 @@ typedef struct {
} ByteArray;
#define BYTEARRAY_SIZE(len) \
- (offsetof(ByteArray, bytes) + (len))
+ ( (offsetof(ByteArray, bytes) + (len) < offsetof(ByteArray, bytes)) \
+ ? (Tcl_Panic("max size of a Tcl value exceeded"), 0) \
+ : (offsetof(ByteArray, bytes) + (len)) )
#define GET_BYTEARRAY(irPtr) ((ByteArray *) (irPtr)->twoPtrValue.ptr1)
#define SET_BYTEARRAY(irPtr, baPtr) \
(irPtr)->twoPtrValue.ptr1 = (baPtr)
@@ -714,7 +716,7 @@ UpdateStringOfByteArray(
for (i = 0; i < length; i++) {
if ((src[i] == 0) || (src[i] > 127)) {
- size += 1U;
+ size++;
}
}
@@ -785,31 +787,28 @@ TclAppendBytesToByteArray(
}
byteArrayPtr = GET_BYTEARRAY(irPtr);
- /* Size limit check now commented out. Used to protect calls to
- * Tcl_*Alloc*() limited by unsigned int arguments.
- *
- if (len > UINT_MAX - byteArrayPtr->used) {
- Tcl_Panic("max size for a Tcl value (%u bytes) exceeded", UINT_MAX);
- }
- *
- */
-
- needed = byteArrayPtr->used + len;
/*
* If we need to, resize the allocated space in the byte array.
*/
+ needed = byteArrayPtr->used + len;
+ if (needed < byteArrayPtr->used) {
+ /* Wrapped around SIZE_MAX!! */
+ Tcl_Panic("max size of a Tcl value exceeded");
+ }
if (needed > byteArrayPtr->allocated) {
ByteArray *ptr = NULL;
- size_t attempt;
- if (needed <= INT_MAX/2) {
- /*
- * Try to allocate double the total space that is needed.
- */
+ /*
+ * Try to allocate double the total space that is needed.
+ */
- attempt = 2 * needed;
- ptr = (ByteArray *)Tcl_AttemptRealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
+ size_t attempt = 2 * needed;
+
+ /* Protection just in case we wrapped around SIZE_MAX */
+ if (attempt >= needed) {
+ ptr = (ByteArray *) Tcl_AttemptRealloc(byteArrayPtr,
+ BYTEARRAY_SIZE(attempt));
}
if (ptr == NULL) {
/*
@@ -817,7 +816,10 @@ TclAppendBytesToByteArray(
*/
attempt = needed + len + TCL_MIN_GROWTH;
- ptr = (ByteArray *)Tcl_AttemptRealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
+ if (attempt >= needed) {
+ ptr = (ByteArray *) Tcl_AttemptRealloc(byteArrayPtr,
+ BYTEARRAY_SIZE(attempt));
+ }
}
if (ptr == NULL) {
/*
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index b9b6459..adbfd2d 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -2048,9 +2048,8 @@ TEBCresume(
Tcl_Obj *objPtr, *valuePtr, *value2Ptr, *part1Ptr, *part2Ptr, *tmpPtr;
Tcl_Obj **objv = NULL;
- size_t objc = 0;
+ size_t length, objc = 0;
int opnd, pcAdjustment;
- size_t length;
Var *varPtr, *arrayPtr;
#ifdef TCL_COMPILE_DEBUG
char cmdNameBuf[21];
@@ -2369,7 +2368,7 @@ TEBCresume(
{
CoroutineData *corPtr;
- size_t yieldParameter;
+ void *yieldParameter;
case INST_YIELD:
corPtr = iPtr->execEnvPtr->corPtr;
@@ -2397,7 +2396,7 @@ TEBCresume(
fflush(stdout);
}
#endif
- yieldParameter = PTR2INT(NULL); /*==CORO_ACTIVATE_YIELD*/
+ yieldParameter = NULL; /*==CORO_ACTIVATE_YIELD*/
Tcl_SetObjResult(interp, OBJ_AT_TOS);
goto doYield;
@@ -2452,7 +2451,7 @@ TEBCresume(
TclSetTailcall(interp, valuePtr);
corPtr->yieldPtr = valuePtr;
iPtr->execEnvPtr = corPtr->eePtr;
- yieldParameter = PTR2INT(NULL)+1; /*==CORO_ACTIVATE_YIELDM*/
+ yieldParameter = INT2PTR(1); /*==CORO_ACTIVATE_YIELDM*/
doYield:
/* TIP #280: Record the last piece of info needed by
@@ -2470,7 +2469,7 @@ TEBCresume(
cleanup = 1;
TEBC_YIELD();
TclNRAddCallback(interp, TclNRCoroutineActivateCallback, corPtr,
- INT2PTR(yieldParameter), NULL, NULL);
+ yieldParameter, NULL, NULL);
return TCL_OK;
}
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 56431b6..baf3d81 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -506,7 +506,7 @@ typedef struct EnsembleConfig {
* core, presumably because the ensemble
* itself has been updated. */
Tcl_Obj *parameterList; /* List of ensemble parameter names. */
- int numParameters; /* Cached number of parameters. This is either
+ size_t numParameters; /* Cached number of parameters. This is either
* 0 (if the parameterList field is NULL) or
* the length of the list in the parameterList
* field. */
@@ -1110,12 +1110,6 @@ typedef struct CallFrame {
* If FRAME_IS_PROC is set, the frame was
* pushed to execute a Tcl procedure and may
* have local vars. */
-#if TCL_MAJOR_VERSION > 8
- int level; /* Level of this procedure, for "uplevel"
- * purposes (i.e. corresponds to nesting of
- * callerVarPtr's, not callerPtr's). 1 for
- * outermost procedure, 0 for top-level. */
-#endif
size_t objc; /* This and objv below describe the arguments
* for this procedure call. */
Tcl_Obj *const *objv; /* Array of argument objects. */
@@ -1130,9 +1124,10 @@ typedef struct CallFrame {
* callerPtr unless an "uplevel" command or
* something equivalent was active in the
* caller). */
-#if TCL_MAJOR_VERSION < 9
- int level;
-#endif
+ int level; /* Level of this procedure, for "uplevel"
+ * purposes (i.e. corresponds to nesting of
+ * callerVarPtr's, not callerPtr's). 1 for
+ * outermost procedure, 0 for top-level. */
Proc *procPtr; /* Points to the structure defining the called
* procedure. Used to get information such as
* the number of compiled local variables
@@ -4057,30 +4052,30 @@ MODULE_SCOPE Tcl_Obj * TclStringReverse(Tcl_Obj *objPtr, int flags);
MODULE_SCOPE Var * TclObjLookupVarEx(Tcl_Interp * interp,
Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags,
- const char *msg, const int createPart1,
- const int createPart2, Var **arrayPtrPtr);
+ const char *msg, int createPart1,
+ int createPart2, Var **arrayPtrPtr);
MODULE_SCOPE Var * TclLookupArrayElement(Tcl_Interp *interp,
Tcl_Obj *arrayNamePtr, Tcl_Obj *elNamePtr,
- const int flags, const char *msg,
- const int createPart1, const int createPart2,
+ int flags, const char *msg,
+ int createPart1, int createPart2,
Var *arrayPtr, int index);
MODULE_SCOPE Tcl_Obj * TclPtrGetVarIdx(Tcl_Interp *interp,
Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr,
- Tcl_Obj *part2Ptr, const int flags, int index);
+ Tcl_Obj *part2Ptr, int flags, int index);
MODULE_SCOPE Tcl_Obj * TclPtrSetVarIdx(Tcl_Interp *interp,
Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr,
Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr,
- const int flags, int index);
+ int flags, int index);
MODULE_SCOPE Tcl_Obj * TclPtrIncrObjVarIdx(Tcl_Interp *interp,
Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr,
Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr,
- const int flags, int index);
+ int flags, int index);
MODULE_SCOPE int TclPtrObjMakeUpvarIdx(Tcl_Interp *interp,
Var *otherPtr, Tcl_Obj *myNamePtr, int myFlags,
int index);
MODULE_SCOPE int TclPtrUnsetVarIdx(Tcl_Interp *interp, Var *varPtr,
Var *arrayPtr, Tcl_Obj *part1Ptr,
- Tcl_Obj *part2Ptr, const int flags,
+ Tcl_Obj *part2Ptr, int flags,
int index);
MODULE_SCOPE void TclInvalidateNsPath(Namespace *nsPtr);
MODULE_SCOPE void TclFindArrayPtrElements(Var *arrayPtr,
diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c
index 5f2e672..3bd96a2 100644
--- a/generic/tclOOCall.c
+++ b/generic/tclOOCall.c
@@ -91,7 +91,7 @@ typedef struct {
static void AddClassFiltersToCallContext(Object *const oPtr,
Class *clsPtr, struct ChainBuilder *const cbPtr,
Tcl_HashTable *const doneFilters, int flags);
-static void AddClassMethodNames(Class *clsPtr, const int flags,
+static void AddClassMethodNames(Class *clsPtr, int flags,
Tcl_HashTable *const namesPtr,
Tcl_HashTable *const examinedClassesPtr);
static inline void AddDefinitionNamespaceToChain(Class *const definerCls,
@@ -306,7 +306,7 @@ FreeMethodNameRep(
int
TclOOInvokeContext(
- ClientData clientData, /* The method call context. */
+ void *clientData, /* The method call context. */
Tcl_Interp *interp, /* Interpreter for error reporting, and many
* other sorts of context handling (e.g.,
* commands, variables) depending on method
@@ -375,7 +375,7 @@ TclOOInvokeContext(
static int
SetFilterFlags(
- ClientData data[],
+ void *data[],
TCL_UNUSED(Tcl_Interp *),
int result)
{
@@ -387,7 +387,7 @@ SetFilterFlags(
static int
ResetFilterFlags(
- ClientData data[],
+ void *data[],
TCL_UNUSED(Tcl_Interp *),
int result)
{
@@ -399,7 +399,7 @@ ResetFilterFlags(
static int
FinalizeMethodRefs(
- ClientData data[],
+ void *data[],
TCL_UNUSED(Tcl_Interp *),
int result)
{
@@ -671,7 +671,7 @@ CmpStr(
static void
AddClassMethodNames(
Class *clsPtr, /* Class to get method names from. */
- const int flags, /* Whether we are interested in just the
+ int flags, /* Whether we are interested in just the
* public method names. */
Tcl_HashTable *const namesPtr,
/* Reference to the hash table to put the
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 5d9d56c..19cf8c1 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -77,10 +77,11 @@
static void uniCodePanic() {
Tcl_Panic("This extension uses a deprecated function, not available now: Tcl is compiled with -DTCL_UTF_MAX==%d", TCL_UTF_MAX);
}
-# define Tcl_GetUnicode (int *(*)(Tcl_Obj *))(void *)uniCodePanic
# define Tcl_GetUnicodeFromObj (Tcl_UniChar *(*)(Tcl_Obj *, size_t *))(void *)uniCodePanic
+# define TclGetUnicodeFromObj (Tcl_UniChar *(*)(Tcl_Obj *, int *))(void *)uniCodePanic
# define Tcl_NewUnicodeObj (Tcl_Obj *(*)(const Tcl_UniChar *, size_t))(void *)uniCodePanic
# define Tcl_SetUnicodeObj (void(*)(Tcl_Obj *, const Tcl_UniChar *, size_t))(void *)uniCodePanic
+# define TclAppendUnicodeToObj (void(*)(Tcl_Obj *, const Tcl_UniChar *, size_t))(void *)uniCodePanic
#endif
#define TclUtfCharComplete Tcl_UtfCharComplete
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 94a3fea..f1b95b6 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -332,7 +332,7 @@ static Tcl_NRPostProc NREUnwind_callback;
static Tcl_ObjCmdProc TestNREUnwind;
static Tcl_ObjCmdProc TestNRELevels;
static Tcl_ObjCmdProc TestInterpResolverCmd;
-#if defined(HAVE_CPUID)
+#if defined(HAVE_CPUID) && !defined(MAC_OSX_TCL)
static Tcl_ObjCmdProc TestcpuidCmd;
#endif
@@ -695,7 +695,7 @@ Tcltest_Init(
NULL, NULL);
Tcl_CreateCommand(interp, "testexitmainloop", TestexitmainloopCmd,
NULL, NULL);
-#if defined(HAVE_CPUID)
+#if defined(HAVE_CPUID) && !defined(MAC_OSX_TCL)
Tcl_CreateObjCommand(interp, "testcpuid", TestcpuidCmd,
NULL, NULL);
#endif
@@ -7164,7 +7164,7 @@ TestGetIntForIndexCmd(
-#if defined(HAVE_CPUID)
+#if defined(HAVE_CPUID) && !defined(MAC_OSX_TCL)
/*
*----------------------------------------------------------------------
*
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 2a9f8b7..e403148 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -200,7 +200,7 @@ static Tcl_Var ObjFindNamespaceVar(Tcl_Interp *interp,
int flags);
static int ObjMakeUpvar(Tcl_Interp *interp,
CallFrame *framePtr, Tcl_Obj *otherP1Ptr,
- const char *otherP2, const int otherFlags,
+ const char *otherP2, int otherFlags,
Tcl_Obj *myNamePtr, int myFlags, int index);
static ArraySearch * ParseSearchId(Tcl_Interp *interp, const Var *varPtr,
Tcl_Obj *varNamePtr, Tcl_Obj *handleObj);
@@ -212,7 +212,7 @@ static void UnsetVarStruct(Var *varPtr, Var *arrayPtr,
* TIP #508: [array default]
*/
-static int ArrayDefaultCmd(ClientData clientData,
+static int ArrayDefaultCmd(void *clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static void DeleteArrayVar(Var *arrayPtr);
@@ -224,7 +224,7 @@ static void SetArrayDefault(Var *arrayPtr, Tcl_Obj *defaultObj);
*/
MODULE_SCOPE Var * TclLookupSimpleVar(Tcl_Interp *interp,
- Tcl_Obj *varNamePtr, int flags, const int create,
+ Tcl_Obj *varNamePtr, int flags, int create,
const char **errMsgPtr, int *indexPtr);
static Tcl_DupInternalRepProc DupLocalVarName;
@@ -541,10 +541,10 @@ TclObjLookupVar(
const char *msg, /* Verb to use in error messages, e.g. "read"
* or "set". Only needed if TCL_LEAVE_ERR_MSG
* is set in flags. */
- const int createPart1, /* If 1, create hash table entry for part 1 of
+ int createPart1, /* If 1, create hash table entry for part 1 of
* name, if it doesn't already exist. If 0,
* return error if it doesn't exist. */
- const int createPart2, /* If 1, create hash table entry for part 2 of
+ int createPart2, /* If 1, create hash table entry for part 2 of
* name, if it doesn't already exist. If 0,
* return error if it doesn't exist. */
Var **arrayPtrPtr) /* If the name refers to an element of an
@@ -591,10 +591,10 @@ TclObjLookupVarEx(
const char *msg, /* Verb to use in error messages, e.g. "read"
* or "set". Only needed if TCL_LEAVE_ERR_MSG
* is set in flags. */
- const int createPart1, /* If 1, create hash table entry for part 1 of
+ int createPart1, /* If 1, create hash table entry for part 1 of
* name, if it doesn't already exist. If 0,
* return error if it doesn't exist. */
- const int createPart2, /* If 1, create hash table entry for part 2 of
+ int createPart2, /* If 1, create hash table entry for part 2 of
* name, if it doesn't already exist. If 0,
* return error if it doesn't exist. */
Var **arrayPtrPtr) /* If the name refers to an element of an
@@ -827,7 +827,7 @@ TclLookupSimpleVar(
int flags, /* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
* TCL_AVOID_RESOLVERS and TCL_LEAVE_ERR_MSG
* bits matter. */
- const int create, /* If 1, create hash table entry for varname,
+ int create, /* If 1, create hash table entry for varname,
* if it doesn't already exist. If 0, return
* error if it doesn't exist. */
const char **errMsgPtr,
@@ -1059,15 +1059,15 @@ TclLookupArrayElement(
Tcl_Obj *arrayNamePtr, /* This is the name of the array, or NULL if
* index>= 0. */
Tcl_Obj *elNamePtr, /* Name of element within array. */
- const int flags, /* Only TCL_LEAVE_ERR_MSG bit matters. */
+ int flags, /* Only TCL_LEAVE_ERR_MSG bit matters. */
const char *msg, /* Verb to use in error messages, e.g. "read"
* or "set". Only needed if TCL_LEAVE_ERR_MSG
* is set in flags. */
- const int createArray, /* If 1, transform arrayName to be an array if
+ int createArray, /* If 1, transform arrayName to be an array if
* it isn't one yet and the transformation is
* possible. If 0, return error if it isn't
* already an array. */
- const int createElem, /* If 1, create hash table entry for the
+ int createElem, /* If 1, create hash table entry for the
* element, if it doesn't already exist. If 0,
* return error if it doesn't exist. */
Var *arrayPtr, /* Pointer to the array's Var structure. */
@@ -1335,7 +1335,7 @@ TclPtrGetVar(
* the name of a variable. */
Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element
* in the array part1. */
- const int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, and
+ int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, and
* TCL_LEAVE_ERR_MSG bits. */
{
if (varPtr == NULL) {
@@ -1381,7 +1381,7 @@ TclPtrGetVarIdx(
* the name of a variable. */
Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element
* in the array part1. */
- const int flags, /* OR-ed combination of TCL_GLOBAL_ONLY, and
+ int flags, /* OR-ed combination of TCL_GLOBAL_ONLY, and
* TCL_LEAVE_ERR_MSG bits. */
int index) /* Index into the local variable table of the
* variable, or -1. Only used when part1Ptr is
@@ -1727,7 +1727,7 @@ TclPtrSetVar(
Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element
* in the array part1. */
Tcl_Obj *newValuePtr, /* New value for variable. */
- const int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, and
+ int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, and
* TCL_LEAVE_ERR_MSG bits. */
{
if (varPtr == NULL) {
@@ -1906,7 +1906,7 @@ TclPtrSetVarIdx(
Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element
* in the array part1. */
Tcl_Obj *newValuePtr, /* New value for variable. */
- const int flags, /* OR-ed combination of TCL_GLOBAL_ONLY, and
+ int flags, /* OR-ed combination of TCL_GLOBAL_ONLY, and
* TCL_LEAVE_ERR_MSG bits. */
int index) /* Index of local var where part1 is to be
* found. */
@@ -2152,7 +2152,7 @@ TclPtrIncrObjVar(
* part1Ptr. */
Tcl_Obj *incrPtr, /* Increment value. */
/* TODO: Which of these flag values really make sense? */
- const int flags) /* Various flags that tell how to incr value:
+ int flags) /* Various flags that tell how to incr value:
* any of TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
* TCL_APPEND_VALUE, TCL_LIST_ELEMENT,
* TCL_LEAVE_ERR_MSG. */
@@ -2208,7 +2208,7 @@ TclPtrIncrObjVarIdx(
* part1Ptr. */
Tcl_Obj *incrPtr, /* Increment value. */
/* TODO: Which of these flag values really make sense? */
- const int flags, /* Various flags that tell how to incr value:
+ int flags, /* Various flags that tell how to incr value:
* any of TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
* TCL_APPEND_VALUE, TCL_LIST_ELEMENT,
* TCL_LEAVE_ERR_MSG. */
@@ -2386,7 +2386,7 @@ TclPtrUnsetVar(
* the name of a variable. */
Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element
* in the array part1. */
- const int flags) /* OR-ed combination of any of
+ int flags) /* OR-ed combination of any of
* TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
* TCL_LEAVE_ERR_MSG. */
{
@@ -2433,7 +2433,7 @@ TclPtrUnsetVarIdx(
* the name of a variable. */
Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element
* in the array part1. */
- const int flags, /* OR-ed combination of any of
+ int flags, /* OR-ed combination of any of
* TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
* TCL_LEAVE_ERR_MSG. */
int index) /* Index into the local variable table of the
@@ -3012,7 +3012,7 @@ ArrayObjNext(
static int
ArrayForObjCmd(
- ClientData clientData,
+ void *clientData,
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3094,7 +3094,7 @@ ArrayForNRCmd(
static int
ArrayForLoopCallback(
- ClientData data[],
+ void *data[],
Tcl_Interp *interp,
int result)
{
@@ -4110,7 +4110,7 @@ ArraySetCmd(
static int
ArraySizeCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -4169,7 +4169,7 @@ ArraySizeCmd(
static int
ArrayStatsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -4223,7 +4223,7 @@ ArrayStatsCmd(
static int
ArrayUnsetCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -4232,7 +4232,7 @@ ArrayUnsetCmd(
Tcl_Obj *varNameObj, *patternObj, *nameObj;
Tcl_HashSearch search;
const char *pattern;
- const int unsetFlags = 0; /* Should this be TCL_LEAVE_ERR_MSG? */
+ int unsetFlags = 0; /* Should this be TCL_LEAVE_ERR_MSG? */
int isArray;
switch (objc) {
@@ -4411,7 +4411,7 @@ ObjMakeUpvar(
* NULL means use global :: context. */
Tcl_Obj *otherP1Ptr,
const char *otherP2, /* Two-part name of variable in framePtr. */
- const int otherFlags, /* 0, TCL_GLOBAL_ONLY or TCL_NAMESPACE_ONLY:
+ int otherFlags, /* 0, TCL_GLOBAL_ONLY or TCL_NAMESPACE_ONLY:
* indicates scope of "other" variable. */
Tcl_Obj *myNamePtr, /* Name of variable which will refer to
* otherP1/otherP2. Must be a scalar. */
@@ -4791,7 +4791,7 @@ Tcl_GetVariableFullName(
int
Tcl_GlobalObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4895,7 +4895,7 @@ Tcl_GlobalObjCmd(
int
Tcl_VariableObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -5028,7 +5028,7 @@ Tcl_VariableObjCmd(
int
Tcl_UpvarObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -5844,7 +5844,7 @@ ObjFindNamespaceVar(
int
TclInfoVarsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -6035,7 +6035,7 @@ TclInfoVarsCmd(
int
TclInfoGlobalsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -6128,7 +6128,7 @@ TclInfoGlobalsCmd(
int
TclInfoLocalsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -6434,7 +6434,7 @@ CompareVarKeys(
static int
ArrayDefaultCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c
index 603285d..111a082 100644
--- a/unix/tclUnixCompat.c
+++ b/unix/tclUnixCompat.c
@@ -334,7 +334,7 @@ TclpGetPwUid(
#ifdef NEED_PW_CLEANER
static void
FreePwBuf(
- TCL_UNUSED(ClientData))
+ TCL_UNUSED(void *))
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -517,7 +517,7 @@ TclpGetGrGid(
#ifdef NEED_GR_CLEANER
static void
FreeGrBuf(
- TCL_UNUSED(ClientData))
+ TCL_UNUSED(void *))
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -992,20 +992,19 @@ TclWinCPUID(
int status = TCL_ERROR;
/* See: <http://en.wikipedia.org/wiki/CPUID> */
-#if defined(HAVE_CPUID)
#if defined(__x86_64__) || defined(_M_AMD64) || defined (_M_X64)
__asm__ __volatile__("movq %%rbx, %%rsi \n\t" /* save %rbx */
"cpuid \n\t"
"xchgq %%rsi, %%rbx \n\t" /* restore the old %rbx */
: "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
: "a"(index));
-#else
+ status = TCL_OK;
+#elif defined(__i386__) || defined(_M_IX86)
__asm__ __volatile__("mov %%ebx, %%esi \n\t" /* save %ebx */
"cpuid \n\t"
"xchg %%esi, %%ebx \n\t" /* restore the old %ebx */
: "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
: "a"(index));
-#endif
status = TCL_OK;
#else
(void)index;
diff --git a/win/makefile.vc b/win/makefile.vc
index 2687e1c..f9014e8 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -52,7 +52,7 @@
# turn on the 64-bit compiler, if your SDK has it.
#
# Basic macros and options usable on the commandline (see rules.vc for more info):
-# OPTS=nomsvcrt,noembed,nothreads,pdbs,profile,static,symbols,thrdalloc,unchecked,none
+# OPTS=nomsvcrt,noembed,nothreads,pdbs,profile,static,symbols,thrdalloc,unchecked,utf16,none
# Sets special options for the core. The default is for none.
# Any combination of the above may be used (comma separated).
# 'none' will over-ride everything to nothing.
@@ -78,6 +78,7 @@
# unchecked = Allows a symbols build to not use the debug
# enabled runtime (msvcrt.dll not msvcrtd.dll
# or libcmt.lib not libcmtd.lib).
+# utf16 = Forces a build using UTF-16 representation internally.
#
# STATS=compdbg,memdbg,none
# Sets optional memory and bytecode compiler debugging code added
diff --git a/win/rules.vc b/win/rules.vc
index 372d70a..713e7f9 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -884,9 +884,9 @@ USE_THREAD_ALLOC= 0
_USE_64BIT_TIME_T = 1
!endif
-!if [nmakehlp -f $(OPTS) "utfmax"]
-!message *** Force allowing 4-byte UTF-8 sequences internally
-TCL_UTF_MAX = 4
+!if [nmakehlp -f $(OPTS) "utf16"]
+!message *** Force UTF-16 internally
+TCL_UTF_MAX = 3
!endif
!endif