diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-05-08 12:19:51 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-05-08 12:19:51 +0000 |
commit | f728784643460445f91833d46f0c8bf60beb6583 (patch) | |
tree | 7fcb632ba3b22f54e2e4998c65e77f5c0be5bf1a /embed.pl | |
parent | 4373e329bbd25cac77cfe128757db8cbb63c47bb (diff) | |
download | perl-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-x | embed.pl | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -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/; |