From: Vincent Pit Date: Thu, 6 May 2010 18:28:58 +0000 (+0200) Subject: Make sv_vcatpvfn() complain when special formats "%s" and "%.0f" can't find their... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5b98cd54dff3b16344eab33ce6b09fb6fb1b89c2;p=p5sagit%2Fp5-mst-13.2.git Make sv_vcatpvfn() complain when special formats "%s" and "%.0f" can't find their argument This fixes [RT #62874] : printf does not print a warning when a lone %s conversion is used --- diff --git a/sv.c b/sv.c index ae9f9d0..4f2ad99 100644 --- a/sv.c +++ b/sv.c @@ -9365,6 +9365,8 @@ Perl_sv_vcatpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, else if (svix < svmax) { sv_catsv(sv, *svargs); } + else + S_vcatpvfn_missing_argument(aTHX); return; } if (args && patlen == 3 && pat[0] == '%' && @@ -9390,7 +9392,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *const sv, const char *const pat, const STRLEN patlen, if (svix < svmax) nv = SvNV(*svargs); else - return; + S_vcatpvfn_missing_argument(aTHX); if (*pp == 'g') { /* Add check for digits != 0 because it seems that some gconverts are buggy in this case, and we don't yet have diff --git a/t/op/sprintf.t b/t/op/sprintf.t index a127143..8d93297 100644 --- a/t/op/sprintf.t +++ b/t/op/sprintf.t @@ -373,6 +373,8 @@ __END__ >%+8.1f< >-1234.875< > -1234.9< >%*.*f< >[5, 2, 12.3456]< >12.35< >%f< >0< >0.000000< +>%.0f< >[]< >0 MISSING< +> %.0f< >[]< > 0 MISSING< >%.0f< >0< >0< >%.0f< >2**38< >274877906944< >Should have exact int'l rep'n< >%.0f< >0.1< >0< @@ -494,6 +496,8 @@ __END__ >%#p< >''< >%#p INVALID< >%q< >''< >%q INVALID< >%r< >''< >%r INVALID< +>%s< >[]< > MISSING< +> %s< >[]< > MISSING< >%s< >'string'< >string< >%10s< >'string'< > string< >%+10s< >'string'< > string<