This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
parts/ppptools.pl: Normalize prototypes
authorKarl Williamson <khw@cpan.org>
Fri, 12 Jul 2019 16:38:10 +0000 (10:38 -0600)
committerNicolas R <atoomic@cpan.org>
Fri, 27 Sep 2019 22:39:28 +0000 (16:39 -0600)
This is so the existing comparison routines don't show that things are
different solely because of white space differences

(cherry picked from commit 93e8c96d2cd21f17b16636c3876a7960ef48b74e)
Signed-off-by: Nicolas R <atoomic@cpan.org>
dist/Devel-PPPort/PPPort_pm.PL
dist/Devel-PPPort/parts/ppptools.pl

index 0ac91d8..8e22057 100644 (file)
@@ -150,6 +150,7 @@ sub include
 
   for (keys %{$data->{prototypes}}) {
     $prototypes{$_} = $data->{prototypes}{$_};
+    $prototypes{$_} = normalize_prototype($data->{prototypes}{$_});
     $data->{implementation} =~ s/^$_(?=\s*\()/$DPPP(my_$_)/mg;
   }
 
index 77e80cb..861f1e3 100644 (file)
@@ -339,6 +339,13 @@ sub parse_embed
   return @func;
 }
 
+sub normalize_prototype  # So that they can be compared more easily
+{
+    my $proto = shift;
+    $proto =~ s/\s* \* \s* / * /xg;
+    return $proto;
+}
+
 sub make_prototype
 {
   my $f = shift;
@@ -346,7 +353,7 @@ sub make_prototype
   my $proto;
   my $pTHX_ = exists $f->{flags}{T} ? "" : "pTHX_ ";
   $proto = "$f->{ret} $f->{name}" . "($pTHX_" . join(', ', @args) . ')';
-  return $proto;
+  return normalize_prototype($proto);
 }
 
 sub format_version