From 4744055aa075fc2557e4fe6148d10afa4ffc1451 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Fri, 8 Oct 2021 19:42:22 +0000 Subject: Fix for issue [a8579d906a28], "argument with no name". --- generic/tclProc.c | 2 +- tests/proc.test | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/generic/tclProc.c b/generic/tclProc.c index 769074b..642294c 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -497,7 +497,7 @@ TclCreateProc( "FORMALARGUMENTFORMAT", NULL); goto procError; } - if ((fieldCount == 0) || (fieldValues[0]->length == 0)) { + if ((fieldCount == 0) || (Tcl_GetCharLength(fieldValues[0]) == 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "argument with no name", -1)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", diff --git a/tests/proc.test b/tests/proc.test index 4b539c4..a6409c8 100644 --- a/tests/proc.test +++ b/tests/proc.test @@ -324,6 +324,15 @@ test proc-4.8 {TclCreateProc, procbody obj, no leak on multiple iterations} -set test proc-4.9 {[39fed4dae5] Valid Tcl_PkgPresent return} procbodytest { procbodytest::check } 1 +test proc-4.10 { + TclCreateProc, issue a8579d906a28, argument with no name +} -body { + catch { + proc p1 [list [list [expr {1 + 2}] default]] {} + } +} -cleanup { + catch {rename p1 {}} +} -result 0 test proc-5.1 {Bytecompiling noop; test for correct argument substitution} -body { proc p args {} ; # this will be bytecompiled into t -- cgit v0.12 From f43dd68346925f9c2ab0b55fe60e1cec2526d9dc Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 11 Oct 2021 13:54:06 +0000 Subject: Better solution, in stead of [https://core.tcl-lang.org/tk/info/6ffcea9b093deb5a|6ffcea9b]: Handle 64-bit (Cygwin64) Tcl_GetTime(), when loading tk86.dll --- generic/tcl.h | 3 +++ generic/tclDecls.h | 15 ++++++++++++++- tests/proc.test | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 2dc3ae2..827dc0a 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -1420,6 +1420,9 @@ typedef enum { typedef struct Tcl_Time { long sec; /* Seconds. */ long usec; /* Microseconds. */ +#if defined(_WIN32) && defined(_WIN64) + __int64 reserved; /* Not used, except for win64 <-> Cygwin64 interoperability. */ +#endif } Tcl_Time; typedef void (Tcl_SetTimerProc) (CONST86 Tcl_Time *timePtr); diff --git a/generic/tclDecls.h b/generic/tclDecls.h index f250634..26d1cd6 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3948,7 +3948,20 @@ extern const TclStubs *tclStubsPtr; #define Tcl_UpVar(interp, frameName, varName, localName, flags) \ Tcl_UpVar2(interp, frameName, varName, NULL, localName, flags) -#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) +#if defined(USE_TCL_STUBS) +# if defined(_WIN32) && defined(_WIN64) +# undef Tcl_GetTime +/* Handle Win64 tk.dll being loaded in Cygwin64. */ +# define Tcl_GetTime(t) \ + do { \ + Tcl_Time *_timePtr = (t); \ + _timePtr->reserved = -1; \ + tclStubsPtr->tcl_GetTime((_timePtr)); \ + if (_timePtr->reserved != -1) { \ + _timePtr->usec = _timePtr->reserved; \ + } \ + } while (0) +# endif # if defined(__CYGWIN__) && defined(TCL_WIDE_INT_IS_LONG) /* On Cygwin64, long is 64-bit while on Win64 long is 32-bit. Therefore * we have to make sure that all stub entries on Cygwin64 follow the diff --git a/tests/proc.test b/tests/proc.test index a6409c8..f453bea 100644 --- a/tests/proc.test +++ b/tests/proc.test @@ -332,7 +332,7 @@ test proc-4.10 { } } -cleanup { catch {rename p1 {}} -} -result 0 +} -result 0 test proc-5.1 {Bytecompiling noop; test for correct argument substitution} -body { proc p args {} ; # this will be bytecompiled into t -- cgit v0.12