This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
devel/regenerate: make sure the .fnc files don't overlap
authorKarl Williamson <khw@cpan.org>
Thu, 15 Aug 2019 22:43:01 +0000 (16:43 -0600)
committerNicolas R <atoomic@cpan.org>
Fri, 27 Sep 2019 22:51:28 +0000 (16:51 -0600)
If they do, this could show that they weren't recently regenerated, or
that there is a bug in the regeneration code.

(cherry picked from commit 51e09cbdf5df04a4e2a7304c5a5bf39f9e91ff00)
Signed-off-by: Nicolas R <atoomic@cpan.org>
dist/Devel-PPPort/devel/regenerate

index ca917ae..6718ed0 100755 (executable)
@@ -64,6 +64,19 @@ if (@notwr) {
   }
 }
 
+# Check that there is only one entry in the whole system for each item
+my @embeds = parse_embed(qw(parts/embed.fnc parts/apidoc.fnc parts/ppport.fnc));
+my %seen;
+%seen =  map { $seen{$_->{name}}++; } @embeds;
+my @bads = grep { $seen{$_} > 1 } keys %seen;
+if (@bads) {
+    print "The following items have multiple entries in the part/*.fnc files.\n",
+          " Regenerate apidoc.fnc, then ppport.fnc and try again.  If this\n",
+          " doesn't work, choose the best version for each symbol and delete\n",
+          " the others: ",
+        join ", ", @bads, "\n";
+    quit_now();
+}
 
 if (-e 'ppport.h') {
     my $blead = $opt{blead};
@@ -74,8 +87,7 @@ if (-e 'ppport.h') {
                                             `$blead ppport.h --list-provided`;
 
     # Get the list of macros that are hard to test.
-    my @unorthodox = map { exists $_->{flags}{u} ? $_->{name} : () }
-            parse_embed(qw(parts/embed.fnc parts/apidoc.fnc parts/ppport.fnc));
+    my @unorthodox = map { exists $_->{flags}{u} ? $_->{name} : () } @embeds;
 
     # Keep on that list only the things we provide
     @unorthodox = grep { exists $provided{$_} } @unorthodox;