summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompExpr.c5
-rw-r--r--generic/tclExecute.c6
-rw-r--r--generic/tclFCmd.c3
-rw-r--r--generic/tclIO.c3
-rw-r--r--generic/tclProc.c60
-rw-r--r--generic/tclScan.c6
-rw-r--r--generic/tclTimer.c4
-rw-r--r--generic/tclUtf.c4
8 files changed, 52 insertions, 39 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 48f3cc1..47c8671 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompExpr.c,v 1.99 2009/01/09 11:21:45 dkf Exp $
+ * RCS: @(#) $Id: tclCompExpr.c,v 1.100 2009/09/07 07:28:38 das Exp $
*/
#include "tclInt.h"
@@ -2231,6 +2231,7 @@ CompileExprTree(
TclEmitForwardJump(envPtr, TCL_FALSE_JUMP, &(jumpPtr->jump));
break;
case COLON:
+ CLANG_ASSERT(jumpPtr);
TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP,
&(jumpPtr->next->jump));
envPtr->currStackDepth = jumpPtr->depth;
@@ -2284,6 +2285,7 @@ CompileExprTree(
numWords++;
break;
case COLON:
+ CLANG_ASSERT(jumpPtr);
if (TclFixupForwardJump(envPtr, &(jumpPtr->next->jump),
(envPtr->codeNext - envPtr->codeStart)
- jumpPtr->next->jump.codeOffset, 127)) {
@@ -2302,6 +2304,7 @@ CompileExprTree(
break;
case AND:
case OR:
+ CLANG_ASSERT(jumpPtr);
TclEmitForwardJump(envPtr, (nodePtr->lexeme == AND)
? TCL_FALSE_JUMP : TCL_TRUE_JUMP,
&(jumpPtr->next->jump));
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 662d2a0..778b679 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.445 2009/09/04 17:33:11 dgp Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.446 2009/09/07 07:28:38 das Exp $
*/
#include "tclInt.h"
@@ -2850,6 +2850,7 @@ TclExecuteByteCode(
case INST_INVOKE_EXPANDED:
{
+ CLANG_ASSERT(auxObjList);
objc = CURR_DEPTH
- (ptrdiff_t) auxObjList->internalRep.twoPtrValue.ptr1;
POP_AUX_OBJ();
@@ -4546,7 +4547,7 @@ TclExecuteByteCode(
if (o != NULL) {
s2 = TclGetStringFromObj(o, &s2len);
} else {
- s2 = "";
+ s2 = ""; s2len = 0;
}
if (s1len == s2len) {
found = (strcmp(s1, s2) == 0);
@@ -7969,6 +7970,7 @@ TclExecuteByteCode(
(unsigned) CURR_DEPTH, (unsigned) 0);
Tcl_Panic("TclExecuteByteCode execution failure: end stack top < start stack top");
}
+ CLANG_ASSERT(bcFramePtr);
}
oldBottomPtr = bottomPtr->prevBottomPtr;
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c
index 0e78c4b..6e84177 100644
--- a/generic/tclFCmd.c
+++ b/generic/tclFCmd.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclFCmd.c,v 1.49 2008/10/06 21:00:37 patthoyts Exp $
+ * RCS: @(#) $Id: tclFCmd.c,v 1.50 2009/09/07 07:28:38 das Exp $
*/
#include "tclInt.h"
@@ -754,6 +754,7 @@ CopyRenameOneFile(
if (S_ISDIR(sourceStatBuf.st_mode)) {
result = Tcl_FSRemoveDirectory(source, 1, &errorBuffer);
if (result != TCL_OK) {
+ errfile = errorBuffer;
if (Tcl_FSEqualPaths(errfile, source) == 0) {
errfile = source;
}
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 4f676e6..6ace57a 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIO.c,v 1.160 2009/07/23 22:49:15 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclIO.c,v 1.161 2009/09/07 07:28:38 das Exp $
*/
#include "tclInt.h"
@@ -8565,6 +8565,7 @@ DeleteScriptRecord(
if (esPtr == statePtr->scriptRecordPtr) {
statePtr->scriptRecordPtr = esPtr->nextPtr;
} else {
+ CLANG_ASSERT(prevEsPtr);
prevEsPtr->nextPtr = esPtr->nextPtr;
}
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 12e19da..4eb6c17 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclProc.c,v 1.174 2009/08/25 21:03:25 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclProc.c,v 1.175 2009/09/07 07:28:38 das Exp $
*/
#include "tclInt.h"
@@ -1086,26 +1086,6 @@ TclIsProc(
return NULL;
}
-/*
- *----------------------------------------------------------------------
- *
- * InitArgsAndLocals --
- *
- * This routine is invoked in order to initialize the arguments and other
- * compiled locals table for a new call frame.
- *
- * Results:
- * A standard Tcl result.
- *
- * Side effects:
- * Allocates memory on the stack for the compiled local variables, the
- * caller is responsible for freeing them. Initialises all variables. May
- * invoke various name resolvers in order to determine which variables
- * are being referenced at runtime.
- *
- *----------------------------------------------------------------------
- */
-
static int
ProcWrongNumArgs(
Tcl_Interp *interp,
@@ -1175,7 +1155,6 @@ ProcWrongNumArgs(
* DEPRECATED: functionality has been inlined elsewhere; this function
* remains to insure binary compatibility with Itcl.
*
-
* Results:
* None.
*
@@ -1185,6 +1164,7 @@ ProcWrongNumArgs(
*
*----------------------------------------------------------------------
*/
+
void
TclInitCompiledLocals(
Tcl_Interp *interp, /* Current interpreter. */
@@ -1337,7 +1317,7 @@ InitResolvedLocals(
}
}
}
-
+
void
TclFreeLocalCache(
Tcl_Interp *interp,
@@ -1364,7 +1344,7 @@ TclFreeLocalCache(
}
ckfree((char *) localCachePtr);
}
-
+
static void
InitLocalCache(
Proc *procPtr)
@@ -1416,6 +1396,26 @@ InitLocalCache(
localCachePtr->refCount = 1;
localCachePtr->numVars = localCt;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * InitArgsAndLocals --
+ *
+ * This routine is invoked in order to initialize the arguments and other
+ * compiled locals table for a new call frame.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * Allocates memory on the stack for the compiled local variables, the
+ * caller is responsible for freeing them. Initialises all variables. May
+ * invoke various name resolvers in order to determine which variables
+ * are being referenced at runtime.
+ *
+ *----------------------------------------------------------------------
+ */
static int
InitArgsAndLocals(
@@ -1477,7 +1477,7 @@ InitArgsAndLocals(
}
}
imax = ((argCt < numArgs-1) ? argCt : numArgs-1);
- for (i = 0; i < imax; i++, varPtr++, defPtr++) {
+ for (i = 0; i < imax; i++, varPtr++, defPtr ? defPtr++ : defPtr) {
/*
* "Normal" arguments; last formal is special, depends on it being
* 'args'.
@@ -1489,13 +1489,13 @@ InitArgsAndLocals(
varPtr->value.objPtr = objPtr;
Tcl_IncrRefCount(objPtr); /* Local var is a reference. */
}
- for (; i < numArgs-1; i++, varPtr++, defPtr++) {
+ for (; i < numArgs-1; i++, varPtr++, defPtr ? defPtr++ : defPtr) {
/*
* This loop is entered if argCt < (numArgs-1). Set default values;
* last formal is special.
*/
- Tcl_Obj *objPtr = defPtr->value.objPtr;
+ Tcl_Obj *objPtr = defPtr ? defPtr->value.objPtr : NULL;
if (!objPtr) {
goto incorrectArgs;
@@ -1511,7 +1511,7 @@ InitArgsAndLocals(
*/
varPtr->flags = 0;
- if (defPtr->flags & VAR_IS_ARGS) {
+ if (defPtr && defPtr->flags & VAR_IS_ARGS) {
Tcl_Obj *listPtr = Tcl_NewListObj(argCt-i, argObjs+i);
varPtr->value.objPtr = listPtr;
@@ -1521,7 +1521,7 @@ InitArgsAndLocals(
varPtr->value.objPtr = objPtr;
Tcl_IncrRefCount(objPtr); /* Local var is a reference. */
- } else if ((argCt < numArgs) && (defPtr->value.objPtr != NULL)) {
+ } else if ((argCt < numArgs) && defPtr && defPtr->value.objPtr) {
Tcl_Obj *objPtr = defPtr->value.objPtr;
varPtr->value.objPtr = objPtr;
@@ -3003,6 +3003,8 @@ Tcl_DisassembleObjCmd(
}
codeObjPtr = procPtr->bodyPtr;
break;
+ default:
+ CLANG_ASSERT(0);
}
/*
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 47fa025..f5ec509 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclScan.c,v 1.32 2009/07/16 21:24:40 dgp Exp $
+ * RCS: @(#) $Id: tclScan.c,v 1.33 2009/09/07 07:28:38 das Exp $
*/
#include "tclInt.h"
@@ -712,6 +712,7 @@ Tcl_ScanObjCmd(
if (!(flags & SCAN_SUPPRESS)) {
objPtr = Tcl_NewIntObj(string - baseString);
Tcl_IncrRefCount(objPtr);
+ CLANG_ASSERT(objs);
objs[objIndex++] = objPtr;
}
nconversions++;
@@ -819,6 +820,7 @@ Tcl_ScanObjCmd(
if (!(flags & SCAN_SUPPRESS)) {
objPtr = Tcl_NewStringObj(string, end-string);
Tcl_IncrRefCount(objPtr);
+ CLANG_ASSERT(objs);
objs[objIndex++] = objPtr;
}
string = end;
@@ -869,6 +871,7 @@ Tcl_ScanObjCmd(
if (!(flags & SCAN_SUPPRESS)) {
objPtr = Tcl_NewIntObj((int)sch);
Tcl_IncrRefCount(objPtr);
+ CLANG_ASSERT(objs);
objs[objIndex++] = objPtr;
}
break;
@@ -973,6 +976,7 @@ Tcl_ScanObjCmd(
}
}
Tcl_SetDoubleObj(objPtr, dvalue);
+ CLANG_ASSERT(objs);
objs[objIndex++] = objPtr;
string = end;
}
diff --git a/generic/tclTimer.c b/generic/tclTimer.c
index 94a8c16..4f40490 100644
--- a/generic/tclTimer.c
+++ b/generic/tclTimer.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTimer.c,v 1.39 2009/02/10 23:09:04 nijtmans Exp $
+ * RCS: @(#) $Id: tclTimer.c,v 1.40 2009/09/07 07:28:38 das Exp $
*/
#include "tclInt.h"
@@ -778,7 +778,7 @@ Tcl_AfterObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tcl_WideInt ms; /* Number of milliseconds to wait */
+ Tcl_WideInt ms = 0; /* Number of milliseconds to wait */
Tcl_Time wakeup;
AfterInfo *afterPtr;
AfterAssocData *assocPtr;
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 16acab2..31e52ba 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUtf.c,v 1.39 2009/02/11 15:28:59 dgp Exp $
+ * RCS: @(#) $Id: tclUtf.c,v 1.40 2009/09/07 07:28:38 das Exp $
*/
#include "tclInt.h"
@@ -707,7 +707,7 @@ Tcl_UniCharAtIndex(
register const char *src, /* The UTF-8 string to dereference. */
register int index) /* The position of the desired character. */
{
- Tcl_UniChar ch;
+ Tcl_UniChar ch = 0;
while (index >= 0) {
index--;