diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-09-22 16:31:16 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-09-25 07:54:10 +0100 |
commit | e64ca59f2852bc5d0450eea5ed412609a046829d (patch) | |
tree | 269a2fa1fd8040e7c64cec21b1a95079acad862a /embed.pl | |
parent | 2227225b9a5b9c5988ec68e11274f160d8363b0f (diff) | |
download | perl-e64ca59f2852bc5d0450eea5ed412609a046829d.tar.gz |
Use the same $func to Perl_$func macros independent of multiplicity.
The macros of the form #define foo(a, b) Perl_foo(aTHX_ a, b) will also work
under non-multiplicity. There's no issue with adding explicit arguments in
the non-multiplicity case, because it changes one form of compile-time error
into another. (Function Perl_foo passed the wrong number of arguments into
macro foo passed the wrong number of arguments.)
Diffstat (limited to 'embed.pl')
-rwxr-xr-x | embed.pl | 71 |
1 files changed, 6 insertions, 65 deletions
@@ -379,8 +379,6 @@ print $em do_not_edit ("embed.h"), <<'END'; /* Hide global symbols */ -#if !defined(PERL_IMPLICIT_CONTEXT) - END # Try to elimiate lots of repeated @@ -393,64 +391,8 @@ END # by tracking state and merging foo and bar into one block. my $ifdef_state = ''; -walk_table { - my $ret = ""; - my $new_ifdef_state = ''; - if (@_ == 1) { - my $arg = shift; - $ret = "$arg\n" if $arg =~ /^#\s*(if|ifn?def|else|endif)\b/; - } - else { - my ($flags,$retval,$func,@args) = @_; - unless ($flags =~ /[om]/) { - if ($flags =~ /s/) { - $ret = hide($func,"S_$func"); - } - elsif ($flags =~ /p/) { - $ret = hide($func,"Perl_$func"); - } - } - if ($ret ne '' && $flags !~ /A/) { - if ($flags =~ /E/) { - $new_ifdef_state - = "#if defined(PERL_CORE) || defined(PERL_EXT)\n"; - } - else { - $new_ifdef_state = "#ifdef PERL_CORE\n"; - } - - if ($new_ifdef_state ne $ifdef_state) { - $ret = $new_ifdef_state . $ret; - } - } - } - if ($ifdef_state && $new_ifdef_state ne $ifdef_state) { - # Close the old one ahead of opening the new one. - $ret = "#endif\n$ret"; - } - # Remember the new state. - $ifdef_state = $new_ifdef_state; - $ret; -} $em; - -if ($ifdef_state) { - print $em "#endif\n"; -} - -for $sym (sort keys %ppsym) { - $sym =~ s/^Perl_//; - print $em hide($sym, "Perl_$sym"); -} - -print $em <<'END'; - -#else /* PERL_IMPLICIT_CONTEXT */ - -END - my @az = ('a'..'z'); -$ifdef_state = ''; walk_table { my $ret = ""; my $new_ifdef_state = ''; @@ -471,7 +413,12 @@ walk_table { } } elsif ($args and $args[$args-1] =~ /\.\.\./) { - # we're out of luck for varargs functions under CPP + if ($flags =~ /p/) { + # we're out of luck for varargs functions under CPP + # So we can only do these macros for no implicit context: + $ret = "#ifndef PERL_IMPLICIT_CONTEXT\n" + . hide($func,"Perl_$func") . "#endif\n"; + } } else { my $alist = join(",", @az[0..$args-1]); @@ -530,14 +477,8 @@ for $sym (sort keys %ppsym) { print $em <<'END'; -#endif /* PERL_IMPLICIT_CONTEXT */ - #endif /* #ifndef PERL_NO_SHORT_NAMES */ -END - -print $em <<'END'; - /* Compatibility stubs. Compile extensions with -DPERL_NOCOMPAT to disable them. */ |