Stop /(a|b)(?=a){3}/ from warning twice
authorFather Chrysostomos <sprout@cpan.org>
Mon, 10 Jun 2013 01:42:47 +0000 (18:42 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 10 Jun 2013 01:42:47 +0000 (18:42 -0700)
commit688e03912e3bff2d2419c457d8b0e1bab3eb7112
tree4eda3f56dc7966ec4e2e7649248b11bec1a44e1c
parent636013b3f52d8d822c7b83d79398d51b08c82838
Stop /(a|b)(?=a){3}/ from warning twice

[sprout@dromedary-001 perl2.git]$ ../perl.git/Porting/bisect.pl --target=miniperl  --start=perl-5.8.0 --end=v5.10.0   -- ./miniperl -Ilib -we 'BEGIN { $SIG{__WARN__} = sub { die if $_[0] =~ /Quantifier/ && $warned++; warn shift }}; ""=~/(N|N)(?{})?/'
...
07be1b83a6b2d24b492356181ddf70e1c7917ae3 is the first bad commit
commit 07be1b83a6b2d24b492356181ddf70e1c7917ae3
Author: Yves Orton <demerphq@gmail.com>
Date:   Fri Jun 9 02:56:37 2006 +0200

    Re: [PATCH] Better version of the Aho-Corasick patch and lots of benchmarks.
    Message-ID: <9b18b3110606081556t779de698r82f361d82a05fbc8@mail.gmail.com>

    (with tweaks)

    p4raw-id: //depot/perl@28373

Since that commit, it has been possible for S_study_chunk to be called
twice if the trie optimisation kicks in (which happens for /(a|b)/).
‘Quantifier unexpected on zero-length expression’ is the only warning
in S_study_chunk.  Now it can appear twice if the quantified zero-
length expression is in the same regexp as a trie optimisation.

So pass a flag to S_study_chunk when ‘restudying’ to indicate that the
warning should be skipped.

There are two code paths that call S_study_chunk, one for when there
is no top-level alternation, which triggers the error in this case,
and one for when there is a top-level alternation (/a|b/).  I wasn’t
able to figure out how to trigger the double warning in the second
case, but I passed the flag for the restudy in that code path anyway,
since I don’t think it can be wrong.
regcomp.c
t/re/reg_mesg.t