diff options
author | Mark-Jason Dominus <mjd@plover.com> | 2002-03-28 00:04:40 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-03-28 13:22:25 +0000 |
commit | 31c520ebee75a034aef37b3da9457866cf436844 (patch) | |
tree | 026a810f604582f9412f8a205e73a07eff2a646b /toke.c | |
parent | 48b6c1e92d2f5f416163abd7bf38a2bf8ef396f6 (diff) | |
download | perl-31c520ebee75a034aef37b3da9457866cf436844.tar.gz |
warning at use of /c modifier without /g modifier
Message-ID: <20020328100440.22081.qmail@plover.com>
p4raw-id: //depot/perl@15579
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -26,6 +26,7 @@ #define yylval PL_yylval static char ident_too_long[] = "Identifier too long"; +static char c_without_g[] = "Use of /c modifier is meaningless without /g"; static void restore_rsfp(pTHX_ void *f); #ifndef PERL_NO_UTF16_FILTER @@ -6284,6 +6285,13 @@ S_scan_pat(pTHX_ char *start, I32 type) while (*s && strchr("iogcmsx", *s)) pmflag(&pm->op_pmflags,*s++); } + /* issue a warning if /c is specified,but /g is not */ + if (ckWARN(WARN_REGEXP) && + (pm->op_pmflags & PMf_CONTINUE) && !(pm->op_pmflags & PMf_GLOBAL)) + { + Perl_warner(aTHX_ packWARN(WARN_REGEXP), c_without_g); + } + pm->op_pmpermflags = pm->op_pmflags; PL_lex_op = (OP*)pm; @@ -6332,6 +6340,13 @@ S_scan_subst(pTHX_ char *start) break; } + /* issue a warning if /c is specified,but /g is not */ + if (ckWARN(WARN_REGEXP) && + (pm->op_pmflags & PMf_CONTINUE) && !(pm->op_pmflags & PMf_GLOBAL)) + { + Perl_warner(aTHX_ packWARN(WARN_REGEXP), c_without_g); + } + if (es) { SV *repl; PL_sublex_info.super_bufptr = s; |