summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-11 12:56:29 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-11 12:56:29 (GMT)
commit524b1d9fb207987cf66ca92d5198e30e27e0931e (patch)
tree03481b58a31f0fcf82158c6c66891c88725e957f
parentf796d623675cfb8a59b1c190470f785c61b90a8e (diff)
parent7f62b768876fc8b0779d10ae3fcba1fc7aeaba04 (diff)
downloadtcl-524b1d9fb207987cf66ca92d5198e30e27e0931e.zip
tcl-524b1d9fb207987cf66ca92d5198e30e27e0931e.tar.gz
tcl-524b1d9fb207987cf66ca92d5198e30e27e0931e.tar.bz2
Merge 8.6. Remove tests/safe-stock86.test for win builds too (GIT, what are you doing ...!)
-rw-r--r--generic/tclBinary.c2
-rw-r--r--generic/tclCompile.h6
-rw-r--r--generic/tclEncoding.c2
-rw-r--r--generic/tclIO.h2
-rw-r--r--generic/tclInt.h10
-rw-r--r--generic/tclObj.c22
-rw-r--r--generic/tclProc.c7
-rw-r--r--generic/tclStringRep.h2
-rw-r--r--win/Makefile.in1
9 files changed, 31 insertions, 23 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index bb82fe7..168d399 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -274,7 +274,7 @@ typedef struct ByteArray {
* array. */
unsigned int allocated; /* The amount of space actually allocated
* minus 1 byte. */
- unsigned char bytes[1]; /* The array of bytes. The actual size of this
+ unsigned char bytes[TCLFLEXARRAY]; /* The array of bytes. The actual size of this
* field depends on the 'allocated' field
* above. */
} ByteArray;
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index 5c1b67c..21a27f7 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -991,7 +991,7 @@ typedef struct JumpFixupArray {
typedef struct ForeachVarList {
int numVars; /* The number of variables in the list. */
- int varIndexes[1]; /* An array of the indexes ("slot numbers")
+ int varIndexes[TCLFLEXARRAY];/* An array of the indexes ("slot numbers")
* for each variable in the procedure's array
* of local variables. Only scalar variables
* are supported. The actual size of this
@@ -1015,7 +1015,7 @@ typedef struct ForeachInfo {
* the loop's iteration count. Used to
* determine next value list element to assign
* each loop var. */
- ForeachVarList *varLists[1];/* An array of pointers to ForeachVarList
+ ForeachVarList *varLists[TCLFLEXARRAY];/* An array of pointers to ForeachVarList
* structures describing each var list. The
* actual size of this field will be large
* enough to numVars indexes. THIS MUST BE THE
@@ -1046,7 +1046,7 @@ MODULE_SCOPE const AuxDataType tclJumptableInfoType;
typedef struct {
int length; /* Size of array */
- int varIndices[1]; /* Array of variable indices to manage when
+ int varIndices[TCLFLEXARRAY]; /* Array of variable indices to manage when
* processing the start and end of a [dict
* update]. There is really more than one
* entry, and the structure is allocated to
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index c774ce2..3efbb74 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -116,7 +116,7 @@ typedef struct {
* entry in this array is 1, otherwise it is
* 0. */
int numSubTables; /* Length of following array. */
- EscapeSubTable subTables[1];/* Information about each EscapeSubTable used
+ EscapeSubTable subTables[TCLFLEXARRAY];/* Information about each EscapeSubTable used
* by this encoding type. The actual size is
* as large as necessary to hold all
* EscapeSubTables. */
diff --git a/generic/tclIO.h b/generic/tclIO.h
index d10f268..54aa5af 100644
--- a/generic/tclIO.h
+++ b/generic/tclIO.h
@@ -44,7 +44,7 @@ typedef struct ChannelBuffer {
int bufLength; /* How big is the buffer? */
struct ChannelBuffer *nextPtr;
/* Next buffer in chain. */
- char buf[1]; /* Placeholder for real buffer. The real
+ char buf[TCLFLEXARRAY]; /* Placeholder for real buffer. The real
* buffer occuppies this space + bufSize-1
* bytes. This must be the last field in the
* structure. */
diff --git a/generic/tclInt.h b/generic/tclInt.h
index b983b81..d79937f 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -925,6 +925,12 @@ typedef struct VarInHash {
*----------------------------------------------------------------
*/
+#if defined(__GNUC__) && (__GNUC__ > 2)
+# define TCLFLEXARRAY 0
+#else
+# define TCLFLEXARRAY 1
+#endif
+
/*
* Forward declaration to prevent an error when the forward reference to
* Command is encountered in the Proc and ImportRef types declared below.
@@ -968,7 +974,7 @@ typedef struct CompiledLocal {
* is marked by a unique tag during
* compilation, and that same tag is used to
* find the variable at runtime. */
- char name[1]; /* Name of the local variable starts here. If
+ char name[TCLFLEXARRAY]; /* Name of the local variable starts here. If
* the name is NULL, this will just be '\0'.
* The actual size of this field will be large
* enough to hold the name. MUST BE THE LAST
@@ -1306,7 +1312,7 @@ typedef struct CFWordBC {
typedef struct ContLineLoc {
int num; /* Number of entries in loc, not counting the
* final -1 marker entry. */
- int loc[1]; /* Table of locations, as character offsets.
+ int loc[TCLFLEXARRAY];/* Table of locations, as character offsets.
* The table is allocated as part of the
* structure, extending behind the nominal end
* of the structure. An entry containing the
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 44b2785..e58206b 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -145,12 +145,12 @@ typedef struct PendingObjData {
#define ObjDeletionUnlock(contextPtr) ((contextPtr)->deletionCount--)
#define ObjDeletePending(contextPtr) ((contextPtr)->deletionCount > 0)
#define ObjOnStack(contextPtr) ((contextPtr)->deletionStack != NULL)
-#define PushObjToDelete(contextPtr,objPtr) \
+#define PushObjToDelete(contextPtr,objPtr) \
/* The string rep is already invalidated so we can use the bytes value \
* for our pointer chain: push onto the head of the stack. */ \
(objPtr)->bytes = (char *) ((contextPtr)->deletionStack); \
(contextPtr)->deletionStack = (objPtr)
-#define PopObjToDelete(contextPtr,objPtrVar) \
+#define PopObjToDelete(contextPtr,objPtrVar) \
(objPtrVar) = (contextPtr)->deletionStack; \
(contextPtr)->deletionStack = (Tcl_Obj *) (objPtrVar)->bytes
@@ -168,7 +168,7 @@ static __thread PendingObjData pendingObjData;
#else
static Tcl_ThreadDataKey pendingObjDataKey;
#define ObjInitDeletionContext(contextPtr) \
- PendingObjData *const contextPtr = \
+ PendingObjData *const contextPtr = \
(PendingObjData *)Tcl_GetThreadData(&pendingObjDataKey, sizeof(PendingObjData))
#endif
@@ -177,15 +177,15 @@ static Tcl_ThreadDataKey pendingObjDataKey;
*/
#define PACK_BIGNUM(bignum, objPtr) \
- if ((bignum).used > 0x7FFF) { \
- mp_int *temp = (mp_int *) ckalloc(sizeof(mp_int)); \
+ if ((bignum).used > 0x7FFF) { \
+ mp_int *temp = (mp_int *)ckalloc(sizeof(mp_int)); \
*temp = bignum; \
- (objPtr)->internalRep.twoPtrValue.ptr1 = temp; \
- (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(-1); \
+ (objPtr)->internalRep.twoPtrValue.ptr1 = temp; \
+ (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(-1); \
} else if (((bignum).alloc <= 0x7FFF) || (mp_shrink(&(bignum))) == MP_OKAY) { \
- (objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (bignum).dp; \
- (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR( ((bignum).sign << 30) \
- | ((bignum).alloc << 15) | ((bignum).used)); \
+ (objPtr)->internalRep.twoPtrValue.ptr1 = (void *)(bignum).dp; \
+ (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(((bignum).sign << 30) \
+ | ((bignum).alloc << 15) | ((bignum).used)); \
}
/*
@@ -567,7 +567,7 @@ TclContinuationsEnter(
ThreadSpecificData *tsdPtr = TclGetContLineTable();
Tcl_HashEntry *hPtr =
Tcl_CreateHashEntry(tsdPtr->lineCLPtr, objPtr, &newEntry);
- ContLineLoc *clLocPtr = (ContLineLoc *)ckalloc(sizeof(ContLineLoc) + num*sizeof(int));
+ ContLineLoc *clLocPtr = (ContLineLoc *)ckalloc(offsetof(ContLineLoc, loc) + (num + 1) *sizeof(int));
if (!newEntry) {
/*
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 0d67c37..67c8c41 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -632,7 +632,8 @@ TclCreateProc(
* local variables for the argument.
*/
- localPtr = (CompiledLocal *)ckalloc(offsetof(CompiledLocal, name) + fieldValues[0]->length +1);
+ localPtr = (CompiledLocal *)ckalloc(
+ offsetof(CompiledLocal, name) + fieldValues[0]->length + 1);
if (procPtr->firstLocalPtr == NULL) {
procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr;
} else {
@@ -1313,8 +1314,8 @@ InitLocalCache(
* for future calls.
*/
- localCachePtr = (LocalCache *)ckalloc(sizeof(LocalCache)
- + (localCt - 1) * sizeof(Tcl_Obj *)
+ localCachePtr = (LocalCache *)ckalloc(offsetof(LocalCache, varName0)
+ + localCt * sizeof(Tcl_Obj *)
+ numArgs * sizeof(Var));
namePtr = &localCachePtr->varName0;
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h
index 1ad78a1..e01ba2d 100644
--- a/generic/tclStringRep.h
+++ b/generic/tclStringRep.h
@@ -59,7 +59,7 @@ typedef struct {
* space allocated for the unicode array. */
int hasUnicode; /* Boolean determining whether the string has
* a Unicode representation. */
- Tcl_UniChar unicode[1]; /* The array of Unicode chars. The actual size
+ Tcl_UniChar unicode[TCLFLEXARRAY]; /* The array of Unicode chars. The actual size
* of this field depends on the 'maxChars'
* field above. */
} String;
diff --git a/win/Makefile.in b/win/Makefile.in
index 68ca858..b039edd 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -596,6 +596,7 @@ ${TEST_DLL_FILE}: ${TCL_STUB_LIB_FILE} ${TCLTEST_OBJS}
${TEST_EXE_FILE}: ${TCL_STUB_LIB_FILE} ${TCLTEST_OBJS} tclTestMain.${OBJEXT}
@$(RM) ${TEST_EXE_FILE}
+ @$(RM) $(ROOT_DIR_NATIVE)/tests/safe-stock86.test
$(CC) $(CFLAGS) $(TCLTEST_OBJS) tclTestMain.$(OBJEXT) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \
tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE)
$(COPY) tclsh.exe.manifest ${TEST_EXE_FILE}.manifest