This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
devel/mktodo.pl: Move invariant expression out of loop
[perl5.git] / dist / Devel-PPPort / devel / mktodo.pl
index d3aeab2..db6e719 100644 (file)
@@ -213,6 +213,9 @@ if ($opt{check}) {
 
     my $r = run(qw(make test));
 
+    # This regenerated apicheck.c
+    dump_apicheck() if $opt{debug};
+
     $r->{didnotrun} and die "couldn't run make test: $!\n" .
         join('', @{$r->{stdout}})."\n---\n".join('', @{$r->{stderr}});
 
@@ -265,6 +268,23 @@ sub regen_apicheck
   unlink qw(apicheck.c apicheck.o);
   runtool({ out => '/dev/null' }, $fullperl, 'apicheck_c.PL', map { "--api=$_" } @_)
       or die "cannot regenerate apicheck.c\n";
+  dump_apicheck() if $opt{debug};
+}
+
+sub dump_apicheck
+{
+    my $apicheck = "apicheck.c";
+    my $f = new IO::File $apicheck or die "cannot open $apicheck: $!\n";
+    my @lines = <$f>;
+    print STDERR __FILE__, ": ", __LINE__, ": $apicheck (",
+                                           scalar @lines,
+                                           " lines) for $fullperl";
+    print STDERR " and '" if @_;
+    print STDERR join "', '", @_;
+    print STDERR "'" if @_;
+    print STDERR ":\n";
+    my $n = 1;
+    print STDERR $n++, " ", $_ for @lines;
 }
 
 sub load_todo
@@ -318,10 +338,9 @@ sub find_undefined_symbols
   my @undefined;
 
   for my $sym (keys %$ls) {
+    next if $sym =~ /\@/ or $sym =~ /^_/ or exists $stdsym{$sym};
     unless (exists $ps->{$sym}) {
-      if ($sym !~ /\@/ and $sym !~ /^_/) {
-        push @undefined, $sym unless $stdsym{$sym};
-      }
+        push @undefined, $sym;
     }
   }