This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
parts/apicheck.pl: Handle const parameters
authorKarl Williamson <khw@cpan.org>
Tue, 25 Jun 2019 17:46:33 +0000 (11:46 -0600)
committerNicolas R <atoomic@cpan.org>
Fri, 27 Sep 2019 22:39:29 +0000 (16:39 -0600)
We now have parameters that are declared 'const'.  The code generated
previously was declared const without being initialized, which is now
fatal.

(cherry picked from commit 35286f38df4517fb5fa338fcff410eaa5c0ddce0)
Signed-off-by: Nicolas R <atoomic@cpan.org>
dist/Devel-PPPort/parts/apicheck.pl

index e043690..5f7cfd5 100644 (file)
@@ -235,7 +235,9 @@ for $f (@f) {
     else {
       my $v = 'arg' . $i++;
       push @arg, $v;
-      $stack .= "  static $n $p$v$d;\n";
+      my $no_const_n = $n;
+      $no_const_n =~ s/\bconst\b// unless $p;
+      $stack .= "  static $no_const_n $p$v$d;\n";
     }
   }