develooper Front page | perl.perl5.porters | Postings from March 2003

patch Re: Inline::C seems to hang during make test in 5.8.1 vs. [perl #17757]

Thread Previous | Thread Next
From:
David Dyck
Date:
March 8, 2003 20:19
Subject:
patch Re: Inline::C seems to hang during make test in 5.8.1 vs. [perl #17757]
Message ID:
Pine.LNX.4.51.0303082014440.898@dd.tc.fluke.com



On Fri, 7 Mar 2003 at 21:32 -0800, David Dyck <david.dyck@fluke.com> wrote:

> On Mon, 3 Mar 2003 at 06:02 -0000, hv@crypt.org wrote:
>
> > The simplest I had with Inline was:
> > BEGIN {
> >     require Inline;
> >     Inline->import(qw/ Config DIRECTORY _Inline_test /);
> >     Inline->import('C', 'void true() { }');
> >     Inline->import('C', 'void true2() { }');
> > }
> >
> > .. and I'm guessing that it is Inline itself that is requiring the
> > BEGIN; I don't know whether it is also intrinsic to the bug.
>
>
> Thanks, I've been using this trying different ways to simplify it,
> but it is interesting that adding
>   BEGIN { $::RD_TRACE = 1; }
> before trying to parse true and true2 shows that the whole C
> grammar in
>   Inline::C::ParseRecDescent
> is processed twice, I would think that it should only be
> passed to Parse::RecDescent->new once, since it the grammar isn't
> changed.


When I apply this patch (that I think is an optimization to Inline::C::ParseRecDescent)
I can get make test in Inline::C to pass, but I think that if we apply something
like this, then it will hide a bug in perl 5.8.1 and 5.9.0, which isn't good.

I'm still hoping that this information will trigger some ideas
on how to make a stand alone (non Inline) test case.

Any takers?



--- Inline-0.44/C/lib/Inline/C/ParseRecDescent.pm	Mon Nov  4 13:39:09 2002
+++ Inline-0.44-3/C/lib/Inline/C/ParseRecDescent.pm	Sat Mar  8 20:13:22 2003
@@ -9,6 +9,7 @@
     }
 }

+our $parser;
 sub get_parser {
     my $o = shift;
     eval { require Parse::RecDescent };
@@ -17,7 +18,11 @@
 $@
 END
     $main::RD_HINT++;
-    Parse::RecDescent->new(grammar())
+    if ($parser) {
+	delete $parser->{data} if exists $parser->{data};
+	return $parser;
+    }
+    $parser = Parse::RecDescent->new(grammar());
 }

 sub grammar {

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About