From 71556506e314e769ce97e03177d978fbd8a37c18 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 29 Jan 2011 09:53:44 -0700 Subject: embed.fnc: Add inline function capability This patch adds to embed.pl the capability to generate static inline functions. --- embed.fnc | 6 ++++++ regen/embed.pl | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/embed.fnc b/embed.fnc index b4fae82c98..13d82998d7 100644 --- a/embed.fnc +++ b/embed.fnc @@ -46,6 +46,12 @@ : : proto.h: add __attribute__format__ (or ...null_ok__) : +: i Static inline: function in source code has a S_ prefix: +: +: proto.h: function is declared as S_foo rather than foo, +: PERL_STATIC_INLINE is added to declaration; +: embed.h: "#define foo S_foo" entries added +: : M May change: : : any doc entry is marked that function may change diff --git a/regen/embed.pl b/regen/embed.pl index b7d784970b..b6a25356b4 100755 --- a/regen/embed.pl +++ b/regen/embed.pl @@ -231,8 +231,11 @@ sub walk_table (&@) { } } - if ($flags =~ /s/) { - $retval = "STATIC $splint_flags$retval"; + if ($flags =~ /([si])/) { + my $type = ($1 eq 's') ? "STATIC" : "PERL_STATIC_INLINE"; + warn "$func: i and s flags are mutually exclusive" + if $flags =~ /s/ && $flags =~ /i/; + $retval = "$type $splint_flags$retval"; $func = "S_$plain_func"; } else { @@ -468,7 +471,7 @@ sub embed_h { $ret = "#define $func($alist)"; my $t = int(length($ret) / 8); $ret .= "\t" x ($t < 4 ? 4 - $t : 1); - if ($flags =~ /s/) { + if ($flags =~ /[si]/) { $ret .= "S_$func(aTHX"; } elsif ($flags =~ /p/) { -- cgit v1.2.1