This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
document yet another RE diagnostic, make it consistent with REG_INFTY
authorDominic Dunlop <domo@computer.org>
Tue, 29 Sep 1998 21:06:30 +0000 (21:06 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Fri, 2 Oct 1998 02:52:21 +0000 (02:52 +0000)
Date: Tue, 29 Sep 1998 21:06:30 +0000
Message-Id: <v03110700b236f60b1375@[212.24.192.106]>
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: <v03110702b237beb04830@[212.24.192.74]>
Subject: [PATCH 5.005_52] Add "Strange *+?{} ..." to perldiag

p4raw-id: //depot/perl@1911

pod/perldiag.pod
regcomp.c

index 73b48a9..08c73c3 100644 (file)
@@ -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</abc(?=(?:xyz){3})/>, not C</abc(?=xyz){3}/>.
+
 =item Stub found while resolving method `%s' overloading `%s' in package `%s'
 
 (P) Overloading resolution over @ISA tree may be broken by importation stubs.
index 85a44d5..583e14c 100644 (file)
--- 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);
     }