From f57b8bc01375d237c7fb911f82af35a26197e295 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 17 Apr 2008 19:47:33 +0000 Subject: style revisions to latest commit --- ChangeLog | 2 +- generic/tclCompExpr.c | 4 ++-- tests/compExpr.test | 8 ++++++-- tests/compile.test | 9 +-------- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index a55f42e..83050ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ 2008-04-17 Andreas Kupries * generic/tclCompExpr.c (CompileMathFuncCall): Added - * tests/compile.test (compile-16.0): Tcl_ResetResult before + * tests/compExpr.test (compExpr-5.10): Tcl_ResetResult before appending error message, to clear out possible sharing. Added test case demonstrating the crash (abort on shared object) without the fix. diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 8c66f5c..db70caf 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompExpr.c,v 1.13.2.4 2008/04/17 19:14:20 andreas_kupries Exp $ + * RCS: @(#) $Id: tclCompExpr.c,v 1.13.2.5 2008/04/17 19:47:34 dgp Exp $ */ #include "tclInt.h" @@ -852,7 +852,7 @@ CompileMathFuncCall(exprTokenPtr, funcName, infoPtr, envPtr, endPtrPtr) code = TCL_OK; hPtr = Tcl_FindHashEntry(&iPtr->mathFuncTable, funcName); if (hPtr == NULL) { - Tcl_ResetResult(interp); + Tcl_ResetResult(interp); Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "unknown math function \"", funcName, "\"", (char *) NULL); code = TCL_ERROR; diff --git a/tests/compExpr.test b/tests/compExpr.test index cd407d3..0174800 100644 --- a/tests/compExpr.test +++ b/tests/compExpr.test @@ -8,10 +8,10 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compExpr.test,v 1.6 2001/12/06 10:59:17 dkf Exp $ +# RCS: @(#) $Id: compExpr.test,v 1.6.4.1 2008/04/17 19:47:35 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest + package require tcltest 2 namespace import -force ::tcltest::* } @@ -317,6 +317,10 @@ test compExpr-5.8 {CompileMathFuncCall procedure, too many arguments} { test compExpr-5.9 {CompileMathFuncCall procedure, too many arguments} { list [catch {expr {0 <= rand(5.2)}} msg] $msg } {1 {too many arguments for math function}} +test compExpr-5.10 {error return from unbraced math func call of unknown function} -body { + expr {bogus()} +} -returnCodes error -result {unknown math function "bogus"} + test compExpr-6.1 {LogSyntaxError procedure, error in expr longer than 60 chars} { list [catch {expr {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1 foo 3} msg] $msg diff --git a/tests/compile.test b/tests/compile.test index f31e2b9..51dd3f6 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compile.test,v 1.24.2.4 2008/04/17 19:14:20 andreas_kupries Exp $ +# RCS: @(#) $Id: compile.test,v 1.24.2.5 2008/04/17 19:47:35 dgp Exp $ package require tcltest 2 namespace import -force ::tcltest::* @@ -432,13 +432,6 @@ test compile-15.5 {proper TCL_RETURN code from [return]} { set result } "" -test compile-16.0 {error return from unbraced math func call of unknown function} { - set l {3 4 5} - catch { expr bogus([join $l ,]) } msg - set msg -} {unknown math function "bogus"} - - # cleanup catch {rename p ""} catch {namespace delete test_ns_compile} -- cgit v0.12