diff --git a/regen/embed.pl b/regen/embed.pl index 5bd4cd4a20f6..684b50f7343c 100755 --- a/regen/embed.pl +++ b/regen/embed.pl @@ -104,6 +104,27 @@ BEGIN pod/perlreapi.pod ); +# A regular expression that matches names that are externally visible, but +# Perl reserves for itself. Generally, we want things to be delimitted on +# both sides to show it isn't part of a larger word such as 'hyperlink', +# 'perlustrate', or 'properly'. Underscores delimit besides the typical ^ or +# \b. All caps PERL has looser rules to accommodate the many existing symbols +# where everything is jammed together, and the less likelihood that something +# with all caps is innocently referring to something unrelated to Perl. +my $names_reserved_for_perl_use_re = + qr/ ^ ( PL_ \w+ \b + | perl_ # The underscore delimits + | Perl [_A-Z] # Uppercase delimits here too + | PERL [A-Z]+ [[:alpha:]] ( \b | _ ) + ) + + # The \d is for PERL5, for example + | ( _ | \b ) PERL ( _ | \b | \d+ ) + + # This is for obsolete and deprecated uses + | ( _ | \b ) CPERL (arg | scope) ( _ | \b ) + /x; + # This is a list of symbols that are not documented to be available for # modules to use, but are nevertheless currently not kept by embed.h from # being visible to the world. @@ -111,7 +132,7 @@ BEGIN # Strive to make this list empty. # # The list does not include symbols that we have documented as being reserved -# for perl's use, namely those that begin with 'PL_' or contain qr/perl/i. +# for perl's use, namely those that match the pattern just above. # There are two parts of the list; the second part contains the symbols which # have a trailing underscore; the first part those without. # @@ -1336,6 +1357,8 @@ BEGIN is_XDIGIT_high isXDIGIT_LC_utf8 isXDIGIT_uni + is_XPERLSPACE_cp_high + is_XPERLSPACE_high IV_DIG IV_MAX_P1 JE_OLD_STACK_HWM_restore @@ -4729,9 +4752,7 @@ sub find_undefs { # Just the symbol, no arglist nor definition $name =~ s/ (?: \s | \( ) .* //x; - # These are reserved for Perl's use, so not a problem. - next if $name =~ / ^ PL_ /x; - next if $name =~ /perl/i; + next if $name =~ $names_reserved_for_perl_use_re; next unless $line->reduce_conds($constraints_re, \%constraints);