This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regen/mk_invlists.pl: Allow enum defns to be public
authorKarl Williamson <khw@cpan.org>
Fri, 23 Mar 2018 17:55:28 +0000 (11:55 -0600)
committerKarl Williamson <khw@cpan.org>
Mon, 26 Mar 2018 22:26:54 +0000 (16:26 -0600)
This adds the ability for an enum typedef to be able to be made public.
Earlier in 5.27, commit c0221e16334efbe9723722578949dc3916d669d4 was
made to revert fea79782ed31ac4faa71eb6193faff54b4bbe249, because it
created bloat due to multiple statics of large arrays

This current commit is an alternative approach to
fea79782ed31ac4faa71eb6193faff54b4bbe249, but which doesn't create
bloat.  But the capability is commented out because it isn't needed in
5.28

charclass_invlists.h
regen/mk_invlists.pl

index 9ff8d52..80cb33b 100644 (file)
@@ -109391,5 +109391,5 @@ static const U8 WB_table[24][24] = {
  * ea4dc61a00d2db9bd46f3ddec706b5b7b11e8fcf848fb384b54b507fb70d8e90 lib/unicore/mktables
  * 21653d2744fdd071f9ef138c805393901bb9547cf3e777ebf50215a191f986ea lib/unicore/version
  * 913d2f93f3cb6cdf1664db888bf840bc4eb074eef824e082fceda24a9445e60c regen/charset_translations.pl
- * 9f2870ea71fbbbca07abf885c9e9c5d555facf587ca105420f48ca3fb9bbfb15 regen/mk_invlists.pl
+ * fed85f75545bcdcf538d9c83e91c5deb29c329db90bad66f56909e0708aa1f20 regen/mk_invlists.pl
  * ex: set ro: */
index 6327ed5..cf91711 100644 (file)
@@ -45,6 +45,11 @@ my $max_hdr_len = 3;    # In headings, how wide a name is allowed?
 
 print $out_fh "/* See the generating file for comments */\n\n";
 
+# enums that should be made public
+my %public_enums = (
+                    #_Perl_SCX => 1
+                    );
+
 # The symbols generated by this program are all currently defined only in a
 # single dot c each.  The code knows where most of them go, but this hash
 # gives overrides for the exceptions to the typical place
@@ -355,7 +360,14 @@ sub output_invmap ($$$$$$$) {
         my $where = (exists $where_to_define_enums{$name})
                     ? $where_to_define_enums{$name}
                     : 'PERL_IN_REGEXEC_C';
-        switch_pound_if($name, $where);
+
+        my $is_public_enum = exists $public_enums{$name};
+        if ($is_public_enum) {
+            end_file_pound_if;
+        }
+        else {
+            switch_pound_if($name, $where);
+        }
 
         # The short names tend to be two lower case letters, but it looks
         # better for those if they are upper. XXX
@@ -429,6 +441,8 @@ sub output_invmap ($$$$$$$) {
         print $out_fh "} $declaration_type;\n";
         # Finished with the enum defintion.
 
+        switch_pound_if($name, $where) if $is_public_enum;
+
         $output_format = "${name_prefix}%s";
 
         # If there are auxiliary tables, output them.