(W syntax) An underscore (underbar) in a numeric constant did not
separate two digits.
+=item Missing argument in %s
+
+(W uninitialized) A printf-type format required more arguments than were
+supplied.
+
=item Missing argument to -%c
(F) The argument to the indicated command line switch must follow
sv_vcatpvfn(sv, pat, patlen, args, svargs, svmax, maybe_tainted);
}
+
+/*
+ * Warn of missing argument to sprintf, and then return a defined value
+ * to avoid inappropriate "use of uninit" warnings [perl #71000].
+ */
+#define WARN_MISSING WARN_UNINITIALIZED /* Not sure we want a new category */
+STATIC SV*
+S_vcatpvfn_missing_argument(pTHX_) {
+ if (ckWARN(WARN_MISSING)) {
+ Perl_warner(aTHX_ packWARN(WARN_MISSING), "Missing argument in %s",
+ PL_op ? OP_DESC(PL_op) : "sv_vcatpvfn()");
+ }
+ return &PL_sv_no;
+}
+
+
STATIC I32
S_expect_number(pTHX_ char **const pattern)
{
vecsv = va_arg(*args, SV*);
else if (evix) {
vecsv = (evix > 0 && evix <= svmax)
- ? svargs[evix-1] : &PL_sv_undef;
+ ? svargs[evix-1] : S_vcatpvfn_missing_argument();
} else {
- vecsv = svix < svmax ? svargs[svix++] : &PL_sv_undef;
+ vecsv = svix < svmax
+ ? svargs[svix++] : S_vcatpvfn_missing_argument();
}
dotstr = SvPV_const(vecsv, dotstrlen);
/* Keep the DO_UTF8 test *after* the SvPV call, else things go
if (!vectorize && !args) {
if (efix) {
const I32 i = efix-1;
- argsv = (i >= 0 && i < svmax) ? svargs[i] : &PL_sv_undef;
+ argsv = (i >= 0 && i < svmax)
+ ? svargs[i] : S_vcatpvfn_missing_argument();
} else {
argsv = (svix >= 0 && svix < svmax)
- ? svargs[svix++] : &PL_sv_undef;
+ ? svargs[svix++] : S_vcatpvfn_missing_argument();
}
}
$w = ' INVALID';
} elsif ($_[0] =~ /^Use of uninitialized value/) {
$w = ' UNINIT';
+ } elsif ($_[0] =~ /^Missing argument/) {
+ $w = ' MISSING';
} else {
warn @_;
}
>%3$d %d %d< >[12, 34, 56]< >56 12 34<
>%2$*3$d %d< >[12, 34, 3]< > 34 12<
>%*3$2$d %d< >[12, 34, 3]< >%*3$2$d 12 INVALID<
->%2$d< >12< >0 UNINIT<
+>%2$d< >12< >0 MISSING<
>%0$d< >12< >%0$d INVALID<
>%1$$d< >12< >%1$$d INVALID<
>%1$1$d< >12< >%1$1$d INVALID<
>%#o< >0< >0<
>%#x< >0< >0<
>%2147483647$v2d< >''< ><
->%*2147483647$v2d< >''< > UNINIT<
+>%*2147483647$v2d< >''< > MISSING<
}
# Used to mangle PL_sv_undef
-fresh_perl_is(
+fresh_perl_like(
'print sprintf "xxx%n\n"; print undef',
- 'Modification of a read-only value attempted at - line 1.',
+ 'Modification of a read-only value attempted at - line 1\.',
{ switches => [ '-w' ] },
q(%n should not be able to modify read-only constants),
);
{
my ($warn, $bad) = (0,0);
local $SIG{__WARN__} = sub {
- if ($_[0] =~ /uninitialized/) {
+ if ($_[0] =~ /missing argument/i) {
$warn++
}
else {