summaryrefslogtreecommitdiff
path: root/embed.pl
diff options
context:
space:
mode:
authorRobin Barker <RMBarker@cpan.org>2006-11-13 10:25:08 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-11-13 11:38:02 +0000
commitcdfeb707a2638190212953e4a52d8460de223429 (patch)
treef8c354cdfde9c9b1601d8271086c4a4923ac2f57 /embed.pl
parent3cd0a11a1a8c5cc6b632f666275eeafcb6f5c950 (diff)
downloadperl-cdfeb707a2638190212953e4a52d8460de223429.tar.gz
was RE: Perl_die() / Perl_croak()
From: "Robin Barker" <Robin.Barker@npl.co.uk> Message-ID: <2C2E01334A940D4792B3E115F95B7226149377@exchsvr1.npl.ad.local> p4raw-id: //depot/perl@29259
Diffstat (limited to 'embed.pl')
-rwxr-xr-xembed.pl12
1 files changed, 8 insertions, 4 deletions
diff --git a/embed.pl b/embed.pl
index 7d4dbc4140..90b5f795b7 100755
--- a/embed.pl
+++ b/embed.pl
@@ -232,10 +232,14 @@ sub write_protos {
push @attrs, "__attribute__pure__";
}
if( $flags =~ /f/ ) {
- my $prefix = $has_context ? 'pTHX_' : '';
- my $args = scalar @args;
- push @attrs, sprintf "__attribute__format__(__printf__,%s%d,%s%d)",
- $prefix, $args - 1, $prefix, $args;
+ my $prefix = $has_context ? 'pTHX_' : '';
+ my $args = scalar @args;
+ my $pat = $args - 1;
+ my $macro = @nonnull && $nonnull[-1] == $pat
+ ? '__attribute__format__'
+ : '__attribute__format__null_ok__';
+ push @attrs, sprintf "%s(__printf__,%s%d,%s%d)", $macro,
+ $prefix, $pat, $prefix, $args;
}
if ( @nonnull ) {
my @pos = map { $has_context ? "pTHX_$_" : $_ } @nonnull;