summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-01 12:38:14 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-01 12:38:14 (GMT)
commit09fd21b65b23d0d8ee709bb09cc48d0d4829db90 (patch)
tree14979096414414a6fece845f3539aa33a899e8ad
parent194cfb5382a54b18c200fa8c32f9aeae98e07d8a (diff)
parentcb6ae544245fea42d68f1f1c0c3ab5fd92babcaf (diff)
downloadtcl-09fd21b65b23d0d8ee709bb09cc48d0d4829db90.zip
tcl-09fd21b65b23d0d8ee709bb09cc48d0d4829db90.tar.gz
tcl-09fd21b65b23d0d8ee709bb09cc48d0d4829db90.tar.bz2
Merge 8.7
-rw-r--r--.travis.yml28
-rw-r--r--generic/tclCompCmdsGR.c2
-rw-r--r--generic/tclCompExpr.c16
-rw-r--r--generic/tclExecute.c6
-rw-r--r--generic/tclIOUtil.c2
-rw-r--r--generic/tclInterp.c29
-rw-r--r--generic/tclPkg.c2
-rw-r--r--generic/tclResult.c8
-rw-r--r--generic/tclScan.c8
-rw-r--r--generic/tclStringObj.c34
-rw-r--r--generic/tclTest.c6
-rw-r--r--generic/tclTrace.c3
-rw-r--r--generic/tclUtil.c4
-rw-r--r--generic/tclVar.c62
-rw-r--r--generic/tclZlib.c2
-rw-r--r--library/http/http.tcl6
-rw-r--r--macosx/Tcl-Common.xcconfig2
-rw-r--r--tests/http.test3
-rw-r--r--tests/interp.test8
-rwxr-xr-xunix/configure2
-rw-r--r--unix/tcl.m42
-rwxr-xr-xwin/configure2
-rw-r--r--win/tcl.m42
-rw-r--r--win/tclWinFile.c4
-rw-r--r--win/tclWinSerial.c14
25 files changed, 135 insertions, 122 deletions
diff --git a/.travis.yml b/.travis.yml
index a3b4b7d..ab80836 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -120,9 +120,9 @@ jobs:
- BUILD_DIR=unix
- CFGOPT="--enable-symbols=mem"
# Testing on Mac, various styles
- - name: "macOS/Clang/Xcode 11.7/Shared"
+ - name: "macOS/Clang/Xcode 12/Shared"
os: osx
- osx_image: xcode11.7
+ osx_image: xcode12
env:
- BUILD_DIR=macosx
install: []
@@ -130,14 +130,14 @@ jobs:
- make all
# The styles=develop avoids some weird problems on OSX
- make test styles=develop
- - name: "macOS/Clang/Xcode 11.7/Shared/Unix-like"
+ - name: "macOS/Clang/Xcode 12/Shared/Unix-like"
os: osx
- osx_image: xcode11.7
+ osx_image: xcode112
env:
- BUILD_DIR=unix
- - name: "macOS/Clang/Xcode 11.7/Shared/libtommath"
+ - name: "macOS/Clang/Xcode 12/Shared/libtommath"
os: osx
- osx_image: xcode11.7
+ osx_image: xcode12
env:
- BUILD_DIR=macosx
install: []
@@ -146,18 +146,26 @@ jobs:
homebrew:
packages:
- libtommath
- - name: "macOS/Clang++/Xcode 11.7/Shared"
+ - name: "macOS/Clang++/Xcode 12/Shared"
os: osx
- osx_image: xcode11.7
+ osx_image: xcode12
env:
- BUILD_DIR=unix
- CFGOPT="CC=clang++ --enable-framework CFLAGS=-Dregister=dont+use+register CPPFLAGS=-D__private_extern__=extern"
script:
- make all tcltest
+# Newer MacOS versions
+ - name: "macOS/Clang/Xcode 12/Universal Apps/Shared"
+ os: osx
+ osx_image: xcode12u
+ env:
+ - BUILD_DIR=macosx
+ install: []
+ script: *mactest
# Older MacOS versions
- name: "macOS/Clang/Xcode 11/Shared"
os: osx
- osx_image: xcode11
+ osx_image: xcode11.7
env:
- BUILD_DIR=macosx
install: []
@@ -171,7 +179,7 @@ jobs:
script: *mactest
- name: "macOS/Clang/Xcode 9/Shared"
os: osx
- osx_image: xcode9.2
+ osx_image: xcode9.4
env:
- BUILD_DIR=macosx
install: []
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c
index 221ac3a..780f7b8 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -874,7 +874,7 @@ TclCompileLappendCmd(
*/
if (numWords > 2) {
- Tcl_Token *valueTokenPtr = TokenAfter(varTokenPtr);
+ valueTokenPtr = TokenAfter(varTokenPtr);
CompileWord(envPtr, valueTokenPtr, interp, 2);
}
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 476ff14..a630ad4 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -2463,8 +2463,8 @@ CompileExprTree(
if (optimize) {
int length;
const char *bytes = TclGetStringFromObj(literal, &length);
- int index = TclRegisterLiteral(envPtr, bytes, length, 0);
- Tcl_Obj *objPtr = TclFetchLiteral(envPtr, index);
+ int idx = TclRegisterLiteral(envPtr, bytes, length, 0);
+ Tcl_Obj *objPtr = TclFetchLiteral(envPtr, idx);
if ((objPtr->typePtr == NULL) && (literal->typePtr != NULL)) {
/*
@@ -2484,7 +2484,7 @@ CompileExprTree(
objPtr->internalRep = literal->internalRep;
literal->typePtr = NULL;
}
- TclEmitPush(index, envPtr);
+ TclEmitPush(idx, envPtr);
} else {
/*
* When optimize==0, we know the expression is a one-off and
@@ -2510,7 +2510,7 @@ CompileExprTree(
if (ExecConstantExprTree(interp, nodes, next, litObjvPtr)
== TCL_OK) {
- int index;
+ int idx;
Tcl_Obj *objPtr = Tcl_GetObjResult(interp);
/*
@@ -2524,8 +2524,8 @@ CompileExprTree(
const char *bytes
= Tcl_GetStringFromObj(objPtr, &numBytes);
- index = TclRegisterLiteral(envPtr, bytes, numBytes, 0);
- tableValue = TclFetchLiteral(envPtr, index);
+ idx = TclRegisterLiteral(envPtr, bytes, numBytes, 0);
+ tableValue = TclFetchLiteral(envPtr, idx);
if ((tableValue->typePtr == NULL) &&
(objPtr->typePtr != NULL)) {
/*
@@ -2537,9 +2537,9 @@ CompileExprTree(
objPtr->typePtr = NULL;
}
} else {
- index = TclAddLiteralObj(envPtr, objPtr, NULL);
+ idx = TclAddLiteralObj(envPtr, objPtr, NULL);
}
- TclEmitPush(index, envPtr);
+ TclEmitPush(idx, envPtr);
} else {
TclCompileSyntaxError(interp, envPtr);
}
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 13f328c..867cdd7 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -6427,8 +6427,8 @@ TEBCresume(
if (TclHasIntRep(valuePtr, &tclBooleanType)) {
objResultPtr = TCONST(1);
} else {
- int result = (TclSetBooleanFromAny(NULL, valuePtr) == TCL_OK);
- objResultPtr = TCONST(result);
+ int res = (TclSetBooleanFromAny(NULL, valuePtr) == TCL_OK);
+ objResultPtr = TCONST(res);
}
TRACE_WITH_OBJ(("\"%.30s\" => ", O2S(valuePtr)), objResultPtr);
NEXT_INST_F(1, 0, 1);
@@ -6622,7 +6622,7 @@ TEBCresume(
}
{
ForeachInfo *infoPtr;
- Tcl_Obj *listPtr, **elements, *tmpPtr;
+ Tcl_Obj *listPtr, **elements;
ForeachVarList *varListPtr;
int numLists, listLen, numVars;
int listTmpDepth;
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 2879bcb..fcce215 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -3173,7 +3173,7 @@ Tcl_LoadFile(
}
if (fsPtr->loadFileProc != NULL) {
- int retVal = ((Tcl_FSLoadFileProc2 *)(void *)(fsPtr->loadFileProc))
+ retVal = ((Tcl_FSLoadFileProc2 *)(void *)(fsPtr->loadFileProc))
(interp, pathPtr, handlePtr, &unloadProcPtr, flags);
if (retVal == TCL_OK) {
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index 6417668..434d9f4 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -621,30 +621,41 @@ NRInterpCmd(
static const char *const options[] = {
"alias", "aliases", "bgerror", "cancel",
"children", "create", "debug", "delete",
+ "eval", "exists", "expose", "hide",
+ "hidden", "issafe", "invokehidden",
+ "limit", "marktrusted", "recursionlimit",
+ "share", "slaves", "target", "transfer",
+ NULL
+ };
+ static const char *const optionsNoSlaves[] = {
+ "alias", "aliases", "bgerror", "cancel",
+ "children", "create", "debug", "delete",
"eval", "exists", "expose",
"hide", "hidden", "issafe",
"invokehidden", "limit", "marktrusted", "recursionlimit",
- "slaves", "share", "target", "transfer",
- NULL
+ "share", "target", "transfer", NULL
};
enum option {
OPT_ALIAS, OPT_ALIASES, OPT_BGERROR, OPT_CANCEL,
OPT_CHILDREN, OPT_CREATE, OPT_DEBUG, OPT_DELETE,
- OPT_EVAL, OPT_EXISTS, OPT_EXPOSE,
- OPT_HIDE, OPT_HIDDEN, OPT_ISSAFE,
- OPT_INVOKEHID, OPT_LIMIT, OPT_MARKTRUSTED,OPT_RECLIMIT,
- OPT_SLAVES, OPT_SHARE, OPT_TARGET, OPT_TRANSFER
+ OPT_EVAL, OPT_EXISTS, OPT_EXPOSE, OPT_HIDE,
+ OPT_HIDDEN, OPT_ISSAFE, OPT_INVOKEHID,
+ OPT_LIMIT, OPT_MARKTRUSTED,OPT_RECLIMIT,
+ OPT_SHARE, OPT_SLAVES, OPT_TARGET, OPT_TRANSFER
};
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "cmd ?arg ...?");
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0,
- &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(NULL, objv[1], options,
+ "option", 0, &index) != TCL_OK) {
+ /* Don't report the "slaves" option as possibility */
+ Tcl_GetIndexFromObj(interp, objv[1], optionsNoSlaves,
+ "option", 0, &index);
return TCL_ERROR;
}
- switch ((enum option) index) {
+ switch ((enum option)index) {
case OPT_ALIAS: {
Tcl_Interp *parentInterp;
diff --git a/generic/tclPkg.c b/generic/tclPkg.c
index b55ad3e..cda74b1 100644
--- a/generic/tclPkg.c
+++ b/generic/tclPkg.c
@@ -1368,9 +1368,9 @@ TclNRPackageObjCmd(
newObjvPtr, NULL);
return TCL_OK;
} else {
- int i, newobjc = objc-3;
Tcl_Obj *const *newobjv = objv + 3;
+ newobjc = objc - 3;
if (CheckAllRequirements(interp, objc-3, objv+3) != TCL_OK) {
return TCL_ERROR;
}
diff --git a/generic/tclResult.c b/generic/tclResult.c
index 4b9df6c..1fb2ad0 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -841,19 +841,19 @@ SetupAppendBuffer(
totalSpace = newSpace + iPtr->appendUsed;
if (totalSpace >= iPtr->appendAvl) {
- char *newSpace;
+ char *newSpacePtr;
if (totalSpace < 100) {
totalSpace = 200;
} else {
totalSpace *= 2;
}
- newSpace = (char *)ckalloc(totalSpace);
- strcpy(newSpace, iPtr->result);
+ newSpacePtr = (char *)ckalloc(totalSpace);
+ strcpy(newSpacePtr, iPtr->result);
if (iPtr->appendResult != NULL) {
ckfree(iPtr->appendResult);
}
- iPtr->appendResult = newSpace;
+ iPtr->appendResult = newSpacePtr;
iPtr->appendAvl = totalSpace;
} else if (iPtr->result != iPtr->appendResult) {
strcpy(iPtr->appendResult, iPtr->result);
diff --git a/generic/tclScan.c b/generic/tclScan.c
index dfd6b88..1eefafe 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -937,16 +937,16 @@ Tcl_ScanObjCmd(
} else if (flags & SCAN_BIG) {
if (flags & SCAN_UNSIGNED) {
mp_int big;
- int code = Tcl_GetBignumFromObj(interp, objPtr, &big);
+ int res = Tcl_GetBignumFromObj(interp, objPtr, &big);
- if (code == TCL_OK) {
+ if (res == TCL_OK) {
if (mp_isneg(&big)) {
- code = TCL_ERROR;
+ res = TCL_ERROR;
}
mp_clear(&big);
}
- if (code == TCL_ERROR) {
+ if (res == TCL_ERROR) {
if (objs != NULL) {
ckfree(objs);
}
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 7486631..66647f0 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -2443,10 +2443,10 @@ Tcl_AppendFormatToObj(
goto errorMsg;
}
if (ch == 'A') {
- char *p = TclGetString(segment) + 1;
- *p = 'x';
- p = strchr(p, 'P');
- if (p) *p = 'p';
+ char *q = TclGetString(segment) + 1;
+ *q = 'x';
+ q = strchr(q, 'P');
+ if (q) *q = 'p';
}
break;
}
@@ -3561,7 +3561,7 @@ TclStringFirst(
int lh, ln = Tcl_GetCharLength(needle);
Tcl_Obj *result;
int value = -1;
- Tcl_UniChar *check, *end, *uh, *un;
+ Tcl_UniChar *checkStr, *endStr, *uh, *un;
if (start < 0) {
start = 0;
@@ -3627,12 +3627,12 @@ TclStringFirst(
/* Don't start the loop if there cannot be a valid answer */
goto firstEnd;
}
- end = uh + lh;
+ endStr = uh + lh;
- for (check = uh + start; check + ln <= end; check++) {
- if ((*check == *un) && (0 ==
- memcmp(check + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) {
- value = (check - uh);
+ for (checkStr = uh + start; checkStr + ln <= endStr; checkStr++) {
+ if ((*checkStr == *un) && (0 ==
+ memcmp(checkStr + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) {
+ value = (checkStr - uh);
goto firstEnd;
}
}
@@ -3668,7 +3668,7 @@ TclStringLast(
int lh, ln = Tcl_GetCharLength(needle);
Tcl_Obj *result;
int value = -1;
- Tcl_UniChar *check, *uh, *un;
+ Tcl_UniChar *checkStr, *uh, *un;
if (ln == 0) {
/*
@@ -3714,14 +3714,14 @@ TclStringLast(
/* Don't start the loop if there cannot be a valid answer */
goto lastEnd;
}
- check = uh + last + 1 - ln;
- while (check >= uh) {
- if ((*check == un[0])
- && (0 == memcmp(check+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) {
- value = (check - uh);
+ checkStr = uh + last + 1 - ln;
+ while (checkStr >= uh) {
+ if ((*checkStr == un[0])
+ && (0 == memcmp(checkStr+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) {
+ value = (checkStr - uh);
goto lastEnd;
}
- check--;
+ checkStr--;
}
lastEnd:
TclNewIntObj(result, value);
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 5ebbfdd..1523666 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -7488,8 +7488,6 @@ TestconcatobjCmd(
"\n\t* (e) concatObj does not have refCount 0", NULL);
}
if (concatPtr == tmpPtr) {
- int len;
-
result = TCL_ERROR;
Tcl_AppendResult(interp, "\n\t* (e) concatObj is not a new obj ",
NULL);
@@ -7520,8 +7518,6 @@ TestconcatobjCmd(
"\n\t* (f) concatObj does not have refCount 0", NULL);
}
if (concatPtr == tmpPtr) {
- int len;
-
result = TCL_ERROR;
Tcl_AppendResult(interp, "\n\t* (f) concatObj is not a new obj ",
NULL);
@@ -7553,8 +7549,6 @@ TestconcatobjCmd(
"\n\t* (g) concatObj does not have refCount 0", NULL);
}
if (concatPtr == tmpPtr) {
- int len;
-
result = TCL_ERROR;
Tcl_AppendResult(interp, "\n\t* (g) concatObj is not a new obj ",
NULL);
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index 1b59852..cf9da4f 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -1177,7 +1177,7 @@ Tcl_UntraceCommand(
CommandTrace *tracePtr;
CommandTrace *prevPtr;
Command *cmdPtr;
- Interp *iPtr = (Interp *) interp;
+ Interp *iPtr = (Interp *)interp;
ActiveCommandTrace *activePtr;
int hasExecTraces = 0;
@@ -1252,7 +1252,6 @@ Tcl_UntraceCommand(
*/
if (cmdPtr->compileProc != NULL) {
- Interp *iPtr = (Interp *) interp;
iPtr->compileEpoch++;
}
}
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index f6d815b..170a85e 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -3757,7 +3757,7 @@ GetEndOffsetFromObj(
if (*bytes != 'e') {
int numType;
const char *opPtr;
- int length, t1 = 0, t2 = 0;
+ int t1 = 0, t2 = 0;
/* Value doesn't start with "e" */
@@ -3774,7 +3774,7 @@ GetEndOffsetFromObj(
* Quick scan to see if multi-value list is even possible.
* This relies on TclGetString() returning a NUL-terminated string.
*/
- if ((TclMaxListLength(TclGetString(objPtr), -1, NULL) > 1)
+ if ((TclMaxListLength(bytes, -1, NULL) > 1)
/* If it's possible, do the full list parse. */
&& (TCL_OK == Tcl_ListObjLength(NULL, objPtr, &length))
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 3d46790..a48cf96 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -119,17 +119,17 @@ VarHashNextVar(
* access is denied.
*/
-static const char *noSuchVar = "no such variable";
-static const char *isArray = "variable is array";
-static const char *needArray = "variable isn't array";
-static const char *noSuchElement = "no such element in array";
-static const char *danglingElement =
+static const char NOSUCHVAR[] = "no such variable";
+static const char ISARRAY[] = "variable is array";
+static const char NEEDARRAY[] = "variable isn't array";
+static const char NOSUCHELEMENT[] = "no such element in array";
+static const char DANGLINGELEMENT[] =
"upvar refers to element in deleted array";
-static const char *danglingVar =
+static const char DANGLINGVAR[] =
"upvar refers to variable in deleted namespace";
-static const char *badNamespace = "parent namespace doesn't exist";
-static const char *missingName = "missing variable name";
-static const char *isArrayElement =
+static const char BADNAMESPACE[] = "parent namespace doesn't exist";
+static const char MISSINGNAME[] = "missing variable name";
+static const char ISARRAYELEMENT[] =
"name refers to an element in an array";
/*
@@ -649,7 +649,7 @@ TclObjLookupVarEx(
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, msg,
- noSuchVar, -1);
+ NOSUCHVAR, -1);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "VARNAME", NULL);
}
return NULL;
@@ -674,7 +674,7 @@ TclObjLookupVarEx(
if (part2Ptr != NULL) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, msg,
- needArray, -1);
+ NEEDARRAY, -1);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "VARNAME",
NULL);
}
@@ -939,7 +939,7 @@ TclLookupSimpleVar(
Tcl_Obj *tailPtr;
if (!create) { /* Var wasn't found and not to create it. */
- *errMsgPtr = noSuchVar;
+ *errMsgPtr = NOSUCHVAR;
return NULL;
}
@@ -950,10 +950,10 @@ TclLookupSimpleVar(
TclGetNamespaceForQualName(interp, varName, cxtNsPtr, flags,
&varNsPtr, &dummy1Ptr, &dummy2Ptr, &tail);
if (varNsPtr == NULL) {
- *errMsgPtr = badNamespace;
+ *errMsgPtr = BADNAMESPACE;
return NULL;
} else if (tail == NULL) {
- *errMsgPtr = missingName;
+ *errMsgPtr = MISSINGNAME;
return NULL;
}
if (tail != varName) {
@@ -1010,7 +1010,7 @@ TclLookupSimpleVar(
varPtr = VarHashFindVar(tablePtr, varNamePtr);
}
if (varPtr == NULL) {
- *errMsgPtr = noSuchVar;
+ *errMsgPtr = NOSUCHVAR;
}
}
}
@@ -1088,7 +1088,7 @@ TclLookupArrayElement(
if (!createArray) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, arrayNamePtr, elNamePtr, msg,
- noSuchVar, index);
+ NOSUCHVAR, index);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARNAME",
arrayNamePtr?TclGetString(arrayNamePtr):NULL, NULL);
}
@@ -1103,7 +1103,7 @@ TclLookupArrayElement(
if (TclIsVarDeadHash(arrayPtr)) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, arrayNamePtr, elNamePtr, msg,
- danglingVar, index);
+ DANGLINGVAR, index);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARNAME",
arrayNamePtr?TclGetString(arrayNamePtr):NULL, NULL);
}
@@ -1113,7 +1113,7 @@ TclLookupArrayElement(
TclInitArrayVar(arrayPtr);
} else if (!TclIsVarArray(arrayPtr)) {
if (flags & TCL_LEAVE_ERR_MSG) {
- TclObjVarErrMsg(interp, arrayNamePtr, elNamePtr, msg, needArray,
+ TclObjVarErrMsg(interp, arrayNamePtr, elNamePtr, msg, NEEDARRAY,
index);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARNAME",
arrayNamePtr?TclGetString(arrayNamePtr):NULL, NULL);
@@ -1135,7 +1135,7 @@ TclLookupArrayElement(
if (varPtr == NULL) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, arrayNamePtr, elNamePtr, msg,
- noSuchElement, index);
+ NOSUCHELEMENT, index);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ELEMENT",
TclGetString(elNamePtr), NULL);
}
@@ -1485,11 +1485,11 @@ TclPtrGetVarIdx(
if (flags & TCL_LEAVE_ERR_MSG) {
if (TclIsVarUndefined(varPtr) && arrayPtr
&& !TclIsVarUndefined(arrayPtr)) {
- msg = noSuchElement;
+ msg = NOSUCHELEMENT;
} else if (TclIsVarArray(varPtr)) {
- msg = isArray;
+ msg = ISARRAY;
} else {
- msg = noSuchVar;
+ msg = NOSUCHVAR;
}
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "read", msg, index);
}
@@ -2024,11 +2024,11 @@ TclPtrSetVarIdx(
if (flags & TCL_LEAVE_ERR_MSG) {
if (TclIsVarArrayElement(varPtr)) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "set",
- danglingElement, index);
+ DANGLINGELEMENT, index);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ELEMENT", NULL);
} else {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "set",
- danglingVar, index);
+ DANGLINGVAR, index);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARNAME", NULL);
}
}
@@ -2041,7 +2041,7 @@ TclPtrSetVarIdx(
if (TclIsVarArray(varPtr)) {
if (flags & TCL_LEAVE_ERR_MSG) {
- TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "set", isArray,index);
+ TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "set", ISARRAY,index);
Tcl_SetErrorCode(interp, "TCL", "WRITE", "ARRAY", NULL);
}
goto earlyError;
@@ -2609,7 +2609,7 @@ TclPtrUnsetVarIdx(
if (result != TCL_OK) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "unset",
- ((arrayPtr == NULL) ? noSuchVar : noSuchElement), index);
+ ((arrayPtr == NULL) ? NOSUCHVAR : NOSUCHELEMENT), index);
Tcl_SetErrorCode(interp, "TCL", "UNSET", "VARNAME", NULL);
}
}
@@ -4104,7 +4104,7 @@ ArraySetCmd(
}
if (arrayPtr) {
CleanupVar(varPtr, arrayPtr);
- TclObjVarErrMsg(interp, arrayNameObj, NULL, "set", needArray, -1);
+ TclObjVarErrMsg(interp, arrayNameObj, NULL, "set", NEEDARRAY, -1);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARNAME",
TclGetString(arrayNameObj), NULL);
return TCL_ERROR;
@@ -4223,7 +4223,7 @@ ArraySetCmd(
*/
TclObjVarErrMsg(interp, arrayNameObj, NULL, "array set",
- needArray, -1);
+ NEEDARRAY, -1);
Tcl_SetErrorCode(interp, "TCL", "WRITE", "ARRAY", NULL);
return TCL_ERROR;
}
@@ -5124,7 +5124,7 @@ Tcl_VariableObjCmd(
*/
TclObjVarErrMsg(interp, varNamePtr, NULL, "define",
- isArrayElement, -1);
+ ISARRAYELEMENT, -1);
Tcl_SetErrorCode(interp, "TCL", "UPVAR", "LOCAL_ELEMENT", NULL);
return TCL_ERROR;
}
@@ -6702,7 +6702,7 @@ ArrayDefaultCmd(
CleanupVar(varPtr, arrayPtr);
TclObjVarErrMsg(interp, arrayNameObj, NULL, "array default set",
- needArray, -1);
+ NEEDARRAY, -1);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "VARNAME",
TclGetString(arrayNameObj), NULL);
return TCL_ERROR;
@@ -6713,7 +6713,7 @@ ArrayDefaultCmd(
*/
TclObjVarErrMsg(interp, arrayNameObj, NULL, "array default set",
- needArray, -1);
+ NEEDARRAY, -1);
Tcl_SetErrorCode(interp, "TCL", "WRITE", "ARRAY", NULL);
return TCL_ERROR;
}
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 34bf78d..5254b84 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -3945,7 +3945,7 @@ TclZlibInit(
cfg[0].key = "zlibVersion";
cfg[0].value = zlibVersion();
cfg[1].key = NULL;
- Tcl_RegisterConfig(interp, "zlib", cfg, "iso8859-1");
+ Tcl_RegisterConfig(interp, "zlib", cfg, "utf-8");
/*
* Allow command type introspection to do something sensible with streams.
diff --git a/library/http/http.tcl b/library/http/http.tcl
index eec05b8..df8fe2d 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -746,6 +746,7 @@ proc http::geturl {url args} {
-strict boolean
-timeout integer
-validate boolean
+ -headers dict
}
set state(charset) $defaultCharset
set options {
@@ -759,9 +760,8 @@ proc http::geturl {url args} {
foreach {flag value} $args {
if {[regexp -- $pat $flag]} {
# Validate numbers
- if {
- [info exists type($flag)] &&
- ![string is $type($flag) -strict $value]
+ if {($flag eq "-headers") ? [catch {dict size $value}] :
+ ([info exists type($flag)] && ![string is $type($flag) -strict $value])
} {
unset $token
return -code error \
diff --git a/macosx/Tcl-Common.xcconfig b/macosx/Tcl-Common.xcconfig
index 0670479..39301db 100644
--- a/macosx/Tcl-Common.xcconfig
+++ b/macosx/Tcl-Common.xcconfig
@@ -19,7 +19,7 @@ GCC_NO_COMMON_BLOCKS = YES
GCC_DYNAMIC_NO_PIC = YES
GCC_VERSION = 4.2
GCC = gcc-$(GCC_VERSION)
-WARNING_CFLAGS = -Wall -Wwrite-strings -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-value -Winit-self -Wpointer-arith -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS)
+WARNING_CFLAGS = -Wall -Wextra -Wshadow -Wwrite-strings -Wpointer-arith -Wc++-compat -Wdeclaration-after-statement -Winit-self -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS)
BINDIR = $(PREFIX)/bin
CFLAGS = $(CFLAGS)
CPPFLAGS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) $(CPPFLAGS)
diff --git a/tests/http.test b/tests/http.test
index 7454ab8..a525691 100644
--- a/tests/http.test
+++ b/tests/http.test
@@ -444,6 +444,9 @@ test http-3.33 {http::geturl application/xml is text} -body {
} -cleanup {
catch { http::cleanup $token }
} -result {test 4660 /test}
+test http-3.34 {http::geturl -headers not a dict} -returnCodes error -body {
+ http::geturl http://test/t -headers NoDict
+} -result {Bad value for -headers (NoDict), must be dict}
test http-4.1 {http::Event} -body {
set token [http::geturl $url -keepalive 0]
diff --git a/tests/interp.test b/tests/interp.test
index 4453d90..f428207 100644
--- a/tests/interp.test
+++ b/tests/interp.test
@@ -32,7 +32,7 @@ test interp-1.1 {options for interp command} -returnCodes error -body {
} -result {wrong # args: should be "interp cmd ?arg ...?"}
test interp-1.2 {options for interp command} -returnCodes error -body {
interp frobox
-} -result {bad option "frobox": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
+} -result {bad option "frobox": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, share, target, or transfer}
test interp-1.3 {options for interp command} {
interp delete
} ""
@@ -50,13 +50,13 @@ test interp-1.6 {options for interp command} -returnCodes error -body {
} -result {wrong # args: should be "interp children ?path?"}
test interp-1.7 {options for interp command} -returnCodes error -body {
interp hello
-} -result {bad option "hello": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
+} -result {bad option "hello": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, share, target, or transfer}
test interp-1.8 {options for interp command} -returnCodes error -body {
interp -froboz
-} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
+} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, share, target, or transfer}
test interp-1.9 {options for interp command} -returnCodes error -body {
interp -froboz -safe
-} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
+} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, share, target, or transfer}
test interp-1.10 {options for interp command} -returnCodes error -body {
interp target
} -result {wrong # args: should be "interp target path alias"}
diff --git a/unix/configure b/unix/configure
index d48d687..6cb5f24 100755
--- a/unix/configure
+++ b/unix/configure
@@ -5036,7 +5036,7 @@ fi
if test "$GCC" = yes; then :
CFLAGS_OPTIMIZE=-O2
- CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wwrite-strings -Wpointer-arith"
case "${CC}" in
*++|*++-*)
;;
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index a4824ff..3050bf2 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -966,7 +966,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_DEBUG=-g
AS_IF([test "$GCC" = yes], [
CFLAGS_OPTIMIZE=-O2
- CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wwrite-strings -Wpointer-arith"
case "${CC}" in
*++|*++-*)
;;
diff --git a/win/configure b/win/configure
index b08eb15..828b1d3 100755
--- a/win/configure
+++ b/win/configure
@@ -4215,7 +4215,7 @@ $as_echo "using shared flags" >&6; }
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wwrite-strings -Wpointer-arith"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
diff --git a/win/tcl.m4 b/win/tcl.m4
index 0fd2271..83cfa6b 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -673,7 +673,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith"
+ CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wwrite-strings -Wpointer-arith"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index d2777d7..89f485a 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1094,7 +1094,6 @@ TclpMatchInDirectory(
do {
const char *utfname;
int checkDrive = 0, isDrive;
- DWORD attr;
native = data.cFileName;
attr = data.dwFileAttributes;
@@ -1445,7 +1444,6 @@ TclpGetUserHome(
int rc = 0;
const char *domain;
WCHAR *wName, *wHomeDir, *wDomain;
- WCHAR buf[MAX_PATH];
Tcl_DStringInit(bufferPtr);
@@ -1511,6 +1509,7 @@ TclpGetUserHome(
size = lstrlenW(wHomeDir);
Tcl_WCharToUtfDString(wHomeDir, size, bufferPtr);
} else {
+ WCHAR buf[MAX_PATH];
/*
* User exists but has no home dir. Return
* "{GetProfilesDirectory}/<user>".
@@ -2818,7 +2817,6 @@ TclpObjNormalizePath(
*/
int len;
- char *path;
Tcl_Obj *tmpPathPtr;
tmpPathPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds),
diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c
index 328fbad..f0035b9 100644
--- a/win/tclWinSerial.c
+++ b/win/tclWinSerial.c
@@ -1826,7 +1826,7 @@ SerialSetOptionProc(
*/
if ((len > 4) && (strncmp(optionName, "-ttycontrol", len) == 0)) {
- int i, result = TCL_OK;
+ int i, res = TCL_OK;
if (Tcl_SplitList(interp, value, &argc, &argv) == TCL_ERROR) {
return TCL_ERROR;
@@ -1844,7 +1844,7 @@ SerialSetOptionProc(
for (i = 0; i < argc - 1; i += 2) {
if (Tcl_GetBoolean(interp, argv[i+1], &flag) == TCL_ERROR) {
- result = TCL_ERROR;
+ res = TCL_ERROR;
break;
}
if (strncasecmp(argv[i], "DTR", strlen(argv[i])) == 0) {
@@ -1856,7 +1856,7 @@ SerialSetOptionProc(
Tcl_SetErrorCode(interp, "TCL", "OPERATION",
"FCONFIGURE", "TTY_SIGNAL", NULL);
}
- result = TCL_ERROR;
+ res = TCL_ERROR;
break;
}
} else if (strncasecmp(argv[i], "RTS", strlen(argv[i])) == 0) {
@@ -1868,7 +1868,7 @@ SerialSetOptionProc(
Tcl_SetErrorCode(interp, "TCL", "OPERATION",
"FCONFIGURE", "TTY_SIGNAL", NULL);
}
- result = TCL_ERROR;
+ res = TCL_ERROR;
break;
}
} else if (strncasecmp(argv[i], "BREAK", strlen(argv[i])) == 0) {
@@ -1880,7 +1880,7 @@ SerialSetOptionProc(
Tcl_SetErrorCode(interp, "TCL", "OPERATION",
"FCONFIGURE", "TTY_SIGNAL", NULL);
}
- result = TCL_ERROR;
+ res = TCL_ERROR;
break;
}
} else {
@@ -1891,13 +1891,13 @@ SerialSetOptionProc(
Tcl_SetErrorCode(interp, "TCL", "VALUE", "TTY_SIGNAL",
NULL);
}
- result = TCL_ERROR;
+ res = TCL_ERROR;
break;
}
}
ckfree(argv);
- return result;
+ return res;
}
/*