summaryrefslogtreecommitdiff
path: root/embed.pl
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-05-08 12:19:51 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-05-08 12:19:51 +0000
commitf728784643460445f91833d46f0c8bf60beb6583 (patch)
tree7fcb632ba3b22f54e2e4998c65e77f5c0be5bf1a /embed.pl
parent4373e329bbd25cac77cfe128757db8cbb63c47bb (diff)
downloadperl-f728784643460445f91833d46f0c8bf60beb6583.tar.gz
Tweak the insertion of __attribute__((nonnull())) declarations
in proto.h so it compiles with and without threads with gcc 3.4 p4raw-id: //depot/perl@24416
Diffstat (limited to 'embed.pl')
-rwxr-xr-xembed.pl19
1 files changed, 17 insertions, 2 deletions
diff --git a/embed.pl b/embed.pl
index 39bd4296da..6487ff4ae0 100755
--- a/embed.pl
+++ b/embed.pl
@@ -212,8 +212,23 @@ sub write_protos {
}
$ret .= "\n\t\t\t__attribute__((nonnull))" if $flags =~ /N/;
if ( @nonnull ) {
- my @pos = map { $has_context ? "pTHX_ $_" : $_ } @nonnull;
- $ret .= sprintf( "\n\t\t\t__attribute__((nonnull(%s)))", join( ",", @pos ) );
+ if ($has_context) {
+ my @pos = map { $has_context ? $_ + 1 : $_ } @nonnull;
+ $ret .= sprintf( <<ATTR,
+
+#ifdef USE_ITHREADS
+ __attribute__((nonnull(%s)))
+#else
+ __attribute__((nonnull(%s)))
+#endif
+ATTR
+ join( ",", @pos ),
+ join( ",", @nonnull ),
+ );
+ }
+ else {
+ $ret .= sprintf( "\n\t\t\t__attribute__((nonnull(%s)))", join( ",", @nonnull ) );
+ }
}
$ret .= ";";
$ret .= ' */' if $flags =~ /m/;