X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=toke.c;h=5571500b59868b22f0e171477785c27eb81e4c28;hb=8f9a6e7d3541caba01fe037a1cf62a37217f9d9b;hp=85ec1d1be557e6a149c2943a2617a89d90bdc108;hpb=d3cea301eb4cb4c87b2540dea791ab175d5a0a51;p=p5sagit%2Fp5-mst-13.2.git diff --git a/toke.c b/toke.c index 85ec1d1..5571500 100644 --- a/toke.c +++ b/toke.c @@ -26,6 +26,8 @@ #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 char c_in_subst[] = "Use of /c modifier is meaningless in s///"; static void restore_rsfp(pTHX_ void *f); #ifndef PERL_NO_UTF16_FILTER @@ -6284,6 +6286,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 +6341,12 @@ S_scan_subst(pTHX_ char *start) break; } + /* /c is not meaningful with s/// */ + if (ckWARN(WARN_REGEXP) && (pm->op_pmflags & PMf_CONTINUE)) + { + Perl_warner(aTHX_ packWARN(WARN_REGEXP), c_in_subst); + } + if (es) { SV *repl; PL_sublex_info.super_bufptr = s;