From 5645bb01ffdfc76dbf7e9a026cb146f3d7b5eafc Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 13 Jun 2019 17:20:45 +0000 Subject: Test namespace-56.4 detects Bug 8b9854c3d8. Branch open to fix it. --- tests/namespace.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/namespace.test b/tests/namespace.test index 1d26512..58d6839 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -3323,6 +3323,19 @@ namespace eval : { : p1 } 16fe1b5807 + +test namespace-56.4 {Bug 8b9854c3d8} -setup { + namespace eval namespace-56.4 { + proc cmd {} {string match ::* [lindex [info level 0] 0]} + namespace export * + namespace ensemble create + } +} -body { + namespace-56.4 cmd +} -cleanup { + namespace delete namespace-56.4 +} -result 1 + # cleanup catch {rename cmd1 {}} -- cgit v0.12 From 1cd98b93bd922cc624acf57f7547984606f4f565 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 13 Jun 2019 17:37:46 +0000 Subject: Unique test name. --- tests/namespace.test | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/namespace.test b/tests/namespace.test index 58d6839..eef2eb7 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -3324,16 +3324,16 @@ namespace eval : { : p1 } 16fe1b5807 -test namespace-56.4 {Bug 8b9854c3d8} -setup { - namespace eval namespace-56.4 { - proc cmd {} {string match ::* [lindex [info level 0] 0]} +test namespace-56.5 {Bug 8b9854c3d8} -setup { + namespace eval namespace-56.5 { + proc cmd {} {string match ::* [lindex [[string cat info] level 0] 0]} namespace export * namespace ensemble create } } -body { - namespace-56.4 cmd + namespace-56.5 cmd } -cleanup { - namespace delete namespace-56.4 + namespace delete namespace-56.5 } -result 1 -- cgit v0.12 From 1ebe878444abb6e6e9a919c99e6f1736353917ef Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 13 Jun 2019 17:58:48 +0000 Subject: Fix Bug 8b9854c3d8. Now 4 test failures require examination. --- generic/tclEnsemble.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index dfffe12..3352d1f 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -2694,7 +2694,11 @@ BuildEnsembleConfig( if (isNew) { Tcl_Obj *cmdObj, *cmdPrefixObj; - cmdObj = Tcl_NewStringObj(nsCmdName, -1); + TclNewObj(cmdObj); + Tcl_AppendStringsToObj(cmdObj, + ensemblePtr->nsPtr->fullName, + (ensemblePtr->nsPtr->parentPtr ? "::" : ""), + nsCmdName, NULL); cmdPrefixObj = Tcl_NewListObj(1, &cmdObj); Tcl_SetHashValue(hPtr, cmdPrefixObj); Tcl_IncrRefCount(cmdPrefixObj); -- cgit v0.12 From 526c432322c2df709ecad50d5450141e8c883fa8 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 13 Jun 2019 20:43:04 +0000 Subject: Mark test namespace-54.6 as knownBug. The real bug here is Tcl's failure to forbid ":" as a namespace name. --- tests/namespace.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/namespace.test b/tests/namespace.test index eef2eb7..ad82abe 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -1797,7 +1797,7 @@ test namespace-42.7 {ensembles: nested} -body { list [ns x0 z] [ns x1] [ns x2] [ns x3] } -cleanup { namespace delete ns -} -result {{1 z} 1 2 3} +} -result {{1 ::ns::x0::z} 1 2 3} test namespace-42.8 { ensembles: [Bug 1670091], panic due to pointer to a deallocated List struct. @@ -2128,7 +2128,7 @@ test namespace-47.1 {ensemble: unknown handler} { lappend result [catch {ns c d e} msg] $msg lappend result [catch {ns Magic foo bar spong wibble} msg] $msg list $result [lsort [info commands ::ns::*]] $log [namespace delete ns] -} {{0 2 0 2 0 2 0 2 1 {unknown or protected subcommand "Magic"}} {::ns::Magic ::ns::a ::ns::b ::ns::c} {{making a} {running a b c} {running a b c} {making b} {running b c d} {making c} {running c d e} {unknown Magic - args = foo bar spong wibble}} {}} +} {{0 2 0 2 0 2 0 2 1 {unknown or protected subcommand "Magic"}} {::ns::Magic ::ns::a ::ns::b ::ns::c} {{making a} {running ::ns::a b c} {running ::ns::a b c} {making b} {running ::ns::b c d} {making c} {running ::ns::c d e} {unknown Magic - args = foo bar spong wibble}} {}} test namespace-47.2 {ensemble: unknown handler} { namespace eval ns { namespace export {[a-z]*} @@ -3227,7 +3227,7 @@ test namespace-53.10 {ensembles: nested rewrite} -setup { 1 {wrong # args: should be "ns z1 x a1"}\ 1 {wrong # args: should be "ns z2 x a1 a2"}\ 1 {wrong # args: should be "ns z2 x a1 a2"}\ - 1 {wrong # args: should be "z0"}\ + 1 {wrong # args: should be "::ns::x::z0"}\ 0 {1 v}\ 1 {wrong # args: should be "ns v x z2 a2"}\ 0 {2 v v2}} @@ -3312,7 +3312,7 @@ test namespace-56.3 {bug f97d4ee020: mutually-entangled deletion} { } } {::testing::abc::def ::testing::abc::ghi} -test namespace-56.4 {bug 16fe1b5807: names starting with ":"} { +test namespace-56.4 {bug 16fe1b5807: names starting with ":"} knownBug { namespace eval : { namespace ensemble create namespace export * -- cgit v0.12 From 2f8cb2ab854a2e311b49c8276bb59a76adaeafeb Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 20 Jun 2019 19:40:30 +0000 Subject: [6bdadfba7d] Stop crash with multi-lappend and failing writes --- generic/tclExecute.c | 21 +++++++++++++-------- tests/execute.test | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 8 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index bf2d7bc..413c753 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -3716,31 +3716,36 @@ TEBCresume( { int createdNewObj = 0; + Tcl_Obj *valueToAssign; if (!objResultPtr) { - objResultPtr = valuePtr; + valueToAssign = valuePtr; } else if (TclListObjLength(interp, objResultPtr, &len)!=TCL_OK) { TRACE_ERROR(interp); goto gotError; } else { if (Tcl_IsShared(objResultPtr)) { - objResultPtr = Tcl_DuplicateObj(objResultPtr); + valueToAssign = Tcl_DuplicateObj(objResultPtr); createdNewObj = 1; + } else { + valueToAssign = objResultPtr; } - if (Tcl_ListObjReplace(interp, objResultPtr, len,0, objc,objv) - != TCL_OK) { + if (Tcl_ListObjReplace(interp, valueToAssign, len, 0, + objc, objv) != TCL_OK) { + if (createdNewObj) { + TclDecrRefCount(valueToAssign); + } goto errorInLappendListPtr; } } DECACHE_STACK_INFO(); + Tcl_IncrRefCount(valueToAssign); objResultPtr = TclPtrSetVarIdx(interp, varPtr, arrayPtr, part1Ptr, - part2Ptr, objResultPtr, TCL_LEAVE_ERR_MSG, opnd); + part2Ptr, valueToAssign, TCL_LEAVE_ERR_MSG, opnd); + TclDecrRefCount(valueToAssign); CACHE_STACK_INFO(); if (!objResultPtr) { errorInLappendListPtr: - if (createdNewObj) { - TclDecrRefCount(objResultPtr); - } TRACE_ERROR(interp); goto gotError; } diff --git a/tests/execute.test b/tests/execute.test index e1ed68b..e9668a9 100644 --- a/tests/execute.test +++ b/tests/execute.test @@ -1066,6 +1066,45 @@ test execute-11.3 {Bug a0ece9d6d4} -setup { trace remove execution crash enterstep {apply {args {info frame -2}}} rename crash {} } -result 1 + +test execute-12.1 {failing multi-lappend to unshared} -setup { + unset -nocomplain x y +} -body { + set x 1 + lappend x 2 3 + trace add variable x write {apply {args {error boo}}} + lappend x 4 5 +} -cleanup { + unset -nocomplain x y +} -returnCodes error -result {can't set "x": boo} +test execute-12.2 {failing multi-lappend to shared} -setup { + unset -nocomplain x y +} -body { + set x 1 + lappend x 2 3 + set y $x + trace add variable x write {apply {args {error boo}}} + lappend x 4 5 +} -cleanup { + unset -nocomplain x y +} -returnCodes error -result {can't set "x": boo} +test execute-12.3 {failing multi-lappend to unshared: LVT} -body { + apply {{} { + set x 1 + lappend x 2 3 + trace add variable x write {apply {args {error boo}}} + lappend x 4 5 + }} +} -returnCodes error -result {can't set "x": boo} +test execute-12.4 {failing multi-lappend to shared: LVT} -body { + apply {{} { + set x 1 + lappend x 2 3 + set y $x + trace add variable x write {apply {args {error boo}}} + lappend x 4 5 + }} +} -returnCodes error -result {can't set "x": boo} # cleanup if {[info commands testobj] != {}} { -- cgit v0.12 From 8ab0ae062eb80ca8ab58df2ad8b08c8fe5503959 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 21 Jun 2019 19:22:07 +0000 Subject: closes [f8a33ce3db5d8cc2]: Tcl_Exit uses system exit as fallback if Tcl-subsystems are not (yet) initialized (or initialization fails). --- generic/tclEvent.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index b0b8188..b0bfc15 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -944,16 +944,20 @@ Tcl_Exit( currentAppExitPtr = appExitPtr; Tcl_MutexUnlock(&exitMutex); + /* + * Warning: this function SHOULD NOT return, as there is code that depends + * on Tcl_Exit never returning. In fact, we will Tcl_Panic if anyone + * returns, so critical is this dependcy. + * + * If subsystems are not (yet) initialized, proper Tcl-finalization is + * impossible, so fallback to system exit, see bug-[f8a33ce3db5d8cc2]. + */ + if (currentAppExitPtr) { - /* - * Warning: this code SHOULD NOT return, as there is code that depends - * on Tcl_Exit never returning. In fact, we will Tcl_Panic if anyone - * returns, so critical is this dependcy. - */ currentAppExitPtr(INT2PTR(status)); - Tcl_Panic("AppExitProc returned unexpectedly"); - } else { + + } else if (subsystemsInitialized) { if (TclFullFinalizationRequested()) { @@ -986,9 +990,10 @@ Tcl_Exit( FinalizeThread(/* quick */ 1); } - TclpExit(status); - Tcl_Panic("OS exit failed!"); } + + TclpExit(status); + Tcl_Panic("OS exit failed!"); } /* -- cgit v0.12 From 3fe9b57f64ff305397c29748632bcfa5b74a4515 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 24 Jun 2019 07:26:25 +0000 Subject: Fix test title, since TclGetIntForIndex() is now exported as Tcl_GetIntForIndex() --- tests/util.test | 160 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/tests/util.test b/tests/util.test index a9199f4..053eb0c 100644 --- a/tests/util.test +++ b/tests/util.test @@ -532,247 +532,247 @@ test util-8.6 {TclNeedSpace - correct UTF8 handling} testdstring { list [llength [testdstring get]] [string length [testdstring get]] } {2 9} -test util-9.0.0 {TclGetIntForIndex} { +test util-9.0.0 {Tcl_GetIntForIndex} { string index abcd 0 } a -test util-9.0.1 {TclGetIntForIndex} { +test util-9.0.1 {Tcl_GetIntForIndex} { string index abcd 0x0 } a -test util-9.0.2 {TclGetIntForIndex} { +test util-9.0.2 {Tcl_GetIntForIndex} { string index abcd -0x0 } a -test util-9.0.3 {TclGetIntForIndex} { +test util-9.0.3 {Tcl_GetIntForIndex} { string index abcd { 0 } } a -test util-9.0.4 {TclGetIntForIndex} { +test util-9.0.4 {Tcl_GetIntForIndex} { string index abcd { 0x0 } } a -test util-9.0.5 {TclGetIntForIndex} { +test util-9.0.5 {Tcl_GetIntForIndex} { string index abcd { -0x0 } } a -test util-9.0.6 {TclGetIntForIndex} { +test util-9.0.6 {Tcl_GetIntForIndex} { string index abcd 01 } b -test util-9.0.7 {TclGetIntForIndex} { +test util-9.0.7 {Tcl_GetIntForIndex} { string index abcd { 01 } } b -test util-9.0.8 {TclGetIntForIndex} { +test util-9.0.8 {Tcl_GetIntForIndex} { string index abcd { 0d0 } } a -test util-9.0.9 {TclGetIntForIndex} { +test util-9.0.9 {Tcl_GetIntForIndex} { string index abcd { -0d0 } } a -test util-9.1.0 {TclGetIntForIndex} { +test util-9.1.0 {Tcl_GetIntForIndex} { string index abcd 3 } d -test util-9.1.1 {TclGetIntForIndex} { +test util-9.1.1 {Tcl_GetIntForIndex} { string index abcd { 3 } } d -test util-9.1.2 {TclGetIntForIndex} { +test util-9.1.2 {Tcl_GetIntForIndex} { string index abcdefghijk 0xa } k -test util-9.1.3 {TclGetIntForIndex} { +test util-9.1.3 {Tcl_GetIntForIndex} { string index abcdefghijk { 0xa } } k -test util-9.1.4 {TclGetIntForIndex} { +test util-9.1.4 {Tcl_GetIntForIndex} { string index abcdefghijk 0d10 } k -test util-9.1.5 {TclGetIntForIndex} { +test util-9.1.5 {Tcl_GetIntForIndex} { string index abcdefghijk { 0d10 } } k -test util-9.2.0 {TclGetIntForIndex} { +test util-9.2.0 {Tcl_GetIntForIndex} { string index abcd end } d -test util-9.2.1 {TclGetIntForIndex} -body { +test util-9.2.1 {Tcl_GetIntForIndex} -body { string index abcd { end} } -returnCodes error -match glob -result * -test util-9.2.2 {TclGetIntForIndex} -body { +test util-9.2.2 {Tcl_GetIntForIndex} -body { string index abcd {end } } -returnCodes error -match glob -result * -test util-9.3 {TclGetIntForIndex} -body { +test util-9.3 {Tcl_GetIntForIndex} -body { # Deprecated string index abcd en } -returnCodes error -match glob -result * -test util-9.4 {TclGetIntForIndex} -body { +test util-9.4 {Tcl_GetIntForIndex} -body { # Deprecated string index abcd e } -returnCodes error -match glob -result * -test util-9.5.0 {TclGetIntForIndex} { +test util-9.5.0 {Tcl_GetIntForIndex} { string index abcd end-1 } c -test util-9.5.1 {TclGetIntForIndex} { +test util-9.5.1 {Tcl_GetIntForIndex} { string index abcd {end-1 } } c -test util-9.5.2 {TclGetIntForIndex} -body { +test util-9.5.2 {Tcl_GetIntForIndex} -body { string index abcd { end-1} } -returnCodes error -match glob -result * -test util-9.6 {TclGetIntForIndex} { +test util-9.6 {Tcl_GetIntForIndex} { string index abcd end+-1 } c -test util-9.7 {TclGetIntForIndex} { +test util-9.7 {Tcl_GetIntForIndex} { string index abcd end+1 } {} -test util-9.8 {TclGetIntForIndex} { +test util-9.8 {Tcl_GetIntForIndex} { string index abcd end--1 } {} -test util-9.9.0 {TclGetIntForIndex} { +test util-9.9.0 {Tcl_GetIntForIndex} { string index abcd 0+0 } a -test util-9.9.1 {TclGetIntForIndex} { +test util-9.9.1 {Tcl_GetIntForIndex} { string index abcd { 0+0 } } a -test util-9.10 {TclGetIntForIndex} { +test util-9.10 {Tcl_GetIntForIndex} { string index abcd 0-0 } a -test util-9.11 {TclGetIntForIndex} { +test util-9.11 {Tcl_GetIntForIndex} { string index abcd 1+0 } b -test util-9.12 {TclGetIntForIndex} { +test util-9.12 {Tcl_GetIntForIndex} { string index abcd 1-0 } b -test util-9.13 {TclGetIntForIndex} { +test util-9.13 {Tcl_GetIntForIndex} { string index abcd 1+1 } c -test util-9.14 {TclGetIntForIndex} { +test util-9.14 {Tcl_GetIntForIndex} { string index abcd 1-1 } a -test util-9.15 {TclGetIntForIndex} { +test util-9.15 {Tcl_GetIntForIndex} { string index abcd -1+2 } b -test util-9.16 {TclGetIntForIndex} { +test util-9.16 {Tcl_GetIntForIndex} { string index abcd -1--2 } b -test util-9.17 {TclGetIntForIndex} { +test util-9.17 {Tcl_GetIntForIndex} { string index abcd { -1+2 } } b -test util-9.18 {TclGetIntForIndex} { +test util-9.18 {Tcl_GetIntForIndex} { string index abcd { -1--2 } } b -test util-9.19 {TclGetIntForIndex} -body { +test util-9.19 {Tcl_GetIntForIndex} -body { string index a {} } -returnCodes error -match glob -result * -test util-9.20 {TclGetIntForIndex} -body { +test util-9.20 {Tcl_GetIntForIndex} -body { string index a { } } -returnCodes error -match glob -result * -test util-9.21 {TclGetIntForIndex} -body { +test util-9.21 {Tcl_GetIntForIndex} -body { string index a " \r\t\n" } -returnCodes error -match glob -result * -test util-9.22 {TclGetIntForIndex} -body { +test util-9.22 {Tcl_GetIntForIndex} -body { string index a + } -returnCodes error -match glob -result * -test util-9.23 {TclGetIntForIndex} -body { +test util-9.23 {Tcl_GetIntForIndex} -body { string index a - } -returnCodes error -match glob -result * -test util-9.24 {TclGetIntForIndex} -body { +test util-9.24 {Tcl_GetIntForIndex} -body { string index a x } -returnCodes error -match glob -result * -test util-9.25 {TclGetIntForIndex} -body { +test util-9.25 {Tcl_GetIntForIndex} -body { string index a +x } -returnCodes error -match glob -result * -test util-9.26 {TclGetIntForIndex} -body { +test util-9.26 {Tcl_GetIntForIndex} -body { string index a -x } -returnCodes error -match glob -result * -test util-9.27 {TclGetIntForIndex} -body { +test util-9.27 {Tcl_GetIntForIndex} -body { string index a 0y } -returnCodes error -match glob -result * -test util-9.28 {TclGetIntForIndex} -body { +test util-9.28 {Tcl_GetIntForIndex} -body { string index a 1* } -returnCodes error -match glob -result * -test util-9.29 {TclGetIntForIndex} -body { +test util-9.29 {Tcl_GetIntForIndex} -body { string index a 0+ } -returnCodes error -match glob -result * -test util-9.30 {TclGetIntForIndex} -body { +test util-9.30 {Tcl_GetIntForIndex} -body { string index a {0+ } } -returnCodes error -match glob -result * -test util-9.31 {TclGetIntForIndex} -body { +test util-9.31 {Tcl_GetIntForIndex} -body { string index a 0x } -returnCodes error -match glob -result * -test util-9.31.1 {TclGetIntForIndex} -body { +test util-9.31.1 {Tcl_GetIntForIndex} -body { string index a 0d } -returnCodes error -match glob -result * -test util-9.32 {TclGetIntForIndex} -body { +test util-9.32 {Tcl_GetIntForIndex} -body { string index a 0x1FFFFFFFF+0 } -result {} -test util-9.33 {TclGetIntForIndex} -body { +test util-9.33 {Tcl_GetIntForIndex} -body { string index a 100000000000+0 } -result {} -test util-9.33.1 {TclGetIntForIndex} -body { +test util-9.33.1 {Tcl_GetIntForIndex} -body { string index a 0d100000000000+0 } -result {} -test util-9.34 {TclGetIntForIndex} -body { +test util-9.34 {Tcl_GetIntForIndex} -body { string index a 1.0 } -returnCodes error -match glob -result * -test util-9.35 {TclGetIntForIndex} -body { +test util-9.35 {Tcl_GetIntForIndex} -body { string index a 1e23 } -returnCodes error -match glob -result * -test util-9.36 {TclGetIntForIndex} -body { +test util-9.36 {Tcl_GetIntForIndex} -body { string index a 1.5e2 } -returnCodes error -match glob -result * -test util-9.37 {TclGetIntForIndex} -body { +test util-9.37 {Tcl_GetIntForIndex} -body { string index a 0+x } -returnCodes error -match glob -result * -test util-9.38 {TclGetIntForIndex} -body { +test util-9.38 {Tcl_GetIntForIndex} -body { string index a 0+0x } -returnCodes error -match glob -result * -test util-9.39 {TclGetIntForIndex} -body { +test util-9.39 {Tcl_GetIntForIndex} -body { string index a 0+0xg } -returnCodes error -match glob -result * -test util-9.40 {TclGetIntForIndex} -body { +test util-9.40 {Tcl_GetIntForIndex} -body { string index a 0+0xg } -returnCodes error -match glob -result * -test util-9.41 {TclGetIntForIndex} -body { +test util-9.41 {Tcl_GetIntForIndex} -body { string index a 0+1.0 } -returnCodes error -match glob -result * -test util-9.42 {TclGetIntForIndex} -body { +test util-9.42 {Tcl_GetIntForIndex} -body { string index a 0+1e2 } -returnCodes error -match glob -result * -test util-9.43 {TclGetIntForIndex} -body { +test util-9.43 {Tcl_GetIntForIndex} -body { string index a 0+1.5e1 } -returnCodes error -match glob -result * -test util-9.44 {TclGetIntForIndex} -body { +test util-9.44 {Tcl_GetIntForIndex} -body { string index a 0+1000000000000 } -result {} -test util-9.45 {TclGetIntForIndex} { +test util-9.45 {Tcl_GetIntForIndex} { string index abcd end+2305843009213693950 } {} -test util-9.46 {TclGetIntForIndex} { +test util-9.46 {Tcl_GetIntForIndex} { string index abcd end+4294967294 } {} # TIP 502 -test util-9.47 {TclGetIntForIndex} { +test util-9.47 {Tcl_GetIntForIndex} { string index abcd 0x10000000000000000 } {} -test util-9.48 {TclGetIntForIndex} { +test util-9.48 {Tcl_GetIntForIndex} { string index abcd -0x10000000000000000 } {} -test util-9.49 {TclGetIntForIndex} -body { +test util-9.49 {Tcl_GetIntForIndex} -body { string index abcd end*1 } -returnCodes error -match glob -result * -test util-9.50 {TclGetIntForIndex} -body { +test util-9.50 {Tcl_GetIntForIndex} -body { string index abcd {end- 1} } -returnCodes error -match glob -result * -test util-9.51 {TclGetIntForIndex} -body { +test util-9.51 {Tcl_GetIntForIndex} -body { string index abcd end-end } -returnCodes error -match glob -result * -test util-9.52 {TclGetIntForIndex} -body { +test util-9.52 {Tcl_GetIntForIndex} -body { string index abcd end-x } -returnCodes error -match glob -result * -test util-9.53 {TclGetIntForIndex} -body { +test util-9.53 {Tcl_GetIntForIndex} -body { string index abcd end-0.1 } -returnCodes error -match glob -result * -test util-9.54 {TclGetIntForIndex} { +test util-9.54 {Tcl_GetIntForIndex} { string index abcd end-0x10000000000000000 } {} -test util-9.55 {TclGetIntForIndex} { +test util-9.55 {Tcl_GetIntForIndex} { string index abcd end+0x10000000000000000 } {} -test util-9.56 {TclGetIntForIndex} { +test util-9.56 {Tcl_GetIntForIndex} { string index abcd end--0x10000000000000000 } {} -test util-9.57 {TclGetIntForIndex} { +test util-9.57 {Tcl_GetIntForIndex} { string index abcd end+-0x10000000000000000 } {} -test util-9.58 {TclGetIntForIndex} { +test util-9.58 {Tcl_GetIntForIndex} { string index abcd end--0x8000000000000000 } {} -- cgit v0.12 From 3c82f32973a705098c58504e8c9d999dc7fe0723 Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 24 Jun 2019 20:36:41 +0000 Subject: Better implementation of fpclassify() equivalent. --- generic/tclBasic.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 8 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index a23bfc1..4f64427 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -24,7 +24,11 @@ #include #include #ifndef fpclassify /* Older MSVC */ +#ifdef _M_IX86 +#define REQUIRE_ANCIENT_WIN32_FPCLASSIFY_HACK +#else /* !_M_IX86 */ #include +#endif /* _M_IX86 */ #endif /* !fpclassify */ #define INTERP_STACK_INITIAL_SIZE 2000 @@ -8329,10 +8333,13 @@ ExprSrandFunc( /* * Older MSVC is supported by Tcl, but doesn't have fpclassify(). Of course. - * But it does have _fpclass() which does almost the same job. + * But it does sometimes have _fpclass() which does almost the same job; if + * even that is absent, we grobble around directly in the platform's binary + * representation of double. * - * This makes it conform to the C99 standard API, and just delegates to the - * standard macro on platforms that do it correctly. + * This function makes all that conform to a common API (effectively the C99 + * standard API renamed), and just delegates to the standard macro on + * platforms that do it correctly. */ static inline int @@ -8342,12 +8349,69 @@ ClassifyDouble( #ifdef fpclassify return fpclassify(d); #else /* !fpclassify */ -#define FP_ZERO 0 -#define FP_NORMAL 1 -#define FP_SUBNORMAL 2 -#define FP_INFINITE 3 -#define FP_NAN 4 +#define FP_NAN 1 +#define FP_INFINITE 2 +#define FP_ZERO 3 +#define FP_NORMAL 4 +#define FP_SUBNORMAL 5 +#ifdef REQUIRE_ANCIENT_WIN32_FPCLASSIFY_HACK + /* + * We assume this hack is only needed on little-endian systems. + * Specifically, x86 running Windows. It's fairly easy to enable for + * others if they need it (because their libc/libm is broken) but we'll + * jump that hurdle when requred. We can solve the word ordering then. + */ + + union { + double d; + struct { + unsigned int low; + unsigned int high; + } w; + } doubleMeaning; + unsigned int exponent, mantissaLow, mantissaHigh; + int zeroMantissa; +#define EXPONENT_MASK 0x7ff; +#define EXPONENT_SHIFT 20 +#define MANTISSA_MASK 0xfffff + + /* + * Extract the exponent (11 bits) and mantissa (52 bits). Note that we + * totally ignore the sign bit. + */ + + doubleMeaning.d = d; + exponent = (doubleMeaning.w.high >> EXPONENT_SHIFT) & EXPONENT_MASK; + mantissaLow = doubleMeaning.w.low; + mantissaHigh = doubleMeaning.w.high & MANTISSA_MASK; + zeroMantissa = (mantissaHigh == 0 && mantissaLow == 0); + + /* + * Look for the special cases of exponent. + */ + + switch (exponent) { + case 0: + /* + * When the exponent is all zeros, it's a ZERO or a SUBNORMAL. + */ + + return zeroMantissa ? FP_ZERO : FP_SUBNORMAL; + case EXPONENT_MASK: + /* + * When the exponent is all ones, it's an INF or a NAN. + */ + + return zeroMantissa ? FP_INF : FP_NAN; + default: + /* + * Everything else is a NORMAL double precision float. + */ + + return FP_NORMAL; + } +#else /* !REQUIRE_ANCIENT_WIN32_FPCLASSIFY_HACK */ switch (_fpclass(d)) { case _FPCLASS_NZ: case _FPCLASS_PZ: @@ -8367,6 +8431,7 @@ ClassifyDouble( case _FPCLASS_SNAN: return FP_NAN; } +#endif /* REQUIRE_ANCIENT_WIN32_FPCLASSIFY_HACK */ #endif /* fpclassify */ } -- cgit v0.12 From 9489b8b506999d9ec543ed3e626cb32ea3a8394a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 25 Jun 2019 06:56:26 +0000 Subject: Squelch C4244 warning on any MSVC compiler. --- win/tclWinPort.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/win/tclWinPort.h b/win/tclWinPort.h index 29b1447..20b2fe0 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -480,10 +480,12 @@ typedef DWORD_PTR * PDWORD_PTR; * including the *printf family and others. Tell it to shut up. * (_MSC_VER is 1200 for VC6, 1300 or 1310 for vc7.net, 1400 for 8.0) */ -#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#if defined(_MSC_VER) # pragma warning(disable:4244) -# pragma warning(disable:4267) -# pragma warning(disable:4996) +# if _MSC_VER >= 1400 +# pragma warning(disable:4267) +# pragma warning(disable:4996) +# endif #endif /* -- cgit v0.12 From f310332a6ba0427e38582673f4d3fbe4b3d9eb5c Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 25 Jun 2019 07:36:28 +0000 Subject: use __builtin_fpclassify for mingw x86 (tested up to gcc 8.1, it seems to have a bug in fpclassify, so [fpclassify 1e-314], x86 => normal, x64 => subnormal) --- generic/tclBasic.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index a23bfc1..ea96108 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -8340,7 +8340,13 @@ ClassifyDouble( double d) { #ifdef fpclassify +/* MINGW x86 (tested up to gcc 8.1) seems to have a bug in fpclassify, + * [fpclassify 1e-314], x86 => normal, x64 => subnormal */ +# if defined(__MINGW32__) && defined(_X86_) + return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, d); +# else return fpclassify(d); +# endif #else /* !fpclassify */ #define FP_ZERO 0 #define FP_NORMAL 1 -- cgit v0.12 From 940b2183da62b66bebfd28cfed0a1dfb80b92a0d Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 25 Jun 2019 08:48:27 +0000 Subject: Where did that stray semicolon come from? Also improve the comments... --- generic/tclBasic.c | 53 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 4f64427..de39236 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -8329,17 +8329,15 @@ ExprSrandFunc( * None. * *---------------------------------------------------------------------- - */ - -/* + * * Older MSVC is supported by Tcl, but doesn't have fpclassify(). Of course. * But it does sometimes have _fpclass() which does almost the same job; if * even that is absent, we grobble around directly in the platform's binary * representation of double. * - * This function makes all that conform to a common API (effectively the C99 - * standard API renamed), and just delegates to the standard macro on - * platforms that do it correctly. + * The ClassifyDouble() function makes all that conform to a common API + * (effectively the C99 standard API renamed), and just delegates to the + * standard macro on platforms that do it correctly. */ static inline int @@ -8349,11 +8347,16 @@ ClassifyDouble( #ifdef fpclassify return fpclassify(d); #else /* !fpclassify */ -#define FP_NAN 1 -#define FP_INFINITE 2 -#define FP_ZERO 3 -#define FP_NORMAL 4 -#define FP_SUBNORMAL 5 + /* + * If we don't have fpclassify(), we also don't have the values it returns. + * Hence we define those here. + */ + +#define FP_NAN 1 /* Value is NaN */ +#define FP_INFINITE 2 /* Value is an infinity */ +#define FP_ZERO 3 /* Value is a zero */ +#define FP_NORMAL 4 /* Value is a normal float */ +#define FP_SUBNORMAL 5 /* Value has lost accuracy */ #ifdef REQUIRE_ANCIENT_WIN32_FPCLASSIFY_HACK /* @@ -8364,17 +8367,27 @@ ClassifyDouble( */ union { - double d; + double d; /* Interpret as double */ struct { - unsigned int low; - unsigned int high; - } w; - } doubleMeaning; + unsigned int low; /* Lower 32 bits */ + unsigned int high; /* Upper 32 bits */ + } w; /* Interpret as unsigned integer words */ + } doubleMeaning; /* So we can look at the representation of a + * double directly. Platform (i.e., processor) + * specific; this is for x86 (and most other + * little-endian processors, but those are + * untested). */ unsigned int exponent, mantissaLow, mantissaHigh; - int zeroMantissa; -#define EXPONENT_MASK 0x7ff; -#define EXPONENT_SHIFT 20 -#define MANTISSA_MASK 0xfffff + /* The pieces extracted from the double. */ + int zeroMantissa; /* Was the mantissa zero? That's special. */ + + /* + * Shifts and masks to use with the doubleMeaning variable above. + */ + +#define EXPONENT_MASK 0x7ff /* 11 bits (after shifting) */ +#define EXPONENT_SHIFT 20 /* Moves exponent to bottom of word */ +#define MANTISSA_MASK 0xfffff /* 20 bits (plus 32 from other word) */ /* * Extract the exponent (11 bits) and mantissa (52 bits). Note that we -- cgit v0.12 From 9fb98b2d11c075c66b5cb297bcd700cf26c81eac Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 25 Jun 2019 10:40:18 +0000 Subject: fixed several fpclassify modes (better recognition and control via TCL_FPCLASSIFY_MODE), typos fixed (FP_INF -> FP_INFINITE), no redefine warnings if FP_* already specified, etc --- generic/tclBasic.c | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index de39236..41df33c 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -23,13 +23,20 @@ #include "tommath.h" #include #include -#ifndef fpclassify /* Older MSVC */ -#ifdef _M_IX86 -#define REQUIRE_ANCIENT_WIN32_FPCLASSIFY_HACK -#else /* !_M_IX86 */ -#include -#endif /* _M_IX86 */ -#endif /* !fpclassify */ + +#ifndef TCL_FPCLASSIFY_MODE +# if ( defined(__MINGW32__) && defined(_X86_) ) /* mingw 32-bit */ +# define TCL_FPCLASSIFY_MODE 1 +# elif defined(fpclassify) /* fpclassify */ +# include +# define TCL_FPCLASSIFY_MODE 0 +# elif defined(_FPCLASS_NN) /* _fpclass */ +# define TCL_FPCLASSIFY_MODE 1 +# else /* !fpclassify && !_fpclass (older MSVC), simulate */ +# define TCL_FPCLASSIFY_MODE 2 +# endif /* !fpclassify */ +#endif /* !TCL_FPCLASSIFY_MODE */ + #define INTERP_STACK_INITIAL_SIZE 2000 #define CORO_STACK_INITIAL_SIZE 200 @@ -8344,21 +8351,22 @@ static inline int ClassifyDouble( double d) { -#ifdef fpclassify +#if TCL_FPCLASSIFY_MODE == 0 return fpclassify(d); #else /* !fpclassify */ /* * If we don't have fpclassify(), we also don't have the values it returns. * Hence we define those here. */ +# ifndef FP_NAN +# define FP_NAN 1 /* Value is NaN */ +# define FP_INFINITE 2 /* Value is an infinity */ +# define FP_ZERO 3 /* Value is a zero */ +# define FP_NORMAL 4 /* Value is a normal float */ +# define FP_SUBNORMAL 5 /* Value has lost accuracy */ +#endif -#define FP_NAN 1 /* Value is NaN */ -#define FP_INFINITE 2 /* Value is an infinity */ -#define FP_ZERO 3 /* Value is a zero */ -#define FP_NORMAL 4 /* Value is a normal float */ -#define FP_SUBNORMAL 5 /* Value has lost accuracy */ - -#ifdef REQUIRE_ANCIENT_WIN32_FPCLASSIFY_HACK +# if TCL_FPCLASSIFY_MODE == 2 /* * We assume this hack is only needed on little-endian systems. * Specifically, x86 running Windows. It's fairly easy to enable for @@ -8385,9 +8393,9 @@ ClassifyDouble( * Shifts and masks to use with the doubleMeaning variable above. */ -#define EXPONENT_MASK 0x7ff /* 11 bits (after shifting) */ -#define EXPONENT_SHIFT 20 /* Moves exponent to bottom of word */ -#define MANTISSA_MASK 0xfffff /* 20 bits (plus 32 from other word) */ +# define EXPONENT_MASK 0x7ff /* 11 bits (after shifting) */ +# define EXPONENT_SHIFT 20 /* Moves exponent to bottom of word */ +# define MANTISSA_MASK 0xfffff /* 20 bits (plus 32 from other word) */ /* * Extract the exponent (11 bits) and mantissa (52 bits). Note that we @@ -8416,7 +8424,7 @@ ClassifyDouble( * When the exponent is all ones, it's an INF or a NAN. */ - return zeroMantissa ? FP_INF : FP_NAN; + return zeroMantissa ? FP_INFINITE : FP_NAN; default: /* * Everything else is a NORMAL double precision float. @@ -8424,7 +8432,7 @@ ClassifyDouble( return FP_NORMAL; } -#else /* !REQUIRE_ANCIENT_WIN32_FPCLASSIFY_HACK */ +# elif TCL_FPCLASSIFY_MODE == 1 switch (_fpclass(d)) { case _FPCLASS_NZ: case _FPCLASS_PZ: @@ -8444,7 +8452,7 @@ ClassifyDouble( case _FPCLASS_SNAN: return FP_NAN; } -#endif /* REQUIRE_ANCIENT_WIN32_FPCLASSIFY_HACK */ +# endif /* REQUIRE_ANCIENT_WIN32_FPCLASSIFY_HACK */ #endif /* fpclassify */ } -- cgit v0.12 From da06343b0b1801e88d0f0ebaa60d1559d75e063b Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 25 Jun 2019 11:01:27 +0000 Subject: amend (remove test define) --- generic/tclBasic.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index b67648c..2c26202 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -32,9 +32,6 @@ * 3 - __builtin_fpclassify */ -#define TCL_FPCLASSIFY_MODE 3 -#warning mode: TCL_FPCLASSIFY_MODE - #ifndef TCL_FPCLASSIFY_MODE /* * MINGW x86 (tested up to gcc 8.1) seems to have a bug in fpclassify, -- cgit v0.12 From d1b95c26242ba247ebd5656c430b01943b24a728 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 25 Jun 2019 15:50:31 +0000 Subject: Change int constants into char constants. Hopefully this eliminates C4305 warnings on MSVC 6.0 --- generic/tclZipfs.c | 7 +++---- win/tclWinPanic.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 3d1941c..6a568fe 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -283,10 +283,9 @@ static struct { * For password rotation. */ -static const char pwrot[16] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0 -}; +static const char pwrot[16] = + "\x00\x80\x40\xC0\x20\xA0\x60\xE0" + "\x10\x90\x50\xD0\x30\xB0\x70\xF0"; /* * Table to compute CRC32. diff --git a/win/tclWinPanic.c b/win/tclWinPanic.c index a71f506..5c6e02d 100644 --- a/win/tclWinPanic.c +++ b/win/tclWinPanic.c @@ -58,7 +58,7 @@ Tcl_ConsolePanic( } else if (_isatty(2)) { WriteConsoleW(handle, msgString, wcslen(msgString), &dummy, 0); } else { - buf[0] = 0xEF; buf[1] = 0xBB; buf[2] = 0xBF; /* UTF-8 bom */ + buf[0] = '\xEF'; buf[1] = '\xBB'; buf[2] = '\xBF'; /* UTF-8 bom */ WriteFile(handle, buf, strlen(buf), &dummy, 0); WriteFile(handle, "\n", 1, &dummy, 0); FlushFileBuffers(handle); -- cgit v0.12 From be26adf83b00a077251c7242792c50c23fa0baa7 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 25 Jun 2019 16:09:33 +0000 Subject: fixed build with MSVC 6.0 --- generic/tclCmdMZ.c | 14 +++++++------- generic/tclExecute.c | 9 +++------ generic/tclInt.h | 7 +++++++ win/tclWinFile.c | 1 - 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index bc03d73..d36b0f0 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -3986,14 +3986,14 @@ Tcl_TimeRateObjCmd( register Tcl_Obj *objPtr; register int result, i; Tcl_Obj *calibrate = NULL, *direct = NULL; - Tcl_WideUInt count = 0; /* Holds repetition count */ + TclWideMUInt count = 0; /* Holds repetition count */ Tcl_WideInt maxms = WIDE_MIN; /* Maximal running time (in milliseconds) */ - Tcl_WideUInt maxcnt = WIDE_MAX; + TclWideMUInt maxcnt = WIDE_MAX; /* Maximal count of iterations. */ - Tcl_WideUInt threshold = 1; /* Current threshold for check time (faster + TclWideMUInt threshold = 1; /* Current threshold for check time (faster * repeat count without time check) */ - Tcl_WideUInt maxIterTm = 1; /* Max time of some iteration as max + TclWideMUInt maxIterTm = 1; /* Max time of some iteration as max * threshold, additionally avoiding divide to * zero (i.e., never < 1) */ unsigned short factor = 50; /* Factor (4..50) limiting threshold to avoid @@ -4363,13 +4363,13 @@ Tcl_TimeRateObjCmd( { Tcl_Obj *objarr[8], **objs = objarr; - Tcl_WideUInt usec, val; + TclWideMUInt usec, val; int digits; /* * Absolute execution time in microseconds or in wide clicks. */ - usec = (Tcl_WideUInt)(middle - start); + usec = (TclWideMUInt)(middle - start); #ifdef TCL_WIDE_CLICKS /* @@ -4398,7 +4398,7 @@ Tcl_TimeRateObjCmd( * Estimate the time of overhead (microsecs). */ - Tcl_WideUInt curOverhead = overhead * count; + TclWideMUInt curOverhead = overhead * count; if (usec > curOverhead) { usec -= curOverhead; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 265b82f..0c2baab 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -4938,7 +4938,7 @@ TclExecuteByteCode( } #endif { - mp_int big2; + mp_int big1, big2; Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2); @@ -4956,8 +4956,6 @@ TclExecuteByteCode( * Arguments are opposite sign; remainder is sum. */ - mp_int big1; - TclBNInitBignumFromLong(&big1, l1); mp_add(&big2, &big1, &big2); mp_clear(&big1); @@ -4994,7 +4992,8 @@ TclExecuteByteCode( NEXT_INST_F(1, 2, 1); } { - mp_int big2; + mp_int big1, big2; + Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2); /* TODO: internals intrusion */ @@ -5011,8 +5010,6 @@ TclExecuteByteCode( * Arguments are opposite sign; remainder is sum. */ - mp_int big1; - TclBNInitBignumFromWideInt(&big1, w1); mp_add(&big2, &big1, &big2); mp_clear(&big1); diff --git a/generic/tclInt.h b/generic/tclInt.h index 8b4ccc5..974dd0d 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2773,6 +2773,13 @@ MODULE_SCOPE void TclInitThreadStorage(void); MODULE_SCOPE void TclpFinalizeThreadDataThread(void); MODULE_SCOPE void TclFinalizeThreadStorage(void); +/* TclWideMUInt -- wide integer used for measurement calculations: */ +#if (!defined(_WIN32) || !defined(_MSC_VER) || (_MSC_VER >= 1400)) +# define TclWideMUInt Tcl_WideUInt +#else +/* older MSVS may not allow conversions between unsigned __int64 and double) */ +# define TclWideMUInt Tcl_WideInt +#endif #ifdef TCL_WIDE_CLICKS MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks); diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 8ee4bce..d582664 100755 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -17,7 +17,6 @@ #include #include #include /* For TclpGetUserHome(). */ -#include /* For TclpGetUserHome(). */ /* * The number of 100-ns intervals between the Windows system epoch (1601-01-01 -- cgit v0.12 From 334b8029eddb4e6df592c5f540ade0fd957a72c1 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 25 Jun 2019 17:45:23 +0000 Subject: nmakehlp: fixed const qualifier --- win/nmakehlp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 0439d1c..6532f8a 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -74,7 +74,7 @@ main( char msg[300]; DWORD dwWritten; int chars; - char *s; + const char *s; /* * Make sure children (cl.exe and link.exe) are kept quiet. -- cgit v0.12 From 9392d9001aff32b293b587f531e08a54f534b2c2 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 25 Jun 2019 18:59:09 +0000 Subject: restore userenv, used in 8.6 --- win/tclWinFile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 49f85cb..2f35d4a 100755 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -17,6 +17,7 @@ #include #include #include /* For TclpGetUserHome(). */ +#include /* For TclpGetUserHome(). */ #include /* For GetNamedSecurityInfo */ #ifdef _MSC_VER -- cgit v0.12 From 5ef1c629dfce15837e4cb375f572a85c36a27773 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 25 Jun 2019 22:27:43 +0000 Subject: Makef tclTomMath.h work with VC++ 6.0 --- generic/tclTomMath.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index bbcb4bc..9da642e 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -84,7 +84,11 @@ typedef unsigned int mp_digit; #define MP_DIGIT_DECLARED #endif #ifndef MP_WORD_DECLARED +#ifdef _WIN32 +typedef unsigned __int64 mp_word; +#else typedef unsigned long long mp_word; +#endif #define MP_WORD_DECLARED #endif -- cgit v0.12 From 595cb8637968efc657003e13c57b37354f1f66d6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Jun 2019 08:21:19 +0000 Subject: Remove EXECUTE flag for tclWinFile.c. More eol-spacing cleanup (keeping tests-pref/* among other the same in multiple branches) --- README.md | 2 +- library/http1.0/http.tcl | 6 +++--- library/opt/optparse.tcl | 18 +++++++++--------- macosx/configure.ac | 2 +- tests-perf/clock.perf.tcl | 14 +++++++------- tests-perf/test-performance.tcl | 10 +++++----- tests-perf/timer-event.perf.tcl | 16 ++++++++-------- win/nmakehlp.c | 1 - win/tclWinFile.c | 0 9 files changed, 34 insertions(+), 35 deletions(-) mode change 100755 => 100644 win/tclWinFile.c diff --git a/README.md b/README.md index 3c4440e..efad379 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # README: Tcl This is the **Tcl 8.5.19** source distribution. - + You can get any source release of Tcl from [our distribution site](https://sourceforge.net/projects/tcl/files/Tcl/). diff --git a/library/http1.0/http.tcl b/library/http1.0/http.tcl index 8041ee4..8329de4 100644 --- a/library/http1.0/http.tcl +++ b/library/http1.0/http.tcl @@ -339,12 +339,12 @@ proc http_formatQuery {args} { # 2 Convert every other character to an array lookup # 3 Escape constructs that are "special" to the tcl parser # 4 "subst" the result, doing all the array substitutions - + proc httpMapReply {string} { global httpFormMap set alphanumeric a-zA-Z0-9 if {![info exists httpFormMap]} { - + for {set i 1} {$i <= 256} {incr i} { set c [format %c $i] if {![string match \[$alphanumeric\] $c]} { @@ -363,7 +363,7 @@ proc http_formatQuery {args} { return [subst $string] } -# Default proxy filter. +# Default proxy filter. proc httpProxyRequired {host} { global http if {[info exists http(-proxyhost)] && [string length $http(-proxyhost)]} { diff --git a/library/opt/optparse.tcl b/library/opt/optparse.tcl index c9438a0..8caaac4 100644 --- a/library/opt/optparse.tcl +++ b/library/opt/optparse.tcl @@ -33,7 +33,7 @@ namespace eval ::tcl { # Every OptProc give usage information on "procname -help". # Try "tcl::OptParseTest -help" and "tcl::OptParseTest -a" and # then other arguments. - # + # # example of 'valid' call: # ::tcl::OptParseTest save -4 -pr 23 -libsok SybTcl\ # -nostatics false ch1 @@ -84,8 +84,8 @@ namespace eval ::tcl { # # The general structure of a "program" is # notation (pseudo bnf like) -# name :== definition defines "name" as being "definition" -# { x y z } means list of x, y, and z +# name :== definition defines "name" as being "definition" +# { x y z } means list of x, y, and z # x* means x repeated 0 or more time # x+ means "x x*" # x? means optionally x @@ -110,7 +110,7 @@ namespace eval ::tcl { # # And for this application: # -# singleStep :== { instruction varname {hasBeenSet currentValue} type +# singleStep :== { instruction varname {hasBeenSet currentValue} type # typeArgs help } # instruction :== "flags" | "value" # type :== knowType | anyword @@ -343,7 +343,7 @@ proc ::tcl::OptProcArgGiven {argname} { proc OptState {item} { lindex $item 0 } - + # current state proc OptCurState {descriptions} { OptState [OptCurDesc $descriptions]; @@ -535,7 +535,7 @@ proc ::tcl::OptKeyParse {descKey arglist} { if {![Lempty $arglist]} { return -code error [OptTooManyArgs $desc $arglist]; } - + # Analyse the result # Walk through the tree: OptTreeVars $desc "#[expr {[info level]-1}]" ; @@ -781,7 +781,7 @@ proc ::tcl::OptCheckType {arg type {typeArgs ""}} { 3 { # varname type value # varname value comment - + if {[regexp {^-(.+)$} $arg1 x type]} { # flags/optValue as they are optional, need a "value", # on the contrary, for a variable (non optional), @@ -919,7 +919,7 @@ proc ::tcl::OptError {prefix desc {header 0}} { set desc [concat $h $desc] } OptLengths $desc nl tl dl - # actually output + # actually output return "$prefix[OptTree $desc $nl $tl $dl]" } @@ -952,7 +952,7 @@ proc ::tcl::Lget {list indexLst} { # it would be even slower... needs to be written in C !) # (nb: there is a non trivial recursive problem with indexes 0, # which appear because there is no difference between a list -# of 1 element and 1 element alone : [list "a"] == "a" while +# of 1 element and 1 element alone : [list "a"] == "a" while # it should be {a} and [listp a] should be 0 while [listp {a b}] would be 1 # and [listp "a b"] maybe 0. listp does not exist either...) proc ::tcl::Lvarset {listName indexLst newValue} { diff --git a/macosx/configure.ac b/macosx/configure.ac index 01c3697..f7a8bb3 100644 --- a/macosx/configure.ac +++ b/macosx/configure.ac @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tcl installation dnl to configure the system for the local environment. -dnl Ensure that the config (auto)headers support is used, then just +dnl Ensure that the config (auto)headers support is used, then just dnl include the configure sources from ../unix: m4_include(../unix/aclocal.m4) diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index d574c2c..f80746f 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -2,18 +2,18 @@ # ------------------------------------------------------------------------ # # test-performance.tcl -- -# +# # This file provides common performance tests for comparison of tcl-speed # degradation by switching between branches. # (currently for clock ensemble only) # # ------------------------------------------------------------------------ -# +# # Copyright (c) 2014 Serg G. Brester (aka sebres) -# +# # See the file "license.terms" for information on usage and redistribution # of this file. -# +# array set in {-time 500} if {[info exists ::argv0] && [file tail $::argv0] eq [file tail [info script]]} { @@ -215,7 +215,7 @@ proc test-freescan {{reptime 1000}} { {clock scan "next January" -base 0 -gmt 1} # FreeScan : relative week {clock scan "next Fri" -base 0 -gmt 1} - # FreeScan : relative weekday and week offset + # FreeScan : relative weekday and week offset {clock scan "next January + 2 week" -base 0 -gmt 1} # FreeScan : time only with base {clock scan "19:18:30" -base 148863600 -gmt 1} @@ -300,7 +300,7 @@ proc test-convert {{reptime 1000}} { {clock format [clock scan "19:18:30 EST" -base 148863600] -format "%H:%M:%S %z" -timezone EST} # Format locale 1x: comparison values - {clock format 0 -gmt 1 -locale en} + {clock format 0 -gmt 1 -locale en} {clock format 0 -gmt 1 -locale de} {clock format 0 -gmt 1 -locale fr} # Format locale 2x: without switching locale (en, en) @@ -340,7 +340,7 @@ proc test-convert {{reptime 1000}} { {clock scan "19:18:30 MST" -base 148863600; clock scan "19:18:30 EST" -base 148863600} # FreeScan TZ 2x (+1 gmt, +1 system-default) {clock scan "19:18:30 MST" -base 148863600 -gmt 1; clock scan "19:18:30 EST" -base 148863600} - + # Scan TZ: comparison included in scan string vs. given {clock scan "2009-06-30T18:30:00 CEST" -format "%Y-%m-%dT%H:%M:%S %z"} {clock scan "2009-06-30T18:30:00 CET" -format "%Y-%m-%dT%H:%M:%S %z"} diff --git a/tests-perf/test-performance.tcl b/tests-perf/test-performance.tcl index a05c380..78189e6 100644 --- a/tests-perf/test-performance.tcl +++ b/tests-perf/test-performance.tcl @@ -1,19 +1,19 @@ # ------------------------------------------------------------------------ # # test-performance.tcl -- -# +# # This file provides common performance tests for comparison of tcl-speed # degradation or regression by switching between branches. # # To execute test case evaluate direct corresponding file "tests-perf\*.perf.tcl". # # ------------------------------------------------------------------------ -# +# # Copyright (c) 2014 Serg G. Brester (aka sebres) -# +# # See the file "license.terms" for information on usage and redistribution # of this file. -# +# namespace eval ::tclTestPerf { # warm-up interpeter compiler env, calibrate timerate measurement functionality: @@ -33,7 +33,7 @@ if {[lindex [timerate {} 10] 6] >= (10-1)} { } proc {**STOP**} {args} { - return -code error -level 4 "**STOP** in [info level [expr {[info level]-2}]] [join $args { }]" + return -code error -level 4 "**STOP** in [info level [expr {[info level]-2}]] [join $args { }]" } proc _test_get_commands {lst} { diff --git a/tests-perf/timer-event.perf.tcl b/tests-perf/timer-event.perf.tcl index c5a7d45..f68a56a 100644 --- a/tests-perf/timer-event.perf.tcl +++ b/tests-perf/timer-event.perf.tcl @@ -3,17 +3,17 @@ # ------------------------------------------------------------------------ # # timer-event.perf.tcl -- -# +# # This file provides performance tests for comparison of tcl-speed # of timer events (event-driven tcl-handling). # # ------------------------------------------------------------------------ -# +# # Copyright (c) 2014 Serg G. Brester (aka sebres) -# +# # See the file "license.terms" for information on usage and redistribution # of this file. -# +# if {![namespace exists ::tclTestPerf]} { @@ -40,7 +40,7 @@ proc test-queue {{reptime {1000 10000}}} { {after idle {set foo bar}} # update / after idle: {update; if {![llength [after info]]} break} - + # generate up to $howmuch idle-events: {after idle {set foo bar}} # update idletasks / after idle: @@ -50,7 +50,7 @@ proc test-queue {{reptime {1000 10000}}} { {after 0 {set foo bar}} # update / after 0: {update; if {![llength [after info]]} break} - + # generate up to $howmuch 1-ms events: {after 1 {set foo bar}} setup {after 1} @@ -83,7 +83,7 @@ proc test-queue {{reptime {1000 10000}}} { setup {set le $i; incr i; list $le .. 1; # cancel up to $howmuch events} {after cancel $ev([incr i -1]); if {$i <= 1} break} cleanup {update; unset -nocomplain ev} - + # end $howmuch events. cleanup {if [llength [after info]] {error "unexpected: [llength [after info]] events are still there."}} }] @@ -149,7 +149,7 @@ proc test-long {{reptime 1000}} { {time {after idle {after 30}} 10; after 1 {set important 1}; vwait important;} cleanup {foreach i [after info] {after cancel $i}} # in-between important event (of new generation) by amount of idle events: - {time {after idle {after 30}} 10; after 1 {after 0 {set important 1}}; vwait important;} + {time {after idle {after 30}} 10; after 1 {after 0 {set important 1}}; vwait important;} cleanup {foreach i [after info] {after cancel $i}} } } diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 6532f8a..821d00b 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -39,7 +39,6 @@ #endif - /* protos */ static int CheckForCompilerFeature(const char *option); diff --git a/win/tclWinFile.c b/win/tclWinFile.c old mode 100755 new mode 100644 -- cgit v0.12 From c4459402a9117b184d3ad0d2640628db19327ae4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Jun 2019 08:27:51 +0000 Subject: UNEXEC win/tclWinFile.c --- win/tclWinFile.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 win/tclWinFile.c diff --git a/win/tclWinFile.c b/win/tclWinFile.c old mode 100755 new mode 100644 -- cgit v0.12