diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-14 07:24:45 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-14 07:24:45 (GMT) |
commit | 6e2f02a5a6a694d1c1ad853307791acf1fd85c92 (patch) | |
tree | 7d98f24bc0e1f58d9bf18be980e4d1cbc157947e | |
parent | 20bd9d9cabc9db212abbaf9d4dbb18eb490e9f71 (diff) | |
parent | c9376306301e578615cfee52d2121f78cb31a225 (diff) | |
download | tcl-6e2f02a5a6a694d1c1ad853307791acf1fd85c92.zip tcl-6e2f02a5a6a694d1c1ad853307791acf1fd85c92.tar.gz tcl-6e2f02a5a6a694d1c1ad853307791acf1fd85c92.tar.bz2 |
Merge 8.7
58 files changed, 464 insertions, 270 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100755 index 0000000..82bed50 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,37 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text eol=lf + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.3 text +*.c text +*.css text +*.enc text +*.h text +*.htm text +*.html text +*.java text +*.js text +*.json text +*.n text +*.svg text +*.ts text +*.tcl text +*.test text + +# Declare files that will always have CRLF line endings on checkout. +*.bat text eol=crlf +*.sln text eol=crlf +*.vc text eol=crlf + +# Denote all files that are truly binary and should not be modified. +*.a binary +*.dll binary +*.exe binary +*.gif binary +*.jpg binary +*.lib binary +*.pdf binary +*.png binary +*.xlsx binary +*.zip binary diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..99fd07e --- /dev/null +++ b/.gitignore @@ -0,0 +1,50 @@ +*.a +*.dll +*.dylib +*.exe +*.exp +*.lib +*.o +*.obj +*.pdb +*.res +*.sl +*.so +*/Makefile +*/config.cache +*/config.log +*/config.status +*/tclConfig.sh +*/tclsh* +*/tcltest* +*/versions.vc +*/version.vc +html +libtommath/bn.ilg +libtommath/bn.ind +libtommath/pretty.build +libtommath/tommath.src +libtommath/*.log +libtommath/*.pdf +libtommath/*.pl +libtommath/*.sh +libtommath/doc/* +libtommath/tombc/* +libtommath/pre_gen/* +libtommath/pics/* +libtommath/mtest/* +libtommath/logs/* +libtommath/etc/* +libtommath/demo/* +libtommath/*.out +libtommath/*.tex +unix/autoMkindex.tcl +unix/dltest.marker +unix/tcl.pc +unix/tclIndex +unix/pkgs/* +win/Debug* +win/Release* +win/pkgs/* +win/tcl.hpj +win/nmhlp-out.txt diff --git a/.travis.yml b/.travis.yml index 18931c8..73e3fc2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,48 +4,6 @@ language: c matrix: include: # Testing on Linux with various compilers - - name: "Linux/Clang/Shared" - os: linux - dist: xenial - compiler: clang - env: - - BUILD_DIR=unix - - name: "Linux/Clang/Static" - os: linux - dist: xenial - compiler: clang - env: - - CFGOPT=--disable-shared - - BUILD_DIR=unix - - name: "Linux/Clang/Shared: UTF_MAX=6" - os: linux - dist: xenial - compiler: clang - env: - - BUILD_DIR=unix - - CFGOPT=CFLAGS=-DTCL_UTF_MAX=6 - - name: "Linux/Clang/Shared: UTF_MAX=3" - os: linux - dist: xenial - compiler: clang - env: - - BUILD_DIR=unix - - CFGOPT=CFLAGS=-DTCL_UTF_MAX=3 - - name: "Linux/Clang/Shared: NO_DEPRECATED" - os: linux - dist: xenial - compiler: clang - env: - - BUILD_DIR=unix - - CFGOPT=CFLAGS=-DTCL_NO_DEPRECATED=1 -# full-debug build disabled, because it is currently failing. -# - name: "Linux/Clang/Shared: full-debug" -# os: linux -# dist: xenial -# compiler: clang -# env: -# - BUILD_DIR=unix -# - CFGOPT=--enable-symbols=all - name: "Linux/GCC/Shared" os: linux dist: xenial @@ -80,6 +38,16 @@ matrix: env: - BUILD_DIR=unix - CFGOPT=CFLAGS=-DTCL_NO_DEPRECATED=1 +# Debug build. Running test-cases disabled, because it is currently failing. + - name: "Linux/GCC/Debug/no test" + os: linux + dist: xenial + compiler: gcc + env: + - BUILD_DIR=unix + - CFGOPT=--enable-symbols=all + script: + - make all tcltest # Older versions of GCC... - name: "Linux/GCC 7/Shared" os: linux @@ -129,13 +97,37 @@ matrix: - g++-4.9 env: - BUILD_DIR=unix +# Clang + - name: "Linux/Clang/Shared" + os: linux + dist: xenial + compiler: clang + env: + - BUILD_DIR=unix + - name: "Linux/Clang/Static" + os: linux + dist: xenial + compiler: clang + env: + - CFGOPT=--disable-shared + - BUILD_DIR=unix +# Debug build. Running test-cases disabled, because it is currently failing. + - name: "Linux/Clang/Debug/no test" + os: linux + dist: xenial + compiler: clang + env: + - BUILD_DIR=unix + - CFGOPT=--enable-symbols=all + script: + - make all tcltest # Testing on Mac, various styles - name: "macOS/Xcode 11/Shared/Unix-like" os: osx osx_image: xcode11 env: - BUILD_DIR=unix - - name: "macOS/Xcode 11/Shared/Mac-like" + - name: "macOS/Xcode 11/Shared" os: osx osx_image: xcode11 env: @@ -145,21 +137,21 @@ matrix: - make all # The styles=develop avoids some weird problems on OSX - make test styles=develop - - name: "macOS/Xcode 10/Shared/Mac-like" + - name: "macOS/Xcode 10/Shared" os: osx osx_image: xcode10.2 env: - BUILD_DIR=macosx install: [] script: *mactest - - name: "macOS/Xcode 9/Shared/Mac-like" + - name: "macOS/Xcode 9/Shared" os: osx osx_image: xcode9 env: - BUILD_DIR=macosx install: [] script: *mactest - - name: "macOS/Xcode 8/Shared/Mac-like" + - name: "macOS/Xcode 8/Shared" os: osx osx_image: xcode8 env: @@ -167,7 +159,7 @@ matrix: install: [] script: *mactest # Test with mingw-w64 (32 bit) cross-compile -# Doesn't run tests because wine is only an imperfect Windows emulation +# Doesn't run tests because wine is only an imperfect Windows emulation - name: "Linux-cross-Windows-32/GCC/Shared/no test" os: linux dist: xenial @@ -185,8 +177,7 @@ matrix: - BUILD_DIR=win - CFGOPT=--host=i686-w64-mingw32 script: &crosstest - - make all - - make tcltest + - make all tcltest # Include a high visibility marker that tests are skipped outright - > echo "`tput setaf 3`SKIPPED TEST: CROSS COMPILING`tput sgr0`" @@ -226,8 +217,17 @@ matrix: - BUILD_DIR=win - CFGOPT="--host=i686-w64-mingw32 CFLAGS=-DTCL_NO_DEPRECATED=1" script: *crosstest + - name: "Linux-cross-Windows-32/GCC/Debug/no test" + os: linux + dist: xenial + compiler: i686-w64-mingw32-gcc + addons: *mingw32 + env: + - BUILD_DIR=win + - CFGOPT="--host=i686-w64-mingw32 --enable-symbols" + script: *crosstest # Test with mingw-w64 (64 bit) -# Doesn't run tests because wine is only an imperfect Windows emulation +# Doesn't run tests because wine is only an imperfect Windows emulation - name: "Linux-cross-Windows-64/GCC/Shared/no test" os: linux dist: xenial @@ -280,6 +280,65 @@ matrix: - BUILD_DIR=win - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit CFLAGS=-DTCL_NO_DEPRECATED=1" script: *crosstest + - name: "Linux-cross-Windows-64/GCC/Debug/no test" + os: linux + dist: xenial + compiler: x86_64-w64-mingw32-gcc + addons: *mingw64 + env: + - BUILD_DIR=win + - CFGOPT="--host=x86_64-w64-mingw32 --enable-64bit --enable-symbols" + script: *crosstest +# Test on Windows with MSVC native + - name: "Windows/MSVC/Shared" + os: windows + compiler: cl + env: &vcenv + - BUILD_DIR=win + - VCDIR="/C/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Auxiliary/Build" + before_install: &vcpreinst + - PATH="$PATH:$VCDIR" + - cd ${BUILD_DIR} + install: [] + script: + - cmd.exe /C 'vcvarsall.bat x64 && nmake -f makefile.vc all tcltest' + - cmd.exe /C 'vcvarsall.bat x64 && nmake -f makefile.vc test' + - name: "Windows/MSVC/Shared: UTF_MAX=6" + os: windows + compiler: cl + env: *vcenv + before_install: *vcpreinst + install: [] + script: + - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=utfmax -f makefile.vc all tcltest' + - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=utfmax -f makefile.vc test' + - name: "Windows/MSVC/Shared: NO_DEPRECATED" + os: windows + compiler: cl + env: *vcenv + before_install: *vcpreinst + install: [] + script: + - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=nodep -f makefile.vc all tcltest' + - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=nodep -f makefile.vc test' + - name: "Windows/MSVC/Static" + os: windows + compiler: cl + env: *vcenv + before_install: *vcpreinst + install: [] + script: + - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=static -f makefile.vc all tcltest' + - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=static -f makefile.vc test' + - name: "Windows/MSVC/Debug" + os: windows + compiler: cl + env: *vcenv + before_install: *vcpreinst + install: [] + script: + - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=symbols -f makefile.vc all tcltest' + - cmd.exe /C 'vcvarsall.bat x64 && nmake OPTS=symbols -f makefile.vc test' before_install: - cd ${BUILD_DIR} install: @@ -287,6 +346,5 @@ install: before_script: - export ERROR_ON_FAILURES=1 script: - - make all - - make tcltest + - make all tcltest - make test diff --git a/compat/fake-rfc2553.c b/compat/fake-rfc2553.c index c8e69400..29e2b56 100644 --- a/compat/fake-rfc2553.c +++ b/compat/fake-rfc2553.c @@ -73,6 +73,7 @@ int fake_getnameinfo(const struct sockaddr *sa, size_t salen, char *host, struct sockaddr_in *sin = (struct sockaddr_in *)sa; struct hostent *hp; char tmpserv[16]; + (void)salen; if (sa->sa_family != AF_UNSPEC && sa->sa_family != AF_INET) return (EAI_FAMILY); @@ -153,7 +154,7 @@ addrinfo *malloc_ai(int port, u_long addr, const struct addrinfo *hints) { struct addrinfo *ai; - ai = malloc(sizeof(*ai) + sizeof(struct sockaddr_in)); + ai = (struct addrinfo *)malloc(sizeof(*ai) + sizeof(struct sockaddr_in)); if (ai == NULL) return (NULL); diff --git a/compat/gettod.c b/compat/gettod.c index ca20cf8..f6651d4 100644 --- a/compat/gettod.c +++ b/compat/gettod.c @@ -21,10 +21,11 @@ gettimeofday( struct timezone *tz) { struct timeb t; + (void)tz; ftime(&t); tp->tv_sec = t.time; - tp->tv_usec = t. millitm * 1000; + tp->tv_usec = t.millitm * 1000; return 0; } diff --git a/compat/mkstemp.c b/compat/mkstemp.c index 6807414..feccfbb 100644 --- a/compat/mkstemp.c +++ b/compat/mkstemp.c @@ -13,6 +13,7 @@ #include <fcntl.h> #include <stdlib.h> #include <unistd.h> +#include <string.h> /* *---------------------------------------------------------------------- @@ -32,19 +33,19 @@ int mkstemp( - char *template) /* Template for filename. */ + char *tmpl) /* Template for filename. */ { static const char alphanumerics[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; char *a, *b; int fd, count, alphanumericsLen = strlen(alphanumerics); /* == 62 */ - a = template + strlen(template); - while (a > template && *(a-1) == 'X') { + a = tmpl + strlen(tmpl); + while (a > tmpl && *(a-1) == 'X') { a--; } - if (a == template) { + if (a == tmpl) { errno = ENOENT; return -1; } @@ -71,7 +72,7 @@ mkstemp( * Template is now realized; try to open (with correct options). */ - fd = open(template, O_RDWR|O_CREAT|O_EXCL, 0600); + fd = open(tmpl, O_RDWR|O_CREAT|O_EXCL, 0600); } while (fd == -1 && errno == EEXIST && --count > 0); return fd; diff --git a/compat/opendir.c b/compat/opendir.c index ea6831b..25a7ada 100644 --- a/compat/opendir.c +++ b/compat/opendir.c @@ -22,7 +22,7 @@ opendir( { DIR *dirp; int fd; - char *myname; + const char *myname; myname = ((*name == '\0') ? "." : name); if ((fd = open(myname, 0, 0)) == -1) { diff --git a/compat/strstr.c b/compat/strstr.c index 7f7438e..206dca9 100644 --- a/compat/strstr.c +++ b/compat/strstr.c @@ -36,7 +36,7 @@ char * strstr( - char *string, /* String to search. */ + char *string, /* String to search. */ char *substring) /* Substring to try to find in string. */ { char *a, *b; diff --git a/doc/Notifier.3 b/doc/Notifier.3 index 16f9f8d..ec9f910 100644 --- a/doc/Notifier.3 +++ b/doc/Notifier.3 @@ -132,22 +132,17 @@ higher-level software that they have occurred. The procedures and \fBTcl_SetMaxBlockTime\fR, \fBTcl_QueueEvent\fR, and \fBTcl_DeleteEvents\fR are used primarily by event sources. .IP [2] -The event queue: for non-threaded applications, -there is a single queue for the whole application, -containing events that have been detected but not yet serviced. Event -sources place events onto the queue so that they may be processed in -order at appropriate times during the event loop. The event queue -guarantees a fair discipline of event handling, so that no event -source can starve the others. It also allows events to be saved for -servicing at a future time. Threaded applications work in a -similar manner, except that there is a separate event queue for -each thread containing a Tcl interpreter. +The event queue: there is a single queue for each thread containing +a Tcl interpreter, containing events that have been detected but not +yet serviced. Event sources place events onto the queue so that they +may be processed in order at appropriate times during the event loop. +The event queue guarantees a fair discipline of event handling, so that +no event source can starve the others. It also allows events to be +saved for servicing at a future time. \fBTcl_QueueEvent\fR is used (primarily -by event sources) to add events to the event queue and +by event sources) to add events to the current thread's event queue and \fBTcl_DeleteEvents\fR is used to remove events from the queue without -processing them. In a threaded application, \fBTcl_QueueEvent\fR adds -an event to the current thread's queue, and \fBTcl_ThreadQueueEvent\fR -adds an event to a queue in a specific thread. +processing them. .IP [3] The event loop: in order to detect and process events, the application enters a loop that waits for events to occur, places them on the event @@ -403,11 +398,7 @@ the event source (using \fBTcl_Alloc\fR or the Tcl macro \fBckalloc\fR) before calling \fBTcl_QueueEvent\fR, but it will be freed by \fBTcl_ServiceEvent\fR, not by the event source. .PP -Threaded applications work in a -similar manner, except that there is a separate event queue for -each thread containing a Tcl interpreter. -Calling \fBTcl_QueueEvent\fR in a multithreaded application adds -an event to the current thread's queue. +Calling \fBTcl_QueueEvent\fR adds an event to the current thread's queue. To add an event to another thread's queue, use \fBTcl_ThreadQueueEvent\fR. \fBTcl_ThreadQueueEvent\fR accepts as an argument a Tcl_ThreadId argument, which uniquely identifies a thread in a Tcl application. To obtain the @@ -498,8 +489,7 @@ under Unix it happens when \fBTcl_WaitForEvent\fR would have waited forever because there were no active event sources and the timeout was infinite. .PP -\fBTcl_AlertNotifier\fR is used in multithreaded applications to allow -any thread to +\fBTcl_AlertNotifier\fR is used to allow any thread to .QW "wake up" the notifier to alert it to new events on its queue. \fBTcl_AlertNotifier\fR requires as an argument the notifier @@ -75,7 +75,7 @@ int .AS "const Tcl_UniChar" *uniPattern in/out .AP char *buf out Buffer in which the UTF-8 representation of the Tcl_UniChar is stored. At most -\fBTCL_UTF_MAX\fR bytes are stored in the buffer. +4 bytes are stored in the buffer. .AP int ch in The Unicode character to be converted or examined. .AP Tcl_UniChar *chPtr out @@ -113,7 +113,7 @@ If non-NULL, filled with the number of bytes in the backslash sequence, including the backslash character. .AP char *dst out Buffer in which the bytes represented by the backslash sequence are stored. -At most \fBTCL_UTF_MAX\fR bytes are stored in the buffer. +At most 4 bytes are stored in the buffer. .AP int nocase in Specifies whether the match should be done case-sensitive (0) or case-insensitive (1). @@ -148,8 +148,8 @@ a byte in the range 0x80 - 0x9F, \fBTcl_UtfToUniChar\fR assumes the cp1252 encoding, stores the corresponding Tcl_UniChar in \fI*chPtr\fR and returns 1. If the input is otherwise not in proper UTF-8 format, \fBTcl_UtfToUniChar\fR will store the first -byte of \fIsrc\fR in \fI*chPtr\fR as a Tcl_UniChar between 0x0000 and -0x00ff and return 1. +byte of \fIsrc\fR in \fI*chPtr\fR as a Tcl_UniChar between 0x00A0 and +0x00FF and return 1. .PP \fBTcl_UniCharToUtfDString\fR converts the given Unicode string to UTF-8, storing the result in a previously initialized \fBTcl_DString\fR. @@ -253,7 +253,7 @@ the return pointer points to the first character in the source string. \fBTcl_UtfBackslash\fR is a utility procedure used by several of the Tcl commands. It parses a backslash sequence and stores the properly formed UTF-8 character represented by the backslash sequence in the output -buffer \fIdst\fR. At most \fBTCL_UTF_MAX\fR bytes are stored in the buffer. +buffer \fIdst\fR. At most 4 bytes are stored in the buffer. \fBTcl_UtfBackslash\fR modifies \fI*readPtr\fR to contain the number of bytes in the backslash sequence, including the backslash character. The return value is the number of bytes stored in the output buffer. @@ -22,7 +22,7 @@ home directory (as specified in the HOME environment variable) if Returns an empty string. Note that the current working directory is a per-process resource; the \fBcd\fR command changes the working directory for all interpreters -and (in a threaded environment) all threads. +and all threads. .SH EXAMPLES .PP Change to the home directory of the user \fBfred\fR: diff --git a/generic/regexec.c b/generic/regexec.c index 1a3e114..24c4eac 100644 --- a/generic/regexec.c +++ b/generic/regexec.c @@ -91,7 +91,6 @@ struct smalldfa { struct sset *outsarea[FEWSTATES*2 * FEWCOLORS]; struct arcp incarea[FEWSTATES*2 * FEWCOLORS]; }; -#define DOMALLOC ((struct smalldfa *)NULL) /* force malloc */ /* * Internal variables, bundled for easy passing around. @@ -299,7 +298,7 @@ getsubdfa(struct vars * v, struct subre * t) { if (v->subdfas[t->id] == NULL) { - v->subdfas[t->id] = newDFA(v, &t->cnfa, &v->g->cmap, DOMALLOC); + v->subdfas[t->id] = newDFA(v, &t->cnfa, &v->g->cmap, NULL); if (ISERR()) return NULL; } diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c index 669c186..0c0ab7b 100644 --- a/generic/tclAlloc.c +++ b/generic/tclAlloc.c @@ -304,7 +304,7 @@ TclpAlloc( #endif Tcl_MutexUnlock(allocMutexPtr); - return (void *)(overPtr+1); + return (char *)(overPtr+1); } /* @@ -592,7 +592,7 @@ TclpRealloc( } if (expensive) { - void *newPtr; + char *newPtr; Tcl_MutexUnlock(allocMutexPtr); diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 0f11f04..aea77e4 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -2643,7 +2643,7 @@ TclCreateObjCommandInNs( Tcl_Interp *interp, const char *cmdName, /* Name of command, without any namespace * components. */ - Tcl_Namespace *namespace, /* The namespace to create the command in */ + Tcl_Namespace *namesp, /* The namespace to create the command in */ Tcl_ObjCmdProc *proc, /* Object-based function to associate with * name. */ ClientData clientData, /* Arbitrary value to pass to object @@ -2657,7 +2657,7 @@ TclCreateObjCommandInNs( ImportRef *oldRefPtr = NULL; ImportedCmdData *dataPtr; Tcl_HashEntry *hPtr; - Namespace *nsPtr = (Namespace *) namespace; + Namespace *nsPtr = (Namespace *) namesp; /* * If the command name we seek to create already exists, we need to delete @@ -5967,7 +5967,7 @@ TclArgumentEnter( CmdFrame *cfPtr) { Interp *iPtr = (Interp *) interp; - int new, i; + int isNew, i; Tcl_HashEntry *hPtr; CFWord *cfwPtr; @@ -5983,8 +5983,8 @@ TclArgumentEnter( if (cfPtr->line[i] < 0) { continue; } - hPtr = Tcl_CreateHashEntry(iPtr->lineLAPtr, objv[i], &new); - if (new) { + hPtr = Tcl_CreateHashEntry(iPtr->lineLAPtr, objv[i], &isNew); + if (isNew) { /* * The word is not on the stack yet, remember the current location * and initialize references. diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index deec6ba..c895817 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -15,7 +15,6 @@ #ifdef _WIN32 # include "tclWinInt.h" #endif -#include <locale.h> /* * The state structure used by [foreach]. Note that the actual structure has diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 6fba4c6..c413780 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4188,7 +4188,6 @@ Tcl_TimeRateObjCmd( }; NRE_callback *rootPtr; ByteCode *codePtr = NULL; - int codeOptimized = 0; for (i = 1; i < objc - 1; i++) { int index; @@ -4373,15 +4372,6 @@ Tcl_TimeRateObjCmd( } codePtr = TclCompileObj(interp, objPtr, NULL, 0); TclPreserveByteCode(codePtr); - /* - * Replace last compiled done instruction with continue: it's a part of - * iteration, this way evaluation will be more similar to a cycle (also - * avoids extra overhead to set result to interp, etc.) - */ - if (codePtr->codeStart[codePtr->numCodeBytes-1] == INST_DONE) { - codePtr->codeStart[codePtr->numCodeBytes-1] = INST_CONTINUE; - codeOptimized = 1; - } } /* @@ -4423,6 +4413,12 @@ Tcl_TimeRateObjCmd( count++; if (!direct) { /* precompiled */ rootPtr = TOP_CB(interp); + /* + * Use loop optimized TEBC call (TCL_EVAL_DISCARD_RESULT): it's a part of + * iteration, this way evaluation will be more similar to a cycle (also + * avoids extra overhead to set result to interp, etc.) + */ + ((Interp *)interp)->evalFlags |= TCL_EVAL_DISCARD_RESULT; result = TclNRExecuteByteCode(interp, codePtr); result = TclNRRunCallbacks(interp, result, rootPtr); } else { /* eval */ @@ -4675,11 +4671,6 @@ Tcl_TimeRateObjCmd( done: if (codePtr != NULL) { - if ( codeOptimized - && codePtr->codeStart[codePtr->numCodeBytes-1] == INST_CONTINUE - ) { - codePtr->codeStart[codePtr->numCodeBytes-1] = INST_DONE; - } TclReleaseByteCode(codePtr); } return result; diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index f4f2ddf..8c6050d 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -3174,7 +3174,7 @@ TclCompileFormatCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = parsePtr->tokenPtr; Tcl_Obj **objv, *formatObj, *tmpObj; - char *bytes, *start; + const char *bytes, *start; int i, j, len; /* @@ -3301,7 +3301,7 @@ TclCompileFormatCmd( if (*++bytes == '%') { Tcl_AppendToObj(tmpObj, "%", 1); } else { - char *b = TclGetStringFromObj(tmpObj, &len); + const char *b = TclGetStringFromObj(tmpObj, &len); /* * If there is a non-empty literal from the format string, diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index a8a85f8..3c8a156 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -589,7 +589,7 @@ TclCompileInfoCommandsCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; Tcl_Obj *objPtr; - char *bytes; + const char *bytes; /* * We require one compile-time known argument for the case we can compile. diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index bfae433..db51890 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -925,7 +925,7 @@ TclCompileStringMapCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *mapTokenPtr, *stringTokenPtr; Tcl_Obj *mapObj, **objv; - char *bytes; + const char *bytes; int len; /* diff --git a/generic/tclDate.c b/generic/tclDate.c index 87c6325..fb4f3cf 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -95,6 +95,17 @@ #endif /* _MSC_VER */ /* + * Meridian: am, pm, or 24-hour style. + */ + +typedef enum _MERIDIAN { + MERam, MERpm, MER24 +} MERIDIAN; + + + + +/* * yyparse will accept a 'struct DateInfo' as its parameter; that's where the * parsed fields will be returned. */ @@ -112,7 +123,7 @@ typedef struct DateInfo { time_t dateHour; time_t dateMinutes; time_t dateSeconds; - int dateMeridian; + MERIDIAN dateMeridian; int dateHaveTime; time_t dateTimezone; @@ -199,17 +210,6 @@ typedef enum _DSTMODE { DSTon, DSToff, DSTmaybe } DSTMODE; -/* - * Meridian: am, pm, or 24-hour style. - */ - -typedef enum _MERIDIAN { - MERam, MERpm, MER24 -} MERIDIAN; - - - - # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus # define YY_NULLPTR nullptr diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 416eaad..16d8310 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -2580,7 +2580,7 @@ BuildEnsembleConfig( if (subList) { int subc; Tcl_Obj **subv, *target, *cmdObj, *cmdPrefixObj; - char *name; + const char *name; /* * There is a list of exactly what subcommands go in the table. @@ -2665,7 +2665,7 @@ BuildEnsembleConfig( Tcl_DictObjFirst(NULL, ensemblePtr->subcommandDict, &dictSearch, &keyObj, &valueObj, &done); while (!done) { - char *name = TclGetString(keyObj); + const char *name = TclGetString(keyObj); hPtr = Tcl_CreateHashEntry(hash, name, &isNew); Tcl_SetHashValue(hPtr, valueObj); @@ -3379,7 +3379,7 @@ CompileToInvokedCommand( { Tcl_Token *tokPtr; Tcl_Obj *objPtr, **words; - char *bytes; + const char *bytes; int i, numWords, cmdLit, extraLiteralFlags = LITERAL_CMD_NAME; DefineLineInformation; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 871a463..4b25064 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1981,7 +1981,14 @@ TclNRExecuteByteCode( */ TclNRAddCallback(interp, TEBCresume, TD, /* pc */ NULL, - /* cleanup */ INT2PTR(0), NULL); + /* cleanup */ INT2PTR(0), INT2PTR(iPtr->evalFlags)); + + /* + * Reset discard result flag - because it is applicable for this call only, + * and should not affect all the nested invocations may return result. + */ + iPtr->evalFlags &= ~TCL_EVAL_DISCARD_RESULT; + return TCL_OK; } @@ -2043,6 +2050,7 @@ TEBCresume( #define auxObjList (TD->auxObjList) #define catchTop (TD->catchTop) #define codePtr (TD->codePtr) +#define curEvalFlags PTR2INT(data[3]) /* calling iPtr->evalFlags */ /* * Globals: variables that store state, must remain valid at all times. @@ -2526,6 +2534,14 @@ TEBCresume( case INST_DONE: if (tosPtr > initTosPtr) { + + if ((curEvalFlags & TCL_EVAL_DISCARD_RESULT) && (result == TCL_OK)) { + /* simulate pop & fast done (like it does continue in loop) */ + TRACE_WITH_OBJ(("=> discarding "), OBJ_AT_TOS); + objPtr = POP_OBJECT(); + TclDecrRefCount(objPtr); + goto abnormalReturn; + } /* * Set the interpreter's object result to point to the topmost * object from the stack, and check for a possible [catch]. The @@ -7695,7 +7711,7 @@ TEBCresume( */ /* - * Abnormal return code. Restore the stack to state it had when + * Done or abnormal return code. Restore the stack to state it had when * starting to execute the ByteCode. Panic if the stack is below the * initial level. */ diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 210e91c..3b6134c 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -46,6 +46,14 @@ #endif /* _MSC_VER */ /* + * Meridian: am, pm, or 24-hour style. + */ + +typedef enum _MERIDIAN { + MERam, MERpm, MER24 +} MERIDIAN; + +/* * yyparse will accept a 'struct DateInfo' as its parameter; that's where the * parsed fields will be returned. */ @@ -63,7 +71,7 @@ typedef struct DateInfo { time_t dateHour; time_t dateMinutes; time_t dateSeconds; - int dateMeridian; + MERIDIAN dateMeridian; int dateHaveTime; time_t dateTimezone; @@ -150,14 +158,6 @@ typedef enum _DSTMODE { DSTon, DSToff, DSTmaybe } DSTMODE; -/* - * Meridian: am, pm, or 24-hour style. - */ - -typedef enum _MERIDIAN { - MERam, MERpm, MER24 -} MERIDIAN; - %} %union { diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 80cd8db..3773159 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -1392,7 +1392,7 @@ TclFSNormalizeToUniquePath( int i; int isVfsPath = 0; - char *path; + const char *path; /* * Paths starting with a UNC prefix whose final character is a colon diff --git a/generic/tclInt.h b/generic/tclInt.h index 3a6352a..2ac833e 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -78,12 +78,12 @@ #else #include <string.h> #endif -#if defined(STDC_HEADERS) || defined(__STDC__) || defined(__C99__FUNC__) \ - || defined(__cplusplus) || defined(_MSC_VER) || defined(__ICC) -#include <stddef.h> -#else +#if !defined(STDC_HEADERS) && !defined(__STDC__) && !defined(__C99__FUNC__) \ + && !defined(__cplusplus) && !defined(_MSC_VER) && !defined(__ICC) typedef int ptrdiff_t; #endif +#include <stddef.h> +#include <locale.h> /* * Ensure WORDS_BIGENDIAN is defined correctly: @@ -2259,6 +2259,7 @@ typedef struct Interp { #define TCL_EVAL_FILE 0x02 #define TCL_EVAL_SOURCE_IN_FRAME 0x10 #define TCL_EVAL_NORESOLVE 0x20 +#define TCL_EVAL_DISCARD_RESULT 0x40 /* * Flag bits for Interp structures: diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index 50f8e38..5982cc8 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.c @@ -209,7 +209,7 @@ TclCreateLiteral( */ int objLength; - char *objBytes = TclGetStringFromObj(objPtr, &objLength); + const char *objBytes = TclGetStringFromObj(objPtr, &objLength); if ((objLength == length) && ((length == 0) || ((objBytes[0] == bytes[0]) @@ -408,7 +408,7 @@ TclRegisterLiteral( Tcl_Obj *objPtr; unsigned hash; unsigned int localHash; - int objIndex, new; + int objIndex, isNew; Namespace *nsPtr; if (length < 0) { @@ -462,7 +462,7 @@ TclRegisterLiteral( */ globalPtr = NULL; - objPtr = TclCreateLiteral(iPtr, bytes, length, hash, &new, nsPtr, flags, + objPtr = TclCreateLiteral(iPtr, bytes, length, hash, &isNew, nsPtr, flags, &globalPtr); objIndex = AddLocalLiteralEntry(envPtr, objPtr, localHash); diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index a3aec0b..f259954 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -1244,7 +1244,7 @@ TclOODefineSelfObjCmd( { Tcl_Namespace *nsPtr; Object *oPtr; - int result, private; + int result, isPrivate; oPtr = (Object *) TclOOGetDefineCmdContext(interp); if (oPtr == NULL) { @@ -1256,7 +1256,7 @@ TclOODefineSelfObjCmd( return TCL_OK; } - private = IsPrivateDefine(interp); + isPrivate = IsPrivateDefine(interp); /* * Make the oo::objdefine namespace the current namespace and evaluate the @@ -1267,7 +1267,7 @@ TclOODefineSelfObjCmd( if (InitDefineContext(interp, nsPtr, oPtr, objc, objv) != TCL_OK) { return TCL_ERROR; } - if (private) { + if (isPrivate) { ((Interp *) interp)->varFramePtr->isProcCallFrame = PRIVATE_FRAME; } diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c index fefeb0f..99918ae 100644 --- a/generic/tclOOInfo.c +++ b/generic/tclOOInfo.c @@ -809,7 +809,7 @@ InfoObjectVariablesCmd( { Object *oPtr; Tcl_Obj *resultObj; - int i, private = 0; + int i, isPrivate = 0; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "objName ?-private?"); @@ -819,7 +819,7 @@ InfoObjectVariablesCmd( if (strcmp("-private", Tcl_GetString(objv[2])) != 0) { return TCL_ERROR; } - private = 1; + isPrivate = 1; } oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[1]); if (oPtr == NULL) { @@ -827,7 +827,7 @@ InfoObjectVariablesCmd( } resultObj = Tcl_NewObj(); - if (private) { + if (isPrivate) { PrivateVariableMapping *privatePtr; FOREACH_STRUCT(privatePtr, oPtr->privateVariables) { @@ -1588,7 +1588,7 @@ InfoClassVariablesCmd( { Class *clsPtr; Tcl_Obj *resultObj; - int i, private = 0; + int i, isPrivate = 0; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "className ?-private?"); @@ -1598,7 +1598,7 @@ InfoClassVariablesCmd( if (strcmp("-private", Tcl_GetString(objv[2])) != 0) { return TCL_ERROR; } - private = 1; + isPrivate = 1; } clsPtr = GetClassFromObj(interp, objv[1]); if (clsPtr == NULL) { @@ -1606,7 +1606,7 @@ InfoClassVariablesCmd( } resultObj = Tcl_NewObj(); - if (private) { + if (isPrivate) { PrivateVariableMapping *privatePtr; FOREACH_STRUCT(privatePtr, clsPtr->privateVariables) { diff --git a/generic/tclParse.c b/generic/tclParse.c index 4cd335b..897dbb6 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -784,8 +784,7 @@ TclParseBackslash( * of bytes scanned should be written. */ char *dst) /* NULL, or points to buffer where the UTF-8 * encoding of the backslash sequence is to be - * written. At most TCL_UTF_MAX bytes will be - * written there. */ + * written. At most 4 bytes will be written there. */ { const char *p = src+1; Tcl_UniChar unichar = 0; diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 79a997e..2fa93d8 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -2242,7 +2242,7 @@ SetFsPathFromAny( int len; FsPath *fsPathPtr; Tcl_Obj *transPtr; - char *name; + const char *name; if (TclHasIntRep(pathPtr, &fsPathType)) { return TCL_OK; diff --git a/generic/tclPkg.c b/generic/tclPkg.c index ed5c57a..6727715 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -280,11 +280,11 @@ TclPkgFileSeen( if (pkgFiles && pkgFiles->names) { const char *name = pkgFiles->names->name; Tcl_HashTable *table = &pkgFiles->table; - int new; - Tcl_HashEntry *entry = Tcl_CreateHashEntry(table, name, &new); + int isNew; + Tcl_HashEntry *entry = Tcl_CreateHashEntry(table, name, &isNew); Tcl_Obj *list; - if (new) { + if (isNew) { list = Tcl_NewObj(); Tcl_SetHashValue(entry, list); Tcl_IncrRefCount(list); diff --git a/generic/tclProc.c b/generic/tclProc.c index e82f249..1ed48ac 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -1300,7 +1300,7 @@ InitLocalCache( Var *varPtr; LocalCache *localCachePtr; CompiledLocal *localPtr; - int new; + int isNew; ByteCodeGetIntRep(procPtr->bodyPtr, &tclByteCodeType, codePtr); @@ -1323,7 +1323,7 @@ InitLocalCache( } else { *namePtr = TclCreateLiteral(iPtr, localPtr->name, localPtr->nameLength, /* hash */ (unsigned int) -1, - &new, /* nsPtr */ NULL, 0, NULL); + &isNew, /* nsPtr */ NULL, 0, NULL); Tcl_IncrRefCount(*namePtr); } diff --git a/generic/tclResult.c b/generic/tclResult.c index 40c452e..3c856d3 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -832,19 +832,19 @@ SetupAppendBuffer( totalSpace = newSpace + iPtr->appendUsed; if (totalSpace >= iPtr->appendAvl) { - char *new; + char *newSpace; if (totalSpace < 100) { totalSpace = 200; } else { totalSpace *= 2; } - new = ckalloc(totalSpace); - strcpy(new, iPtr->result); + newSpace = ckalloc(totalSpace); + strcpy(newSpace, iPtr->result); if (iPtr->appendResult != NULL) { ckfree(iPtr->appendResult); } - iPtr->appendResult = new; + iPtr->appendResult = newSpace; iPtr->appendAvl = totalSpace; } else if (iPtr->result != iPtr->appendResult) { strcpy(iPtr->appendResult, iPtr->result); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 547ece1..ce687c6 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3563,7 +3563,7 @@ TclStringFirst( } if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) { - unsigned char *end, *try, *bh; + unsigned char *end, *check, *bh; unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln); /* Find bytes in bytes */ @@ -3574,25 +3574,25 @@ TclStringFirst( } end = bh + lh; - try = bh + start; - while (try + ln <= end) { + check = bh + start; + while (check + ln <= end) { /* * Look for the leading byte of the needle in the haystack - * starting at try and stopping when there's not enough room + * starting at check and stopping when there's not enough room * for the needle left. */ - try = memchr(try, bn[0], (end + 1 - ln) - try); - if (try == NULL) { + check = memchr(check, bn[0], (end + 1 - ln) - check); + if (check == NULL) { /* Leading byte not found -> needle cannot be found. */ return -1; } /* Leading byte found, check rest of needle. */ - if (0 == memcmp(try+1, bn+1, ln-1)) { + if (0 == memcmp(check+1, bn+1, ln-1)) { /* Checks! Return the successful index. */ - return (try - bh); + return (check - bh); } /* Rest of needle match failed; Iterate to continue search. */ - try++; + check++; } return -1; } @@ -3610,7 +3610,7 @@ TclStringFirst( */ { - Tcl_UniChar *try, *end, *uh; + Tcl_UniChar *check, *end, *uh; Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); uh = Tcl_GetUnicodeFromObj(haystack, &lh); @@ -3620,10 +3620,10 @@ TclStringFirst( } end = uh + lh; - for (try = uh + start; try + ln <= end; try++) { - if ((*try == *un) && (0 == - memcmp(try + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) { - return (try - uh); + for (check = uh + start; check + ln <= end; check++) { + if ((*check == *un) && (0 == + memcmp(check + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) { + return (check - uh); } } return -1; @@ -3667,7 +3667,7 @@ TclStringLast( } if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) { - unsigned char *try, *bh = Tcl_GetByteArrayFromObj(haystack, &lh); + unsigned char *check, *bh = Tcl_GetByteArrayFromObj(haystack, &lh); unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln); if (last >= lh) { @@ -3677,20 +3677,20 @@ TclStringLast( /* Don't start the loop if there cannot be a valid answer */ return -1; } - try = bh + last + 1 - ln; + check = bh + last + 1 - ln; - while (try >= bh) { - if ((*try == bn[0]) - && (0 == memcmp(try+1, bn+1, ln-1))) { - return (try - bh); + while (check >= bh) { + if ((*check == bn[0]) + && (0 == memcmp(check+1, bn+1, ln-1))) { + return (check - bh); } - try--; + check--; } return -1; } { - Tcl_UniChar *try, *uh = Tcl_GetUnicodeFromObj(haystack, &lh); + Tcl_UniChar *check, *uh = Tcl_GetUnicodeFromObj(haystack, &lh); Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); if (last >= lh) { @@ -3700,13 +3700,13 @@ TclStringLast( /* Don't start the loop if there cannot be a valid answer */ return -1; } - try = uh + last + 1 - ln; - while (try >= uh) { - if ((*try == un[0]) - && (0 == memcmp(try+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) { - return (try - uh); + check = uh + last + 1 - ln; + while (check >= uh) { + if ((*check == un[0]) + && (0 == memcmp(check+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) { + return (check - uh); } - try--; + check--; } return -1; } diff --git a/generic/tclTest.c b/generic/tclTest.c index 067d4a0..b365bd9 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -29,11 +29,6 @@ #include "tclRegexp.h" /* - * Required for TestlocaleCmd - */ -#include <locale.h> - -/* * Required for the TestChannelCmd and TestChannelEventCmd */ #include "tclIO.h" @@ -2404,11 +2399,11 @@ ExitProcOdd( void *clientData) /* Integer value to print. */ { char buf[16 + TCL_INTEGER_SPACE]; - size_t len; + int len; - sprintf(buf, "odd %" TCL_Z_MODIFIER "d\n", (size_t)PTR2INT(clientData)); + sprintf(buf, "odd %d\n", (int)PTR2INT(clientData)); len = strlen(buf); - if (len != (size_t) write(1, buf, len)) { + if (len != (int) write(1, buf, len)) { Tcl_Panic("ExitProcOdd: unable to write to stdout"); } } @@ -2418,11 +2413,11 @@ ExitProcEven( void *clientData) /* Integer value to print. */ { char buf[16 + TCL_INTEGER_SPACE]; - size_t len; + int len; - sprintf(buf, "even %" TCL_Z_MODIFIER "d\n", (size_t)PTR2INT(clientData)); + sprintf(buf, "even %d\n", (int)PTR2INT(clientData)); len = strlen(buf); - if (len != (size_t) write(1, buf, len)) { + if (len != (int) write(1, buf, len)) { Tcl_Panic("ExitProcEven: unable to write to stdout"); } } diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c index 913b253..11e841f 100644 --- a/generic/tclTestProcBodyObj.c +++ b/generic/tclTestProcBodyObj.c @@ -51,7 +51,7 @@ static int ProcBodyTestCheckObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int ProcBodyTestInitInternal(Tcl_Interp *interp, int isSafe); static int RegisterCommand(Tcl_Interp* interp, - const char *namespace, const CmdTable *cmdTablePtr); + const char *namesp, const CmdTable *cmdTablePtr); /* * List of commands to create when the package is loaded; must go after the @@ -139,7 +139,7 @@ static int RegisterCommand( Tcl_Interp* interp, /* the Tcl interpreter for which the operation * is performed */ - const char *namespace, /* the namespace in which the command is + const char *namesp, /* the namespace in which the command is * registered */ const CmdTable *cmdTablePtr)/* the command to register */ { @@ -147,13 +147,13 @@ RegisterCommand( if (cmdTablePtr->exportIt) { sprintf(buf, "namespace eval %s { namespace export %s }", - namespace, cmdTablePtr->cmdName); + namesp, cmdTablePtr->cmdName); if (Tcl_EvalEx(interp, buf, -1, 0) != TCL_OK) { return TCL_ERROR; } } - sprintf(buf, "%s::%s", namespace, cmdTablePtr->cmdName); + sprintf(buf, "%s::%s", namesp, cmdTablePtr->cmdName); Tcl_CreateObjCommand(interp, buf, cmdTablePtr->proc, 0, 0); return TCL_OK; } diff --git a/generic/tclTrace.c b/generic/tclTrace.c index ca246fb..cfa86b2 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -1920,7 +1920,7 @@ TraceExecutionProc( if ((flags & TCL_TRACE_ENTER_EXEC) && (tcmdPtr->stepTrace == NULL) && (tcmdPtr->flags & (TCL_TRACE_ENTER_DURING_EXEC | TCL_TRACE_LEAVE_DURING_EXEC))) { - unsigned len = strlen(command) + 1; + size_t len = strlen(command) + 1; tcmdPtr->startLevel = level; tcmdPtr->startCmd = ckalloc(len); diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 542a82a..6c39d1c 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -1044,7 +1044,7 @@ Tcl_UtfAtIndex( * * Results: * Stores the bytes represented by the backslash sequence in dst and - * returns the number of bytes written to dst. At most TCL_UTF_MAX bytes + * returns the number of bytes written to dst. At most 4 bytes * are written to dst; dst must have been large enough to accept those * bytes. If readPtr isn't NULL then it is filled in with a count of the * number of bytes in the backslash sequence. diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c index bc5998e..6ff60aa 100644 --- a/macosx/tclMacOSXFCmd.c +++ b/macosx/tclMacOSXFCmd.c @@ -347,7 +347,7 @@ TclMacOSXSetFileAttribute( Tcl_DStringAppend(&ds, native, -1); Tcl_DStringAppend(&ds, _PATH_RSRCFORKSPEC, -1); - result = truncate(Tcl_DStringValue(&ds), (off_t)0); + result = truncate(Tcl_DStringValue(&ds), 0); if (result != 0) { /* * truncate() on a valid resource fork path may fail with a diff --git a/tests/async.test b/tests/async.test index 34c2fdc..df13f83 100644 --- a/tests/async.test +++ b/tests/async.test @@ -20,6 +20,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} { catch [list package require -exact Tcltest [info patchlevel]] testConstraint testasync [llength [info commands testasync]] +testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] proc async1 {result code} { global aresult acode @@ -202,7 +203,7 @@ test async-4.2 {async interrupting straight bytecode sequence} -constraints { testasync delete $hm } test async-4.3 {async interrupting loop-less bytecode sequence} -constraints { - testasync + testasync knownMsvcBug } -setup { set hm [testasync create async3] } -body { diff --git a/tests/chanio.test b/tests/chanio.test index 1439fe4..4b71fef 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -43,6 +43,7 @@ namespace eval ::tcl::test::io { testConstraint testfevent [llength [info commands testfevent]] testConstraint testchannelevent [llength [info commands testchannelevent]] testConstraint testmainthread [llength [info commands testmainthread]] + testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] # You need a *very* special environment to do some tests. In particular, # many file systems do not support large-files... @@ -2790,7 +2791,7 @@ test chan-io-29.34 {Tcl_Chan Close, async flush on chan close, using sockets} -s chan puts $s $l } } -} -constraints {socket tempNotMac fileevent} -body { +} -constraints {socket tempNotMac fileevent knownMsvcBug} -body { proc accept {s a p} { variable x chan event $s readable [namespace code [list readit $s]] diff --git a/tests/cmdAH.test b/tests/cmdAH.test index 9dbe832..b15c77d 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -30,6 +30,7 @@ testConstraint linkDirectory [expr { ($::tcl_platform(osVersion) >= 5.0 && [lindex [file system [temporaryDirectory]] 1] eq "NTFS") }] +testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] global env set cmdAHwd [pwd] @@ -1328,7 +1329,7 @@ test cmdAH-25.2.1 {Tcl_FileObjCmd: owned} -constraints unix -setup { test cmdAH-25.3 {Tcl_FileObjCmd: owned} {unix notRoot} { file owned / } 0 -test cmdAH-25.3.1 {Tcl_FileObjCmd: owned} -constraints win -body { +test cmdAH-25.3.1 {Tcl_FileObjCmd: owned} -constraints {win knownMsvcBug} -body { file owned $env(windir) } -result 0 test cmdAH-25.4 {Tcl_FileObjCmd: owned} -body { diff --git a/tests/cmdMZ.test b/tests/cmdMZ.test index 60b104f..9df6d20 100644 --- a/tests/cmdMZ.test +++ b/tests/cmdMZ.test @@ -22,8 +22,11 @@ namespace eval ::tcl::test::cmdMZ { namespace import ::tcltest::makeFile namespace import ::tcltest::removeFile namespace import ::tcltest::temporaryDirectory + namespace import ::tcltest::testConstraint namespace import ::tcltest::test + testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] + proc ListGlobMatch {expected actual} { if {[llength $expected] != [llength $actual]} { return 0 @@ -339,7 +342,7 @@ test cmdMZ-5.4 {Tcl_TimeObjCmd: nothing happens with negative iteration counts} test cmdMZ-5.5 {Tcl_TimeObjCmd: result format} -body { time {format 1} } -match regexp -result {^\d+ microseconds per iteration} -test cmdMZ-5.6 {Tcl_TimeObjCmd: slower commands take longer} { +test cmdMZ-5.6 {Tcl_TimeObjCmd: slower commands take longer} knownMsvcBug { expr {[lindex [time {_nrt_sleep 1}] 0] < [lindex [time {_nrt_sleep 20}] 0]} } 1 test cmdMZ-5.7 {Tcl_TimeObjCmd: errors generate right trace} { @@ -349,6 +352,24 @@ test cmdMZ-5.7 {Tcl_TimeObjCmd: errors generate right trace} { "error foo" invoked from within "time {error foo}"}} +test cmdMZ-5.7.1 {Tcl_TimeObjCmd: return from time} { + set x 0 + proc r1 {} {upvar x x; time {incr x; return "r1"; incr x} 10} + list [r1] $x +} {r1 1} +test cmdMZ-5.8 {Tcl_TimeObjCmd: done optimization: nested call of self inside time (if compiled)} { + set x [set y 0] + set m1 { + if {[incr x] <= 5} { + # nested call should return result, so covering that: + if {![string is integer -strict [eval $m1]]} {error unexpected} + } + # increase again (no "continue" from nested call): + incr x + } + time {incr y; eval $m1} 5 + list $y $x +} {5 20} test cmdMZ-6.1 {Tcl_TimeRateObjCmd: basic format of command} { list [catch {timerate} msg] $msg @@ -374,7 +395,7 @@ test cmdMZ-6.5a {Tcl_TimeRateObjCmd: result format and one iteration} { test cmdMZ-6.5b {Tcl_TimeRateObjCmd: result format without iterations} { regexp {^0 \ws/# 0 # 0 #/sec 0 net-ms$} [timerate {} 0 0] } 1 -test cmdMZ-6.6 {Tcl_TimeRateObjCmd: slower commands take longer, but it remains almost the same time of measument} { +test cmdMZ-6.6 {Tcl_TimeRateObjCmd: slower commands take longer, but it remains almost the same time of measument} knownMsvcBug { set m1 [timerate {_nrt_sleep 0} 20] set m2 [timerate {_nrt_sleep 0.2} 20] list \ @@ -395,6 +416,11 @@ test cmdMZ-6.7 {Tcl_TimeRateObjCmd: errors generate right trace} { "error foo" invoked from within "timerate {error foo} 1"}} +test cmdMZ-6.7.1 {Tcl_TimeRateObjCmd: return from timerate} { + set x 0 + proc r1 {} {upvar x x; timerate {incr x; return "r1"; incr x} 1000 10} + list [r1] $x +} {r1 1} test cmdMZ-6.8 {Tcl_TimeRateObjCmd: allow (conditional) break from timerate} { set m1 [timerate {break}] list \ @@ -406,10 +432,10 @@ test cmdMZ-6.8 {Tcl_TimeRateObjCmd: allow (conditional) break from timerate} { test cmdMZ-6.8.1 {Tcl_TimeRateObjCmd: allow (conditional) continue in timerate} { set m1 [timerate {continue; return -code error "unexpected"} 1000 10] list \ - [expr {[lindex $m1 0] < 1000}] \ - [expr {[lindex $m1 2] == 10}] \ - [expr {[lindex $m1 4] > 1000}] \ - [expr {[lindex $m1 6] < 100}] + [expr {[lindex $m1 0] < 1000}] \ + [expr {[lindex $m1 2] == 10}] \ + [expr {[lindex $m1 4] > 1000}] \ + [expr {[lindex $m1 6] < 100}] } {1 1 1 1} test cmdMZ-6.9 {Tcl_TimeRateObjCmd: max count of iterations} { set m1 [timerate {} 1000 5]; # max-count wins @@ -430,6 +456,18 @@ test cmdMZ-6.11 {Tcl_TimeRateObjCmd: done/continue optimization rollback} { timerate $m1 1000 10 if 1 $m1; # if rollback is missing throws an error: invoked "continue" outside of a loop } ok +test cmdMZ-6.12 {Tcl_TimeRateObjCmd: done optimization: nested call of self inside timerate} { + set x 0 + set m1 { + if {[incr x] <= 5} { + # nested call should return result, so covering that: + if {![string is integer -strict [eval $m1]]} {error unexpected} + } + # increase again (no "continue" from nested call): + incr x + } + list [lindex [timerate $m1 1000 5] 2] $x +} {5 20} test cmdMZ-try-1.0 { diff --git a/tests/fileSystem.test b/tests/fileSystem.test index 2494cb4..361542d 100644 --- a/tests/fileSystem.test +++ b/tests/fileSystem.test @@ -34,6 +34,7 @@ catch { testConstraint testfilesystem [llength [info commands ::testfilesystem]] testConstraint testsetplatform [llength [info commands ::testsetplatform]] testConstraint testsimplefilesystem [llength [info commands ::testsimplefilesystem]] +testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] cd [tcltest::temporaryDirectory] makeFile "test file" gorp.file @@ -312,7 +313,7 @@ test filesystem-1.37 {file normalisation with '/./'} -body { } -match regexp -result {^(?:[^/]|/(?:[^/]|$))+$} test filesystem-1.38 {file normalisation with volume relative} -setup { set dir [pwd] -} -constraints {win moreThanOneDrive} -body { +} -constraints {win moreThanOneDrive knownMsvcBug} -body { set path "[string range [lindex $drives 0] 0 1]foo" cd [lindex $drives 1] file norm $path diff --git a/tests/format.test b/tests/format.test index 1bf46a1..3640376 100644 --- a/tests/format.test +++ b/tests/format.test @@ -20,6 +20,7 @@ testConstraint longIs32bit [expr {$tcl_platform(wordSize) == 4}] testConstraint longIs64bit [expr {$tcl_platform(wordSize) == 8}] testConstraint wideIs64bit [expr {wide(0x8000000000000000) < 0}] testConstraint pointerIs64bit [expr {$tcl_platform(pointerSize) >= 8}] +testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] test format-1.1 {integer formatting} { format "%*d %d %d %d" 6 34 16923 -12 -1 @@ -263,13 +264,13 @@ test format-6.1 {floating-point zeroes} {eformat} { test format-6.2 {floating-point zeroes} {eformat} { format "%.4e %.4f %.4g" 0.0 0.0 0.0 0.0 } {0.0000e+00 0.0000 0} -test format-6.3 {floating-point zeroes} {eformat} { +test format-6.3 {floating-point zeroes} {eformat knownMsvcBug} { format "%#.4e %#.4f %#.4g" 0.0 0.0 0.0 0.0 } {0.0000e+00 0.0000 0.000} test format-6.4 {floating-point zeroes} {eformat} { format "%.0e %.0f %.0g" 0.0 0.0 0.0 0.0 } {0e+00 0 0} -test format-6.5 {floating-point zeroes} {eformat} { +test format-6.5 {floating-point zeroes} {eformat knownMsvcBug} { format "%#.0e %#.0f %#.0g" 0.0 0.0 0.0 0.0 } {0.e+00 0. 0.} test format-6.6 {floating-point zeroes} { diff --git a/tests/http.test b/tests/http.test index cf30348..2184449 100644 --- a/tests/http.test +++ b/tests/http.test @@ -186,7 +186,7 @@ test http-3.7 {http::geturl} -body { <h2>GET $tail</h2> </body></html>" test http-3.8 {http::geturl} -body { - set token [http::geturl $url -query Name=Value&Foo=Bar -timeout 2000] + set token [http::geturl $url -query Name=Value&Foo=Bar -timeout 3000] http::data $token } -cleanup { http::cleanup $token @@ -352,7 +352,7 @@ test http-3.24 {http::geturl parse failures} -body { test http-3.25 {http::meta} -setup { unset -nocomplain m token } -body { - set token [http::geturl $url -timeout 2000] + set token [http::geturl $url -timeout 3000] array set m [http::meta $token] lsort [array names m] } -cleanup { @@ -362,7 +362,7 @@ test http-3.25 {http::meta} -setup { test http-3.26 {http::meta} -setup { unset -nocomplain m token } -body { - set token [http::geturl $url -headers {X-Check 1} -timeout 2000] + set token [http::geturl $url -headers {X-Check 1} -timeout 3000] array set m [http::meta $token] lsort [array names m] } -cleanup { @@ -588,7 +588,7 @@ test http-4.14 {http::Event} -body { test http-4.15 {http::Event} -body { # This test may fail if you use a proxy server. That is to be # expected and is not a problem with Tcl. - set token [http::geturl //not_a_host.tcl.tk -timeout 1000 -command \#] + set token [http::geturl //not_a_host.tcl.tk -timeout 3000 -command \#] http::wait $token http::status $token # error codes vary among platforms. diff --git a/tests/io.test b/tests/io.test index 39deab6..6d9e1c3 100644 --- a/tests/io.test +++ b/tests/io.test @@ -43,6 +43,7 @@ testConstraint testfevent [llength [info commands testfevent]] testConstraint testchannelevent [llength [info commands testchannelevent]] testConstraint testmainthread [llength [info commands testmainthread]] testConstraint testobj [llength [info commands testobj]] +testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] # You need a *very* special environment to do some tests. In # particular, many file systems do not support large-files... @@ -2228,7 +2229,7 @@ test io-27.5 {FlushChannel, implicit flush when buffer fills and on close} \ set path(pipe) [makeFile {} pipe] set path(output) [makeFile {} output] test io-27.6 {FlushChannel, async flushing, async close} \ - {stdio asyncPipeClose openpipe} { + {stdio asyncPipeClose openpipe knownMsvcBug} { # This test may fail on old Unix systems (seen on IRIX64 6.5) with # obsolete gettimeofday() calls. See Tcl Bugs 3530533, 1942197. file delete $path(pipe) @@ -2832,7 +2833,7 @@ test io-29.31 {Tcl_WriteChars, background flush} {stdio openpipe} { set result } ok test io-29.32 {Tcl_WriteChars, background flush to slow reader} \ - {stdio asyncPipeClose openpipe} { + {stdio asyncPipeClose openpipe knownMsvcBug} { # This test may fail on old Unix systems (seen on IRIX64 6.5) with # obsolete gettimeofday() calls. See Tcl Bugs 3530533, 1942197. file delete $path(pipe) diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 87ad4af..89afb0a 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -25,6 +25,7 @@ package require tcltests # Custom constraints used in this file testConstraint testchannel [llength [info commands testchannel]] +testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] #---------------------------------------------------------------------- @@ -810,7 +811,7 @@ test iocmd-21.19 {chan create, init failure -> no channel, no finalize} -match g rename foo {} set res } -result {{} {initialize rc* {read write}} 1 {*all required methods*} {}} -test iocmd-21.20 {Bug 88aef05cda} -setup { +test iocmd-21.20 {Bug 88aef05cda} -constraints knownMsvcBug -setup { proc foo {method chan args} { switch -- $method blocking { chan configure $chan -blocking [lindex $args 0] @@ -2015,7 +2016,7 @@ test iocmd-31.6 {chan postevent, posted events do happen} -match glob -body { set c [chan create {r w} foo] set tock {} note [fileevent $c readable {lappend res TOCK; set tock 1}] - set stop [after 10000 {lappend res TIMEOUT; set tock 1}] + set stop [after 15000 {lappend res TIMEOUT; set tock 1}] after 1000 {note [chan postevent $c r]} vwait ::tock catch {after cancel $stop} @@ -2028,7 +2029,7 @@ test iocmd-31.7 {chan postevent, posted events do happen} -match glob -body { proc foo {args} {oninit; onfinal; track; return} set c [chan create {r w} foo] note [fileevent $c writable {lappend res TOCK; set tock 1}] - set stop [after 10000 {lappend res TIMEOUT; set tock 1}] + set stop [after 15000 {lappend res TIMEOUT; set tock 1}] after 1000 {note [chan postevent $c w]} vwait ::tock catch {after cancel $stop} diff --git a/tests/socket.test b/tests/socket.test index b91668e..84320bd 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -75,6 +75,7 @@ if {[expr {[info exists ::env(TRAVIS_OSX_IMAGE)] && [string match xcode* $::env( # Some tests require the Thread package or exec command testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}] testConstraint exec [llength [info commands exec]] +testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] # Produce a random port number in the Dynamic/Private range # from 49152 through 65535. @@ -2285,7 +2286,7 @@ test socket-14.10.1 {pending [socket -async] and nonblocking [puts], server is I removeFile script } -result {{} ok} test socket-14.11.0 {pending [socket -async] and nonblocking [puts], no listener, no flush} \ - -constraints {socket} \ + -constraints {socket knownMsvcBug} \ -body { set sock [socket -async localhost [randport]] fconfigure $sock -blocking 0 diff --git a/tests/winFCmd.test b/tests/winFCmd.test index 8a5173a..2bce77c 100644 --- a/tests/winFCmd.test +++ b/tests/winFCmd.test @@ -28,6 +28,7 @@ testConstraint testchmod [llength [info commands testchmod]] testConstraint cdrom 0 testConstraint exdev 0 testConstraint longFileNames 0 +testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}] proc createfile {file {string a}} { set f [open $file w] @@ -393,7 +394,7 @@ proc MakeFiles {dirname} { test winFCmd-1.38 {TclpRenameFile: check rename of conflicting inodes} -setup { cleanup -} -constraints {win winNonZeroInodes} -body { +} -constraints {win winNonZeroInodes knownMsvcBug} -body { file mkdir td1 foreach {a b} [MakeFiles td1] break file rename -force $a $b @@ -638,7 +639,7 @@ test winFCmd-5.1 {TclpCopyDirectory: calls TraverseWinTree} -setup { test winFCmd-6.1 {TclpRemoveDirectory: errno: EACCES} -setup { cleanup -} -constraints {winVista testfile testchmod} -body { +} -constraints {winVista testfile testchmod knownMsvcBug} -body { file mkdir td1 testchmod 0 td1 testfile rmdir td1 @@ -692,7 +693,7 @@ test winFCmd-6.8 {TclpRemoveDirectory: RemoveDirectory fails} -setup { } -result {1 {tf1 ENOTDIR}} test winFCmd-6.9 {TclpRemoveDirectory: errno == EACCES} -setup { cleanup -} -constraints {winVista testfile testchmod} -body { +} -constraints {winVista testfile testchmod knownMsvcBug} -body { file mkdir td1 testchmod 0 td1 testfile rmdir td1 @@ -710,7 +711,7 @@ test winFCmd-6.11 {TclpRemoveDirectory: attr == -1} -setup { } -returnCodes error -match regexp -result {^/ E(ACCES|EXIST)$} test winFCmd-6.13 {TclpRemoveDirectory: write-protected} -setup { cleanup -} -constraints {winVista testfile testchmod} -body { +} -constraints {winVista testfile testchmod knownMsvcBug} -body { file mkdir td1 testchmod 0 td1 testfile rmdir td1 @@ -939,7 +940,7 @@ test winFCmd-9.1 {TraversalDelete: DOTREE_F} -setup { } -result {} test winFCmd-9.3 {TraversalDelete: DOTREE_PRED} -setup { cleanup -} -constraints {winVista testfile testchmod} -body { +} -constraints {winVista testfile testchmod knownMsvcBug} -body { file mkdir td1/td2 testchmod 0 td1 testfile rmdir -force td1 diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index 1ed3f59..e0a826c 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -887,7 +887,7 @@ CopyArray( int buflen) /* Size of buffer. */ { int i, j, len = 0; - char *p, **new; + char *p, **newBuffer; if (src == NULL) { return 0; @@ -903,7 +903,7 @@ CopyArray( return -1; } - new = (char **) buf; + newBuffer = (char **) buf; p = buf + len; for (j = 0; j < i; j++) { @@ -914,10 +914,10 @@ CopyArray( return -1; } memcpy(p, src[j], sz); - new[j] = p; + newBuffer[j] = p; p = buf + len; } - new[j] = NULL; + newBuffer[j] = NULL; return len; } diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 004fbff..eec0fd9 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -9,8 +9,6 @@ */ #include "tclInt.h" -#include <stddef.h> -#include <locale.h> #ifdef HAVE_LANGINFO # include <langinfo.h> # ifdef __APPLE__ diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 1d8b351..51d486e 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -11,7 +11,6 @@ */ #include "tclInt.h" -#include <locale.h> #if defined(TCL_WIDE_CLICKS) && defined(MAC_OSX_TCL) #include <mach/mach_time.h> #endif @@ -28,14 +28,14 @@ _tmain(void) const char *err; while (1) { - n = read(0, buf, sizeof(buf)); + n = _read(0, buf, sizeof(buf)); if (n <= 0) { break; } - write(1, buf, n); + _write(1, buf, n); } err = (sizeof(int) == 2) ? "stderr16" : "stderr32"; - write(2, err, strlen(err)); + _write(2, err, (unsigned int)strlen(err)); return 0; } diff --git a/win/makefile.vc b/win/makefile.vc index 501121a..c2343a0 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -52,7 +52,7 @@ # turn on the 64-bit compiler, if your SDK has it.
#
# Basic macros and options usable on the commandline (see rules.vc for more info):
-# OPTS=msvcrt,static,staticpkg,symbols,profile,unchecked,time64bit,none
+# OPTS=msvcrt,static,staticpkg,symbols,profile,unchecked,time64bit,utfmax,none
# Sets special options for the core. The default is for none.
# Any combination of the above may be used (comma separated).
# 'none' will over-ride everything to nothing.
@@ -74,6 +74,8 @@ # or libcmt.lib not libcmtd.lib).
# time64bit = Forces a build using 64-bit time_t for 32-bit build
# (CRT library should support this).
+# utfmax = Forces Tcl_UniChar to be a 32-bit quantity in stead
+# of 16-bits
#
# STATS=compdbg,memdbg,none
# Sets optional memory and bytecode compiler debugging code added
diff --git a/win/rules.vc b/win/rules.vc index a0cf06a..3fa0704 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -688,6 +688,7 @@ LINKERFLAGS = $(LINKERFLAGS) -ltcg # configuration (ignored for Tcl itself)
# _USE_64BIT_TIME_T - forces a build using 64-bit time_t for 32-bit build
# (CRT library should support this)
+# TCL_UTF_MAX=6 - forces a build using 32-bit Tcl_UniChar in stead of 16-bit.
# Further, LINKERFLAGS are modified based on above.
# Default values for all the above
@@ -752,6 +753,11 @@ TCL_USE_STATIC_PACKAGES = 0 _USE_64BIT_TIME_T = 1
!endif
+!if [nmakehlp -f $(OPTS) "utfmax"]
+!message *** Force 32-bit Tcl_UniChar
+TCL_UTF_MAX = 6
+!endif
+
# Yes, it's weird that the "symbols" option controls DEBUG and
# the "pdbs" option controls SYMBOLS. That's historical.
!if [nmakehlp -f $(OPTS) "symbols"]
@@ -1315,6 +1321,9 @@ OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 !if "$(_USE_64BIT_TIME_T)" == "1"
OPTDEFINES = $(OPTDEFINES) -D_USE_64BIT_TIME_T
!endif
+!if "$(TCL_UTF_MAX)" == "6"
+OPTDEFINES = $(OPTDEFINES) -DTCL_UTF_MAX=6
+!endif
# _ATL_XP_TARGETING - Newer SDK's need this to build for XP
COMPILERFLAGS = /D_ATL_XP_TARGETING
diff --git a/win/tclWinNotify.c b/win/tclWinNotify.c index 89a1b66..dba7a31 100644 --- a/win/tclWinNotify.c +++ b/win/tclWinNotify.c @@ -83,7 +83,6 @@ Tcl_InitNotifier(void) return tclNotifierHooks.initNotifierProc(); } else { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - WNDCLASS class; TclpMasterLock(); if (!initialized) { @@ -99,18 +98,20 @@ Tcl_InitNotifier(void) EnterCriticalSection(¬ifierMutex); if (notifierCount == 0) { - class.style = 0; - class.cbClsExtra = 0; - class.cbWndExtra = 0; - class.hInstance = TclWinGetTclInstance(); - class.hbrBackground = NULL; - class.lpszMenuName = NULL; - class.lpszClassName = className; - class.lpfnWndProc = NotifierProc; - class.hIcon = NULL; - class.hCursor = NULL; - - if (!RegisterClass(&class)) { + WNDCLASS clazz; + + clazz.style = 0; + clazz.cbClsExtra = 0; + clazz.cbWndExtra = 0; + clazz.hInstance = TclWinGetTclInstance(); + clazz.hbrBackground = NULL; + clazz.lpszMenuName = NULL; + clazz.lpszClassName = className; + clazz.lpfnWndProc = NotifierProc; + clazz.hIcon = NULL; + clazz.hCursor = NULL; + + if (!RegisterClass(&clazz)) { Tcl_Panic("Unable to register TclNotifier window class"); } } diff --git a/win/tclWinTime.c b/win/tclWinTime.c index bfebbe6..f103a4f 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -124,7 +124,7 @@ static struct { int initialized; /* 1 if initialized, 0 otherwise */ int perfCounter; /* 1 if performance counter usable for wide clicks */ double microsecsScale; /* Denominator scale between clock / microsecs */ -} wideClick = {0, 0.0}; +} wideClick = {0, 0, 0.0}; /* |