[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/4] bench: pacify script (invalid uses of undefined variable
From: |
Akim Demaille |
Subject: |
Re: [PATCH 1/4] bench: pacify script (invalid uses of undefined variables) |
Date: |
Mon, 21 Jan 2013 14:24:07 +0100 |
Le 21 janv. 2013 à 13:38, Théophile Ranquet <address@hidden> a écrit :
> Wrong commit... my bad. Undefined variables occur when the script is
> used wrong, thusly:
>
> $ ./_build/etc/bench.pl -g list -i 42
> ...
> Use of uninitialized value $token[0] in string eq at
> ./_build/etc/bench.pl line 985.
> Use of uninitialized value $token[0] in string eq at
> ./_build/etc/bench.pl line 973.
> Use of uninitialized value in string eq at ./_build/etc/bench.pl line 951.
> Use of uninitialized value in concatenation (.) or string at
> ./_build/etc/bench.pl line 951.
> expected end of directives, unexpected: ()
Well, please introduce a check that rejects runs without
arguments (with a clear error message).
> What the actual commit (below) was meant to change was the way
> directives are passed to the program. IMHO, this is much better,
> especially when running complicated benches. Having to split the
> tokens in the program's stead when passing directives such as these is
> a real waste of time:
>
> $ ./_build/etc/bench.pl "( ( %s glr.cc | %s lalr1.cc ) & ( %b bison |
> %b ~/bison-latest/bin/bison | %b ~/bison-make-symbol-latest/bin/bison
> | %b ~/bison-make-symbol-6.9/bin/bison ) )" -g list -i 200
But it also means that if I insert a space in, say, a pair of ",
you will break it.
I'd be prefer that you leave the previous interface as it
was, but you may introduce a new option, say -e/--expression,
that does split the input. But then use something more robust.
Look for the descendant of shellwords.pl, there is certainly
something existing in Perl to do that less naively.
[PATCH 2/4] bench: compatibility for Bison <= 2.7, Theophile Ranquet, 2013/01/21