On Fri, Mar 19, 2021 at 11:31 AM Steve Bennett <[email protected]> wrote:
>
> Sure,
>
> Probably six months until the next release.
Noted!
> coccinelle sounds like a good idea. I've never used it.
>
> You could also create a wrapper to report deprecated syntax, but it will only
> find
> those that are seen at run time.
>
> local proc expr {args} {
> if {[llength $args] > 1} {
> puts "Warning: Deprecated expr syntax at [join [lrange [info frame 1]
> 1 end] :]"
> upcall expr [concat {*}$args]
> } else {
> upcall expr [lindex $args 0]
> }
> }
The wrapper is a nice idea for scripts owned by users and not part of OpenOCD
Thanks
Antonio
>
> On 19 Mar 2021, at 7:47 pm, Antonio Borneo <[email protected]> wrote:
>
> Hi,
> in a very recent change
> https://github.com/msteveb/jimtcl/commit/1843b79a03dd
> jimtcl dropped the multiple arguments for the TCL command 'expr'.
> It means that the usual syntax
> set a [expr 1 + 1]
> now returns a syntax error, and it has to be re-written as
> set a [expr {1 + 1}]
> or
> set a [expr "1 + 1"]
>
> This change will be part of future jimtcl 0.81. Maybe Steve in copy
> can provide us with some tentative schedule.
> In OpenOCD we can delay merging this future jimtcl version, but some
> Linux distribution packages OpenOCD and jimtcl in independent
> packages; they will update to jimtcl 0.81 as soon as it gets
> available, breaking most of scripts in OpenOCD package. It will become
> a support nightmare.
> I would like to at least anticipate it, by patching existing scripts
> in master branch. When jimtcl 0.81 will be tagged we can decide to tag
> OpenOCD 0.11.1 or 0.12.0, or simply provide such a patch to the
> package managers.
>
> Today
> grep -rw expr tcl src/*/*.tcl
> returns 1729 matches! Too many to fix them manually without errors,
> mainly because of scripts that cannot be tested without the specific
> target. Also the patch review would be challenging.
>
> It exists the nice tool coccinelle
> https://coccinelle.gitlabpages.inria.fr/website/
> that is able to find matches and run transformations, widely used to
> create patches for the Linux kernel, but today it's C language
> specific, no specific support for TCL.
> Is there anyone familiar enough with coccinelle to give it a try on TCL?
> Any other idea?
>
> Some hint on already identified issues. These two cases cannot be
> fixed by simply adding {} around the arguments of 'expr'
> tcl/chip/atmel/at91/rtt.tcl:20: set f [expr $AT91C_SLOWOSC_FREQ.0 /
> $rtpres.0]
> src/jtag/startup.tcl:86: echo "Running at more than [expr
> $iterations.0 / ([ms]-$start_time)] kHz";
> because there is the concatenation of '.0' to get float
> representation. I'm not questioning the need for such representation,
> just showing that simply adding {} it's not enough and each of the
> 1729 matches has to be carefully analyzed.
> The first case above can be fixed using double quote, as
> tcl/chip/atmel/at91/rtt.tcl:20: set f [expr "$AT91C_SLOWOSC_FREQ.0
> / $rtpres.0"]
> but the second is already inside double quote; more effort is required.
>
> Regards,
> Antonio
>
>
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel