Subject: | $token undef @ MarpaX/Languages/C/AST/Scope.pm:205 |
Date: | Sun, 12 Feb 2017 18:16:44 +0100 |
To: | bug-MarpaX-Languages-C-AST [...] rt.cpan.org |
From: | Kai Henningsen <kai.extern [...] gmail.com> |
So I wondered if I should really be using MarpaX::Languages::C::AST
directly, and not the C::Scan compatibility stuff. However, that also had a
problem.
Perl program used:
#! /usr/bin/perl -w
use strict;
use Data::Dumper::Simple;
$Data::Dumper::Useqq = 1;
$Data::Dumper::Sortkeys = 1;
no warnings qw( qw experimental::smartmatch );
$| = 1;
use MarpaX::Languages::C::AST;
use Scalar::Util;
my $cc = 'c';
my $src = "uv0.$cc";
my $ppsrc = "uv1.$cc";
my $pppsrc = "uv2.$cc";
open UV0, '>', $src or die "$src: $!";
print UV0 "#include <uv.h>\n";
close UV0 or die "$src: $!";
system('gcc', '-E', $src, '-o', $ppsrc) and die "gcc -E $src -o $ppsrc: $!
$?";
open UV1, '<', $ppsrc or die "$ppsrc: $!";
$/ = undef;
my $srcpp = <UV1>;
close UV1 or die "$ppsrc: $!";
my $parser = MarpaX::Languages::C::AST->new(lazy => 1);
my $ast = $parser->parse(\$srcpp)->value(1);
print Dumper($ast);
And this produced:
Use of uninitialized value $token in hash element at
/usr/local/share/perl/5.22.2/MarpaX/Languages/C/AST/Scope.pm line
205 (#1)
(W uninitialized) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a mistake.
To suppress this warning assign a defined value to your variables.
To help you figure out what was undefined, perl will try to tell you
the name of the variable (if any) that was undefined. In some cases
it cannot do this, so it also tells you what operation you used the
undefined value in. Note, however, that perl optimizes your program
and the operation displayed in the warning may not necessarily appear
literally in your program. For example, "that $foo" is usually
optimized into "that " . $foo, and the warning will refer to the
concatenation (.) operator, even though there is no . in
your program.
Uncaught exception from user code:
Use of uninitialized value $token in hash element at
/usr/local/share/perl/5.22.2/MarpaX/Languages/C/AST/Scope.pm line 205.
MarpaX::Languages::C::AST::Scope::parseObscureTypedef(MarpaX::Languages::C::AST::Scope=HASH(0x55b910e3b8f8),
undef) called at
/usr/local/share/perl/5.22.2/MarpaX/Languages/C/AST/Callback/Events.pm line
380
MarpaX::Languages::C::AST::Callback::Events::_enterOrObscureTypedef(MarpaX::Languages::C::AST::Callback=ARRAY(0x55b91209b9f0),
-1, ARRAY(0x55b91588e590)) called at
/usr/local/share/perl/5.22.2/MarpaX/Languages/C/AST/Callback/Events.pm line
366
MarpaX::Languages::C::AST::Callback::Events::_declarationCheck(MarpaX::Languages::C::AST::Callback::Method=ARRAY(0x55b915412508),
MarpaX::Languages::C::AST::Callback=ARRAY(0x55b91209b9f0),
ARRAY(0x55b91588d950)) called at
/usr/local/share/perl/5.22.2/MarpaX/Languages/C/AST/Callback.pm line 389
MarpaX::Languages::C::AST::Callback::_fire(MarpaX::Languages::C::AST::Callback=ARRAY(0x55b91209b9f0))
called at /usr/local/share/perl/5.22.2/MarpaX/Languages/C/AST/Callback.pm
line 204
MarpaX::Languages::C::AST::Callback::exec(undef, "<process>")
called at
/usr/local/share/perl/5.22.2/MarpaX/Languages/C/AST/Callback/Events.pm line
548
MarpaX::Languages::C::AST::Callback::Events::_subFire_optimized(MarpaX::Languages::C::AST::Callback::Method=ARRAY(0x55b91544ded0),
MarpaX::Languages::C::AST::Callback::Events=ARRAY(0x55b912393150),
ARRAY(0x55b91588f4e8), "declarationCheck",
MarpaX::Languages::C::AST::Callback=ARRAY(0x55b91209b9f0),
HASH(0x55b912483ac0), HASH(0x55b9154307f0)) called at
/usr/local/share/perl/5.22.2/MarpaX/Languages/C/AST/Callback.pm line 389
MarpaX::Languages::C::AST::Callback::_fire(MarpaX::Languages::C::AST::Callback::Events=ARRAY(0x55b912393150))
called at /usr/local/share/perl/5.22.2/MarpaX/Languages/C/AST/Callback.pm
line 204
MarpaX::Languages::C::AST::Callback::exec(undef,
"translationUnit\$", "^externalDeclaration", "declarationCheck\$") called
at /usr/local/share/perl/5.22.2/MarpaX/Languages/C/AST.pm line 262
MarpaX::Languages::C::AST::_doEvents(MarpaX::Languages::C::AST=HASH(0x55b91538b8c8))
called at /usr/local/share/perl/5.22.2/MarpaX/Languages/C/AST.pm line 171
MarpaX::Languages::C::AST::parse(MarpaX::Languages::C::AST=HASH(0x55b91538b8c8),
SCALAR(0x55b9118dd398)) called at ./make_uv_wrapper.pl line 32
Am I doing something wrong? Looking at the source (and a bit of debug
output), I can't see how I'd have any influence there. It seems to happen
the very first time it uses this code path.
--
Show quoted text
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT d s+: a++ C++ UL++++ P+++ L+++ E--- W++@ N@ !o !K w(++) O-@ M-@
V-- PS++@ PE- Y+ PGP+@ t- 5 X- !tv b++>+++ D--- G e+ h-- !r y?
------END GEEK CODE BLOCK------