bison-patches
[Top][All Lists]
Advanced

[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: Théophile Ranquet
Subject: Re: [PATCH 1/4] bench: pacify script (invalid uses of undefined variables)
Date: Mon, 21 Jan 2013 13:40:48 +0100

2013/1/21 Akim Demaille <address@hidden>:
> Le 21 janv. 2013 à 12:46, Theophile Ranquet <address@hidden> a écrit :
>
>> * etc/bench.pl: Here.
>
> I would like to have a more detailed commit message, please.
> I don't understand why we sometimes have undefined variables,
> it seems fishy.

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:  ()

Because no directives were provided.  Indeed, the script's
documentation does tell us the directives are mandatory: "./bench.pl
[OPTIONS]... DIRECTIVES". When directives are provided, there are no
such errors:

$ ./_build/etc/bench.pl  -g list -i 42 ' '
(script goes on without any problem)

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

commit 94569b74fcefbe07f84e3a3d65c1c3caacd2f766
Author: Theophile Ranquet <address@hidden>
Date:   Fri Dec 28 16:36:14 2012 +0100

    bench: change command line directives format

    They used to be passed as follows:

      $ ./bench.pl -g list -i 42 '(' '%s' 'glr.cc' '|' '%s' '%lalr1.cc' ')'

    Which was tedious.  Now, just use the much simpler:

      $ ./bench.pl -g list -i 42 "( %s glr.cc | %s %lalr1.cc )"

    * etc/bench.pl (bench): Call with just a split argv[0], not a full argv.

diff --git a/etc/bench.pl.in b/etc/bench.pl.in
index 83176d5..0b155f7 100755
--- a/etc/bench.pl.in
+++ b/etc/bench.pl.in
@@ -1127,7 +1127,7 @@ if (defined $bench)


 else
 {
   # Launch the bench marking.
-  bench ($grammar, @ARGV);
+  bench ($grammar, split (/ /, $ARGV[0]));
 }

 ### Setup "GNU" style for perl-mode and cperl-mode.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]