diff options
author | David Mitchell <davem@iabyn.com> | 2013-11-26 15:50:45 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-11-28 17:03:49 +0000 |
commit | 531b2663d70bdda47662024f4697a3c3f713f83c (patch) | |
tree | c51deedbb0bb319397306d8c129bf1f3d57b8834 /regen | |
parent | 1061065f7a09399eefb50e9a035502621722bcc0 (diff) | |
download | perl-531b2663d70bdda47662024f4697a3c3f713f83c.tar.gz |
mark Perl_my_strftime with format attribute
mark this function with
__attribute__format__null_ok__(__strftime__,pTHX_1,0)
so that compiler checks and warnings about strftime-style format args
can be checked.
Rather than adding new flag(s) to embed.fnc, I just enhanced the f flag
to treat it as strftime-style rather than printf if the function name
matches /strftime/. This was quicker, and we're unlikely to have many
such functions.
Diffstat (limited to 'regen')
-rwxr-xr-x | regen/embed.pl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/regen/embed.pl b/regen/embed.pl index 521217d7bb..6571aecd45 100755 --- a/regen/embed.pl +++ b/regen/embed.pl @@ -184,8 +184,13 @@ my ($embed, $core, $ext, $api) = setup_embed(); 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 ($plain_func =~ /strftime/) { + push @attrs, sprintf "%s(__strftime__,%s1,0)", $macro, $prefix; + } + else { + push @attrs, sprintf "%s(__printf__,%s%d,%s%d)", $macro, + $prefix, $pat, $prefix, $args; + } } if ( @nonnull ) { my @pos = map { $has_context ? "pTHX_$_" : $_ } @nonnull; |