From: Dominic Dunlop Date: Tue, 29 Sep 1998 21:06:30 +0000 (+0000) Subject: document yet another RE diagnostic, make it consistent with REG_INFTY X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=17feb5d536e7c1a1b75d6e8e85a12d67b3d41c04;p=p5sagit%2Fp5-mst-13.2.git document yet another RE diagnostic, make it consistent with REG_INFTY Date: Tue, 29 Sep 1998 21:06:30 +0000 Message-Id: Subject: [PATCH 5.005_52] Fix hard-coded "matches null string many times" limit -- Date: Wed, 30 Sep 1998 11:46:44 +0000 Message-Id: Subject: [PATCH 5.005_52] Add "Strange *+?{} ..." to perldiag p4raw-id: //depot/perl@1911 --- diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 73b48a9..08c73c3 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2422,6 +2422,14 @@ there was a failure. You probably wanted to use system() instead, which does return. To suppress this warning, put the exec() in a block by itself. +=item Strange *+?{} on zero-length expression + +(W) You applied a regular expression quantifier in a place where it +makes no sense, such as on a zero-width assertion. +Try putting the quantifier inside the assertion instead. For example, +the way to match "abc" provided that it is followed by three +repetitions of "xyz" is C, not C. + =item Stub found while resolving method `%s' overloading `%s' in package `%s' (P) Overloading resolution over @ISA tree may be broken by importation stubs. diff --git a/regcomp.c b/regcomp.c index 85a44d5..583e14c 100644 --- a/regcomp.c +++ b/regcomp.c @@ -493,7 +493,7 @@ study_chunk(regnode **scanp, I32 *deltap, regnode *last, scan_data_t *data, U32 scan = next; if (ckWARN(WARN_UNSAFE) && (minnext + deltanext == 0) && !(data->flags & (SF_HAS_PAR|SF_IN_PAR)) - && maxcount <= 10000) /* Complement check for big count */ + && maxcount <= REG_INFTY/3) /* Complement check for big count */ warner(WARN_UNSAFE, "Strange *+?{} on zero-length expression"); min += minnext * mincount; is_inf_internal |= (maxcount == REG_INFTY @@ -1586,7 +1586,7 @@ regpiece(I32 *flagp) goto do_curly; } nest_check: - if (ckWARN(WARN_UNSAFE) && !SIZE_ONLY && !(flags&HASWIDTH) && max > 10000) { + if (ckWARN(WARN_UNSAFE) && !SIZE_ONLY && !(flags&HASWIDTH) && max > REG_INFTY/3) { warner(WARN_UNSAFE, "%.*s matches null string many times", PL_regcomp_parse - origparse, origparse); }