From a33b0950bea676a85d343c325899ec36b8889d3d Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 3 Jul 2019 20:10:17 +0000 Subject: Tcl_ObjectDeleted was only partially documented. Oops. --- doc/Class.3 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/Class.3 b/doc/Class.3 index 1c3fe08..57203d5 100644 --- a/doc/Class.3 +++ b/doc/Class.3 @@ -79,7 +79,9 @@ The number of elements in the \fIobjv\fR array. The arguments to the command to create the instance of the class. .AP int skip in The number of arguments at the start of the argument array, \fIobjv\fR, that -are not arguments to any constructors. +are not arguments to any constructors. This allows the generation of correct +error messages even when complicated calling patterns are used (e.g., via the +\fBnext\fR command). .AP Tcl_ObjectMetadataType *metaTypePtr in The type of \fImetadata\fR being set with \fBTcl_ClassSetMetadata\fR or retrieved with \fBTcl_ClassGetMetadata\fR. @@ -109,7 +111,9 @@ may be retrieved using the \fBTcl_GetObjectCommand\fR function, the name of the object (and hence the name of the command) with \fBTcl_GetObjectName\fR, and the namespace may be retrieved using the \fBTcl_GetObjectNamespace\fR function. Note that the Tcl_Obj reference returned by \fBTcl_GetObjectName\fR -is a shared reference. +is a shared reference. You can also get whether the object has been marked for +deletion with \fBTcl_ObjectDeleted\fR (it returns true if deletion of the +object has begun); this can be useful during the processing of methods. .PP Instances of classes are created using \fBTcl_NewObjectInstance\fR, which creates an object from any class (and which is internally called by both @@ -121,6 +125,16 @@ created object, or NULL if the creation failed (when an error message will be left in the interpreter result). In addition, objects may be copied by using \fBTcl_CopyObjectInstance\fR which creates a copy of an object without running any constructors. +.PP +Note that the lifetime management of objects is handled internally within +TclOO, and does not use \fBTcl_Preserve\fR. \fIIt is not safe to put a +Tcl_Object handle in a C structure with a lifespan different to the object;\fR +you should use the object's command name (as retrieved with +\fBTcl_GetObjectName\fR) instead. It is safe to use a Tcl_Object handle for +the lifespan of a call of a method on that object; handles do not become +invalid while there is an outstanding call on their object (even if the only +operation guaranteed to be safe on them is \fBTcl_ObjectDeleted\fR; the other +operations are only guaranteed to work on non-deleted objects). .SH "OBJECT AND CLASS METADATA" .PP Every object and every class may have arbitrary amounts of metadata attached -- cgit v0.12 From 4d25168772b31a4966cb76f931eda3fbff01202b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 5 Jul 2019 09:29:55 +0000 Subject: Fix [4718b41c56d8c135]: windows x86 & x64: file mtime overflows in modification date. Only fixed for x64, because for x86 it isn't possible without breaking API compatibility. --- generic/tclCmdAH.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 5484002..259b8cd 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -908,7 +908,7 @@ Tcl_FileObjCmd( } } - Tcl_SetObjResult(interp, Tcl_NewLongObj((long) + Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (index == FCMD_ATIME ? buf.st_atime : buf.st_mtime))); return TCL_OK; case FCMD_ATTRIBUTES: @@ -1527,9 +1527,9 @@ StoreStatData( #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE STORE_ARY("blksize", Tcl_NewLongObj((long)statPtr->st_blksize)); #endif - STORE_ARY("atime", Tcl_NewLongObj((long)statPtr->st_atime)); - STORE_ARY("mtime", Tcl_NewLongObj((long)statPtr->st_mtime)); - STORE_ARY("ctime", Tcl_NewLongObj((long)statPtr->st_ctime)); + STORE_ARY("atime", Tcl_NewWideIntObj(statPtr->st_atime)); + STORE_ARY("mtime", Tcl_NewWideIntObj(statPtr->st_mtime)); + STORE_ARY("ctime", Tcl_NewWideIntObj(statPtr->st_ctime)); mode = (unsigned short) statPtr->st_mode; STORE_ARY("mode", Tcl_NewIntObj(mode)); STORE_ARY("type", Tcl_NewStringObj(GetTypeFromMode(mode), -1)); -- cgit v0.12 From 28f17c0d70fbde10d830f3580e744b2de0b702bc Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 5 Jul 2019 22:49:31 +0000 Subject: Add "name" entries to travis build configuration --- .travis.yml | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index b46bc26..293437d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,29 +3,34 @@ language: c matrix: include: - - os: linux + - name: "Linux/Clang/Shared" + os: linux dist: xenial compiler: clang env: - BUILD_DIR=unix - - os: linux + - name: "Linux/Clang/Static" + os: linux dist: xenial compiler: clang env: - CFGOPT=--disable-shared - BUILD_DIR=unix - - os: linux + - name: "Linux/GCC/Shared" + os: linux dist: xenial compiler: gcc env: - BUILD_DIR=unix - - os: linux + - name: "Linux/GCC/Static" + os: linux dist: xenial compiler: gcc env: - CFGOPT=--disable-shared - BUILD_DIR=unix - - os: linux + - name: "Linux/GCC 4.9/Shared" + os: linux dist: xenial compiler: gcc-4.9 addons: @@ -36,7 +41,8 @@ matrix: - g++-4.9 env: - BUILD_DIR=unix - - os: linux + - name: "Linux/GCC 5/Shared" + os: linux dist: xenial compiler: gcc-5 addons: @@ -47,7 +53,8 @@ matrix: - g++-5 env: - BUILD_DIR=unix - - os: linux + - name: "Linux/GCC 6/Shared" + os: linux dist: xenial compiler: gcc-6 addons: @@ -58,7 +65,8 @@ matrix: - g++-6 env: - BUILD_DIR=unix - - os: linux + - name: "Linux/GCC 7/Shared" + os: linux dist: xenial compiler: gcc-7 addons: @@ -69,21 +77,25 @@ matrix: - g++-7 env: - BUILD_DIR=unix - - os: osx + - name: "macOS/Xcode 8/Shared/Unix-like" + os: osx osx_image: xcode8 env: - BUILD_DIR=unix - - os: osx + - name: "macOS/Xcode 8/Shared/Mac-like" + os: osx osx_image: xcode8 env: - BUILD_DIR=macosx - NO_DIRECT_CONFIGURE=1 - - os: osx + - name: "macOS/Xcode 9/Shared/Mac-like" + os: osx osx_image: xcode9 env: - BUILD_DIR=macosx - NO_DIRECT_CONFIGURE=1 - - os: osx + - name: "macOS/Xcode 10/Shared/Mac-like" + os: osx osx_image: xcode10.2 env: - BUILD_DIR=macosx @@ -94,7 +106,8 @@ matrix: # - BUILD_DIR=win ### ... so proxy with a Mingw cross-compile # Test with mingw-w64 (32 bit) - - os: linux + - name: "Linux-cross-Windows-32/GCC/Shared/no test" + os: linux dist: xenial compiler: i686-w64-mingw32-gcc addons: @@ -110,7 +123,8 @@ matrix: - BUILD_DIR=win - CFGOPT="--host=i686-w64-mingw32 --enable-threads" - NO_DIRECT_TEST=1 - - os: linux + - name: "Linux-cross-Windows-32/GCC/Static/no test" + os: linux dist: xenial compiler: i686-w64-mingw32-gcc addons: @@ -127,7 +141,8 @@ matrix: - CFGOPT="--host=i686-w64-mingw32 --disable-shared --enable-threads" - NO_DIRECT_TEST=1 # Test with mingw-w64 (64 bit) - - os: linux + - name: "Linux-cross-Windows-64/GCC/Shared/no test" + os: linux dist: xenial compiler: x86_64-w64-mingw32-gcc addons: @@ -142,7 +157,8 @@ matrix: - BUILD_DIR=win - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit --enable-threads" - NO_DIRECT_TEST=1 - - os: linux + - name: "Linux-cross-Windows-64/GCC/Static/no test" + os: linux dist: xenial compiler: x86_64-w64-mingw32-gcc addons: -- cgit v0.12 From a4c8e24f4c0b13c92c3fc5ff48db242e617342bf Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 8 Jul 2019 15:00:12 +0000 Subject: amend to [c14252171d]: fixes [4718b41c56] for x64 (and x86 with 64-bit predefined time_t resp. CRT library) --- generic/tclCmdAH.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 259b8cd..0a0f54e 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -875,10 +875,20 @@ Tcl_FileObjCmd( * 64-bit platforms. [Bug #698146] */ - long newTime; + time_t newTime; - if (TclGetLongFromObj(interp, objv[3], &newTime) != TCL_OK) { - return TCL_ERROR; + if ((time_t)WIDE_MAX < WIDE_MAX) { + long i; + if (TclGetLongFromObj(interp, objv[3], &i) != TCL_OK) { + return TCL_ERROR; + } + newTime = i; + } else { + Tcl_WideInt i; + if (Tcl_GetWideIntFromObj(interp, objv[3], &i) != TCL_OK) { + return TCL_ERROR; + } + newTime = i; } if (index == FCMD_ATIME) { -- cgit v0.12 From 4b7f867f902413fdca08b3f4e7d6beb2158a851f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 8 Jul 2019 19:02:56 +0000 Subject: Simplify previous commit: Just always use Tcl_WideInt --- generic/tclCmdAH.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 0a0f54e..06743d6 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -870,25 +870,11 @@ Tcl_FileObjCmd( return TCL_ERROR; } if (objc == 4) { - /* - * Need separate variable for reading longs from an object on - * 64-bit platforms. [Bug #698146] - */ + Tcl_WideInt newTime; - time_t newTime; - - if ((time_t)WIDE_MAX < WIDE_MAX) { - long i; - if (TclGetLongFromObj(interp, objv[3], &i) != TCL_OK) { - return TCL_ERROR; - } - newTime = i; - } else { - Tcl_WideInt i; - if (Tcl_GetWideIntFromObj(interp, objv[3], &i) != TCL_OK) { - return TCL_ERROR; - } - newTime = i; + + if (Tcl_GetWideIntFromObj(interp, objv[3], &newTime) != TCL_OK) { + return TCL_ERROR; } if (index == FCMD_ATIME) { -- cgit v0.12