summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-29 12:51:24 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-29 12:51:24 (GMT)
commit05301b57c56276fe90f0696d9e312eff2f67c993 (patch)
treefe6634871841e367400ebb05c56970f5741cb369
parent2ea6a13c20ca3d08cfe79d7254f5e5631ae31568 (diff)
parent2342babe990ebbf9e046143ce965996fc5701abc (diff)
downloadtcl-05301b57c56276fe90f0696d9e312eff2f67c993.zip
tcl-05301b57c56276fe90f0696d9e312eff2f67c993.tar.gz
tcl-05301b57c56276fe90f0696d9e312eff2f67c993.tar.bz2
Merge 8.7
-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/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--macosx/Tcl-Common.xcconfig2
-rw-r--r--tests/compile.test2
-rw-r--r--tests/winDde.test2
-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
21 files changed, 88 insertions, 97 deletions
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 c413b21..3591431 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/tclPkg.c b/generic/tclPkg.c
index a415191..c26e792 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/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/compile.test b/tests/compile.test
index b90f124..37bd034 100644
--- a/tests/compile.test
+++ b/tests/compile.test
@@ -500,7 +500,7 @@ test compile-13.2 {TclCompileScript: testing expected nested scripts compilation
# with 1500 (1000 in debug) nested scripts (bodies). If you get SO/SF exceptions on some low-stack
# boxes or systems, please don't decrease it (either provide a constraint)
ti eval {foreach cmd {eval "if 1" try catch} {
- set c [gencode [expr {![::tcl::pkgconfig get debug] ? 1500 : 1000}] $cmd]
+ set c [gencode [expr {"debug" ni [split [package provide Tcl] .] ? 1500 : 1000}] $cmd]
if 1 $c
}}
ti eval {set result}
diff --git a/tests/winDde.test b/tests/winDde.test
index 99ac8af..c76525f 100644
--- a/tests/winDde.test
+++ b/tests/winDde.test
@@ -14,7 +14,7 @@ if {"::tcltest" ni [namespace children]} {
namespace import -force ::tcltest::*
}
-testConstraint debug [::tcl::pkgconfig get debug]
+testConstraint debug [expr {"debug" in [split [package provide Tcl] .]}]
testConstraint dde 0
if {[testConstraint win]} {
if {![catch {
diff --git a/unix/configure b/unix/configure
index d3a4856..29857ce 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 056cf1f..ea3d968 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 f099510..7ad386c 100755
--- a/win/configure
+++ b/win/configure
@@ -4216,7 +4216,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 4824e8e..989ea76 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;
}
/*