summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-01-11 14:39:41 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-01-11 14:39:41 (GMT)
commite82dd71ac092652145ab49221c8d8a6b9dc0f209 (patch)
treed5e8b2c967fdd5a796015227eb068616d54ff42a
parentb7d767154a25960e4f0f906497db491d24d65c6a (diff)
parenta570984b2aff26b6147c3b820666524416b008ed (diff)
downloadtcl-e82dd71ac092652145ab49221c8d8a6b9dc0f209.zip
tcl-e82dd71ac092652145ab49221c8d8a6b9dc0f209.tar.gz
tcl-e82dd71ac092652145ab49221c8d8a6b9dc0f209.tar.bz2
merge trunk
-rw-r--r--generic/tcl.decls6
-rw-r--r--generic/tclBasic.c29
-rw-r--r--generic/tclDecls.h19
-rw-r--r--generic/tclStubInit.c2
-rw-r--r--macosx/Tcl-Common.xcconfig2
-rw-r--r--tests/clock.test4
-rw-r--r--unix/tclUnixTime.c2
-rw-r--r--win/tclWinTime.c60
8 files changed, 54 insertions, 70 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 9ab1c8c..0b892da 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -253,10 +253,10 @@ declare 64 {
declare 65 {
void Tcl_SetStringObj(Tcl_Obj *objPtr, const char *bytes, int length)
}
-declare 66 {
- void Tcl_AddErrorInfo(Tcl_Interp *interp, const char *message)
-}
# Removed in 9.0:
+#declare 66 {
+# void Tcl_AddErrorInfo(Tcl_Interp *interp, const char *message)
+#}
#declare 67 {
# void Tcl_AddObjErrorInfo(Tcl_Interp *interp, const char *message,
# int length)
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 7ef671a..717ab3c 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -6112,35 +6112,6 @@ Tcl_ExprString(
/*
*----------------------------------------------------------------------
*
- * Tcl_AddErrorInfo --
- *
- * Add information to the errorInfo field that describes the current
- * error.
- *
- * Results:
- * None.
- *
- * Side effects:
- * The contents of message are appended to the errorInfo field. If we are
- * just starting to log an error, errorInfo is initialized from the error
- * message in the interpreter's result.
- *
- *----------------------------------------------------------------------
- */
-
-#undef Tcl_AddErrorInfo
-void
-Tcl_AddErrorInfo(
- Tcl_Interp *interp, /* Interpreter to which error information
- * pertains. */
- const char *message) /* Message to record. */
-{
- Tcl_AppendObjToErrorInfo((interp), Tcl_NewStringObj(message, -1));
-}
-
-/*
- *----------------------------------------------------------------------
- *
* Tcl_AppendObjToErrorInfo --
*
* Add a Tcl_Obj value to the errorInfo field that describes the current
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 5778f9a..74553be 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -212,9 +212,7 @@ TCLAPI void Tcl_SetObjLength(Tcl_Obj *objPtr, int length);
/* 65 */
TCLAPI void Tcl_SetStringObj(Tcl_Obj *objPtr, const char *bytes,
int length);
-/* 66 */
-TCLAPI void Tcl_AddErrorInfo(Tcl_Interp *interp,
- const char *message);
+/* Slot 66 is reserved */
/* Slot 67 is reserved */
/* 68 */
TCLAPI void Tcl_AllowExceptions(Tcl_Interp *interp);
@@ -1827,7 +1825,7 @@ typedef struct TclStubs {
void (*tcl_SetLongObj) (Tcl_Obj *objPtr, long longValue); /* 63 */
void (*tcl_SetObjLength) (Tcl_Obj *objPtr, int length); /* 64 */
void (*tcl_SetStringObj) (Tcl_Obj *objPtr, const char *bytes, int length); /* 65 */
- void (*tcl_AddErrorInfo) (Tcl_Interp *interp, const char *message); /* 66 */
+ void (*reserved66)(void);
void (*reserved67)(void);
void (*tcl_AllowExceptions) (Tcl_Interp *interp); /* 68 */
void (*tcl_AppendElement) (Tcl_Interp *interp, const char *element); /* 69 */
@@ -2558,8 +2556,7 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_SetObjLength) /* 64 */
#define Tcl_SetStringObj \
(tclStubsPtr->tcl_SetStringObj) /* 65 */
-#define Tcl_AddErrorInfo \
- (tclStubsPtr->tcl_AddErrorInfo) /* 66 */
+/* Slot 66 is reserved */
/* Slot 67 is reserved */
#define Tcl_AllowExceptions \
(tclStubsPtr->tcl_AllowExceptions) /* 68 */
@@ -3673,7 +3670,6 @@ extern const TclStubs *tclStubsPtr;
# undef Tcl_Init
# undef Tcl_ObjSetVar2
# undef Tcl_StaticPackage
-# undef TclFSGetNativePath
# define Tcl_CreateInterp() (tclStubsPtr->tcl_CreateInterp())
# define Tcl_GetStringResult(interp) (tclStubsPtr->tcl_GetStringResult(interp))
# define Tcl_Init(interp) (tclStubsPtr->tcl_Init(interp))
@@ -3708,11 +3704,6 @@ extern const TclStubs *tclStubsPtr;
#undef Tcl_SetBooleanObj
#define Tcl_SetBooleanObj(objPtr, boolValue) \
Tcl_SetIntObj((objPtr), (boolValue)!=0)
-#undef Tcl_AddErrorInfo
-#define Tcl_AddErrorInfo(interp, message) \
- Tcl_AppendObjToErrorInfo((interp), Tcl_NewStringObj((message), -1))
-#define Tcl_AddObjErrorInfo(interp, message, length) \
- Tcl_AppendObjToErrorInfo((interp), Tcl_NewStringObj((message), length))
#define Tcl_SaveResult(interp, statePtr) \
do { \
*(statePtr) = Tcl_GetObjResult(interp); \
@@ -3741,6 +3732,10 @@ extern const TclStubs *tclStubsPtr;
Tcl_VarTraceInfo2(interp, varName, NULL, flags, proc, prevClientData)
#define Tcl_UpVar(interp, frameName, varName, localName, flags) \
Tcl_UpVar2(interp, frameName, varName, NULL, localName, flags)
+#define Tcl_AddErrorInfo(interp, message) \
+ Tcl_AppendObjToErrorInfo(interp, Tcl_NewStringObj(message, -1))
+#define Tcl_AddObjErrorInfo(interp, message, length) \
+ Tcl_AppendObjToErrorInfo(interp, Tcl_NewStringObj(message, length))
#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS)
# if defined(__CYGWIN__) && defined(TCL_WIDE_INT_IS_LONG)
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index f9a69cd..dcba82e 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -777,7 +777,7 @@ const TclStubs tclStubs = {
Tcl_SetLongObj, /* 63 */
Tcl_SetObjLength, /* 64 */
Tcl_SetStringObj, /* 65 */
- Tcl_AddErrorInfo, /* 66 */
+ 0, /* 66 */
0, /* 67 */
Tcl_AllowExceptions, /* 68 */
Tcl_AppendElement, /* 69 */
diff --git a/macosx/Tcl-Common.xcconfig b/macosx/Tcl-Common.xcconfig
index 6ee8d58..13b5df5 100644
--- a/macosx/Tcl-Common.xcconfig
+++ b/macosx/Tcl-Common.xcconfig
@@ -19,7 +19,7 @@ GCC_NO_COMMON_BLOCKS = YES
GCC_DYNAMIC_NO_PIC = YES
GCC_VERSION = 4.2
GCC = gcc-$(GCC_VERSION)
-WARNING_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-value -Winit-self -Wpointer-arith -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS)
+WARNING_CFLAGS = -Wall -Wwrite-strings -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-value -Winit-self -Wpointer-arith -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS)
BINDIR = $(PREFIX)/bin
CFLAGS = $(CFLAGS)
CPPFLAGS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) $(CPPFLAGS)
diff --git a/tests/clock.test b/tests/clock.test
index 08036ca..6a0fecd 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -37009,10 +37009,10 @@ test clock-67.5 {Change scan %x output on global locale change [Bug 4a0c163d24]}
set current [msgcat::mclocale]
} -body {
msgcat::mclocale de_de
- set res [clock scan "01.01.1970" -locale current -format %x]
+ set res [clock scan "01.01.1970" -locale current -format %x -gmt 1]
msgcat::mclocale en_uk
# This will fail without the bug fix, as still de_de is active
- expr {$res == [clock scan "01/01/1970" -locale current -format %x]}
+ expr {$res == [clock scan "01/01/1970" -locale current -format %x -gmt 1]}
} -cleanup {
msgcat::mclocale $current
} -result {1}
diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c
index 470b122..148b022 100644
--- a/unix/tclUnixTime.c
+++ b/unix/tclUnixTime.c
@@ -133,7 +133,7 @@ TclpGetWideClicks(void)
Tcl_Time time;
tclGetTimeProcPtr(&time, tclTimeClientData);
- now = (Tcl_WideInt) (time.sec*1000000 + time.usec);
+ now = ((Tcl_WideInt)time.sec)*1000000 + time.usec;
} else {
#ifdef MAC_OSX_TCL
now = (Tcl_WideInt) (mach_absolute_time() & INT64_MAX);
diff --git a/win/tclWinTime.c b/win/tclWinTime.c
index 7504952..598dade 100644
--- a/win/tclWinTime.c
+++ b/win/tclWinTime.c
@@ -257,8 +257,6 @@ NativeGetTime(
ClientData clientData)
{
struct _timeb t;
- int useFtime = 1; /* Flag == TRUE if we need to fall back on
- * ftime rather than using the perf counter. */
/*
* Initialize static storage on the first trip through.
@@ -374,6 +372,10 @@ NativeGetTime(
* time.
*/
+ ULARGE_INTEGER fileTimeLastCall;
+ LARGE_INTEGER perfCounterLastCall, curCounterFreq;
+ /* Copy with current data of calibration cycle */
+
LARGE_INTEGER curCounter;
/* Current performance counter. */
Tcl_WideInt curFileTime;/* Current estimated time, expressed as 100-ns
@@ -387,9 +389,29 @@ NativeGetTime(
posixEpoch.LowPart = 0xD53E8000;
posixEpoch.HighPart = 0x019DB1DE;
+ QueryPerformanceCounter(&curCounter);
+
+ /*
+ * Hold time section locked as short as possible
+ */
EnterCriticalSection(&timeInfo.cs);
- QueryPerformanceCounter(&curCounter);
+ fileTimeLastCall.QuadPart = timeInfo.fileTimeLastCall.QuadPart;
+ perfCounterLastCall.QuadPart = timeInfo.perfCounterLastCall.QuadPart;
+ curCounterFreq.QuadPart = timeInfo.curCounterFreq.QuadPart;
+
+ LeaveCriticalSection(&timeInfo.cs);
+
+ /*
+ * If calibration cycle occurred after we get curCounter
+ */
+ if (curCounter.QuadPart <= perfCounterLastCall.QuadPart) {
+ usecSincePosixEpoch =
+ (fileTimeLastCall.QuadPart - posixEpoch.QuadPart) / 10;
+ timePtr->sec = (long) (usecSincePosixEpoch / 1000000);
+ timePtr->usec = (unsigned long) (usecSincePosixEpoch % 1000000);
+ return;
+ }
/*
* If it appears to be more than 1.1 seconds since the last trip
@@ -401,31 +423,27 @@ NativeGetTime(
* loop should recover.
*/
- if (curCounter.QuadPart - timeInfo.perfCounterLastCall.QuadPart <
- 11 * timeInfo.curCounterFreq.QuadPart / 10) {
- curFileTime = timeInfo.fileTimeLastCall.QuadPart +
- ((curCounter.QuadPart - timeInfo.perfCounterLastCall.QuadPart)
- * 10000000 / timeInfo.curCounterFreq.QuadPart);
- timeInfo.fileTimeLastCall.QuadPart = curFileTime;
- timeInfo.perfCounterLastCall.QuadPart = curCounter.QuadPart;
+ if (curCounter.QuadPart - perfCounterLastCall.QuadPart <
+ 11 * curCounterFreq.QuadPart / 10
+ ) {
+ curFileTime = fileTimeLastCall.QuadPart +
+ ((curCounter.QuadPart - perfCounterLastCall.QuadPart)
+ * 10000000 / curCounterFreq.QuadPart);
+
usecSincePosixEpoch = (curFileTime - posixEpoch.QuadPart) / 10;
timePtr->sec = (long) (usecSincePosixEpoch / 1000000);
timePtr->usec = (unsigned long) (usecSincePosixEpoch % 1000000);
- useFtime = 0;
+ return;
}
-
- LeaveCriticalSection(&timeInfo.cs);
}
- if (useFtime) {
- /*
- * High resolution timer is not available. Just use ftime.
- */
+ /*
+ * High resolution timer is not available. Just use ftime.
+ */
- _ftime(&t);
- timePtr->sec = (long)t.time;
- timePtr->usec = t.millitm * 1000;
- }
+ _ftime(&t);
+ timePtr->sec = (long)t.time;
+ timePtr->usec = t.millitm * 1000;
}
/*