[PATCH 5.7.3] warning at use of /c modifier without /g modifier

Jeffrey Friedl sais:
> You had strong feelings about the category, so I thought I'd ask if
> you'd like to do this....

So I did.

1. This should be applied instead of the patch Jeffrey sent earlier
   this evening.

2. The funny thing about Jeffrey's patch was that although he put the
   warning in the 'misc' catehory, he had documented it as being in
   the 'regexp' category.  This patch fixes the code to agree with the
   documentation.

3. All the relevant tests pass.

4. The other funny thing about Jeffrey's patch was that it also added
   the warning if you used /c without /g in an s/// construction.  But
   I wonder whether even /cg is meaningful in an s/// construction.
   Perhaps the real warning should be "Use of /c modifier is
   meaningless with s///".  I left this alone.  


--- toke.c	2002/03/28 08:27:04	1.1
+++ toke.c	2002/03/28 08:28:44
@@ -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
@@ -6276,6 +6277,13 @@
 	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;
@@ -6322,6 +6330,13 @@
 	    pmflag(&pm->op_pmflags,*s++);
 	else
 	    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) {
--- pod/perldiag.pod	2002/03/28 08:27:02	1.1
+++ pod/perldiag.pod	2002/03/28 09:49:58
@@ -3977,6 +3977,12 @@
 (D deprecated) You are now encouraged to use the explicitly quoted form
 if you wish to use an empty line as the terminator of the here-document.
 
+=item Use of /c modifier is meaningless without /g
+
+(W regexp) You used the /c modifier with a regex operand, but didn't
+use the /g modifier.  Currently, /c is meaningful only when /g is
+used.  (This may change in the future.)
+
 =item Use of *glob{FILEHANDLE} is deprecated
 
 (D deprecated) You are now encouraged to use the shorter *glob{IO} form
--- pod/perldelta.pod	2002/03/28 09:45:18	1.1
+++ pod/perldelta.pod	2002/03/28 09:49:45
@@ -555,6 +555,16 @@
 The command-line options -s and -F are now recognized on the shebang
 (#!) line.
 
+=item *
+
+Use of the C</c> match modifier without C</g> also produces a new
+warning, 
+
+=item * 
+
+Use of the C</c> match modifier without an accompanying C</g> modifier
+elicits a new warning: C<Use of /c modifier is meaningless without /g>.
+
 =back
 
 =head1 Modules and Pragmata
--- t/lib/warnings/toke	2002/03/28 08:34:44	1.1
+++ t/lib/warnings/toke	2002/03/28 10:02:03
@@ -103,7 +103,9 @@
         $a =  0047777777777 ;
 
     dump() better written as CORE::dump()
-     
+
+    Use of /c modifier is meaningless without /g     
+
     Mandatory Warnings
     ------------------
     Use of "%s" without parentheses is ambiguous	[check_uni]
@@ -738,3 +740,22 @@
 "bar" =~ /\_/;
 EXPECT
 Unrecognized escape \q passed through at - line 4.
+########
+# toke.c
+# 20020328 mjd@plover.com at behest of jfriedl@yahoo.com
+use warnings 'regexp';
+"foo" =~ /foo/c;
+no warnings 'regexp';
+"foo" =~ /foo/c;
+EXPECT
+Use of /c modifier is meaningless without /g at - line 4.
+########
+# toke.c
+# 20020328 mjd@plover.com at behest of jfriedl@yahoo.com
+use warnings 'regexp';
+$_ = "ab" ; 
+s/ab/ab/c;
+no warnings 'regexp';
+s/ab/ab/c;
+EXPECT
+Use of /c modifier is meaningless without /g at - line 5.
0
mjd
3/28/2002 10:04:40 AM
perl.perl5.porters 47781 articles. 1 followers. Follow

3 Replies
548 Views

Similar Articles

[PageSpeed] 16

> +=item *
> +
> +Use of the C</c> match modifier without C</g> also produces a new
> +warning, 
> +
> +=item * 
> +
> +Use of the C</c> match modifier without an accompanying C</g> modifier
> +elicits a new warning: C<Use of /c modifier is meaningless without /g>.
> +


Someone else can fix this.  My union contract says I don't have to
work past 5 AM.

0
mjd
3/28/2002 10:07:12 AM
On Thu, Mar 28, 2002 at 05:04:40AM -0500, Mark-Jason Dominus wrote:
> 
> Jeffrey Friedl sais:
> > You had strong feelings about the category, so I thought I'd ask if
> > you'd like to do this....
> 
> So I did.
> 
> 1. This should be applied instead of the patch Jeffrey sent earlier
>    this evening.
> 
> 2. The funny thing about Jeffrey's patch was that although he put the
>    warning in the 'misc' catehory, he had documented it as being in
>    the 'regexp' category.  This patch fixes the code to agree with the
>    documentation.
> 
> 3. All the relevant tests pass.
> 
> 4. The other funny thing about Jeffrey's patch was that it also added
>    the warning if you used /c without /g in an s/// construction.  But
>    I wonder whether even /cg is meaningful in an s/// construction.
>    Perhaps the real warning should be "Use of /c modifier is
>    meaningless with s///".  I left this alone.  

Thanks, applied.

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen
0
jhi
3/28/2002 2:25:59 PM
On Thu, Mar 28, 2002 at 05:07:12AM -0500, Mark-Jason Dominus wrote:
> 
> > +=item *
> > +
> > +Use of the C</c> match modifier without C</g> also produces a new
> > +warning, 
> > +
> > +=item * 
> > +
> > +Use of the C</c> match modifier without an accompanying C</g> modifier
> > +elicits a new warning: C<Use of /c modifier is meaningless without /g>.
> > +
> 
> Someone else can fix this.  My union contract says I don't have to
> work past 5 AM.

:-)  I left the latter in.

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen
0
jhi
3/28/2002 2:26:23 PM
Reply:

Similar Artilces:

[PATCH] warning at use of /c modifier without /g modifier
It makes no sense to use /c without /g, right? As best I can tell, such a /c is ignored. The appended patch creates a warning: % perl -w -e '"x" =~ m/foo/c' Use of /c modifier is meaningless without /g at -e line 1. Jeffrey --- bleedperl.orig/pod/perldiag.pod Fri Mar 22 01:40:12 2002 +++ bleedperl/pod/perldiag.pod Tue Mar 26 15:40:11 2002 @@ -3874,6 +3874,12 @@ (W untie) A copy of the object returned from C<tie> (or C<tied>) was still valid when C<untie> was called. +=item Use of /c modifier is meaningless without /g + +(W...

[PATCH 5.7.3] warning at use of /c modifier with s///
--- pod/perldiag.pod 2002/03/28 14:35:25 1.1 +++ pod/perldiag.pod 2002/03/28 14:36:15 @@ -3983,6 +3983,11 @@ (D deprecated) You are now encouraged to use the explicitly quoted form if you wish to use an empty line as the terminator of the here-document. +=item Use of /c modifier is meaningless in s/// + +(W regexp) You used the /c modifier in a substitution. The /c +modifier is not presently meaningful in substitutions. + =item Use of /c modifier is meaningless without /g (W regexp) You used the /c modifier with a regex operand, but didn't --- pod/perldelta.pod 200...

[PATCH 5.7.3] gv.c: Use of inherited AUTOLOAD for non-method Foo::DESTROY()
The following patch shuts up the zillions of "Use of inherited AUTOLOAD for non-method Foo::DESTROY() is deprecated" messages that 5.7.3 has made its special feature. It fixes the symptoms rather than the problem though, and I'm not smart enough to figure out the latter :-(. I naively guessed that the call_sv((SV*)destructor, G_DISCARD|G_EVAL|G_KEEPERR) in sv_clear() just needed the G_METHOD flag set, but that caused core dumps all over the place. So I didn't go there.... Dave. --- gv.c- Thu Mar 7 14:33:18 2002 +++ gv.c Fri Mar 8 11:23:39 2002 @@ -482...

[PATCH pp_hot.c, toke.c, ...] /G regex modifier
This is a patch to implement /G. I got rid of the PMf_REVERSED flag, and replaced it with PMf_FAKEGLOBAL. Reverse-optimizations are a long way off, and we might want to take a different approach to signalling them (or not). It passes 'make test'. It works well, with and without the /c modifier. What else... oh, yeah, upon acceptance, I'll submit a documentation patch, and update my book accordingly. ;) -- Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ...

Modifying 3.5 web.config to support 3.5 Extension
My project is currently running with the framework 3.5 web.config. I am interested to use some of the new Ajax functionalities found in Extension 3.5 (ScriptManager EnableHistory attribute etc.).  I looked at the generic web.config files produced by Extension 3.5 which appear to syntactically differ quite a bit from the standard config file. I had difficulties porting my current web.config setup to Extension 3.5. Does anyone know what sections to change to make my config file support these new Ajax extensions?  TIA for any hints.   Hi,try this readme for information on ...

patch pwd.pl to qwell warning: Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/5.5.660/pwd.pl line 38.
I tried to submit this to perlbug, but haven't received confirmation Anyway, this patch matches the warning fix that was done to Cwd.pm ---------- Forwarded message ---------- Date: Sat, 26 Feb 2000 14:02:45 -0800 From: David Dyck <dcd@tc.fluke.com> To: perlbug@perl.com Subject: Use of uninitialized value in numeric eq (==) at /usr/local/lib/perl5/5.5.660/pwd.pl line 38. (with patch to pwd.pl) This is a bug report for perl from dcd@tc.fluke.com, generated with the help of perlbug 1.27 running under perl v5.5.660. ---------------------------------------...

[PATCH] use 5.010 is ugly; use 5.10.0 warns
------_=_NextPart_001_01C7F9E9.ED50A8CB Content-Type: multipart/alternative; boundary="----_=_NextPart_002_01C7F9E9.ED50A8CB" ------_=_NextPart_002_01C7F9E9.ED50A8CB Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I=20don't=20like=20the=20warning=20from=20C<use=205.10.0>=20and=20I=20don= 't=20like=20C<use=205.010>=20-=20it=20doesn't=20say=20what=20I=20mean.=0D= =0A=0D=0AI=20some=20of=20my=20modules=20I=20have=20used=20C<use=205.006;= =20use=205.8.x;>=20=0D=0Aas=20a=20portable=20way=...

How do I use MODIFY() to modify DW?
Hi guys & gals, In my PB6 for Win95 app I have a datawindow which retrieves data from a MSSQL Server 6.5 table. The tablename is TABLEA. Now I have an identical table with the name of TABLEB. How do I use MODIFY to change the DW to retrieve data from TABLEB instead of TABLEA? When I tried it using the dw.MODIFY("TABLE.SELECT ='" +ls_NewSqlStatement +"'") it returned an error "Error in Line 1, column 13". What am I doing wrong? Any help is appreciated, thanks! Try this: dw.Modify("DataWindow.Table.Select='<string containi...

[PATCH 5.7.3] Supporess spurious warnings for @+ and and @-
This also moves my earlier @F patch to a more appropriate location. All tests pass except for two that I think aren't related: ext/Storable/t/restrict.............FAILED at test 0 Bareword "Internals::hv_clear_placeholders" not allowed while "strict subs" in use at ../lib/Hash/Util.pm line 74. Compilation failed in require at ../ext/Storable/t/restrict.t line 24. BEGIN failed--compilation aborted at ../ext/Storable/t/restrict.t line 24. FAILED at test 0 lib/Hash/Util.......................FAILED at test 1 ...

[PATCH] dump.c: do not use sv_len_utf8 because it modified the scalar
--45Z9DzgjV8m4Oswq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline dump.c: do not use sv_len_utf8 because it modified the scalar. Add a test to Peek.t to check that dumping doesn't modifie anything, the test is still TODO because hashiteration in dump.c set the OOK flag. -- Gerard Goossen TTY Internet Solutions --45Z9DzgjV8m4Oswq Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=dump_utf8 commit 4c0c9dc0c54c5abc2ac2bd5df2c60bd9b0c56d29 Author: gerard <gerard@tty.nl> Date: Wed Jul 11 19:14:59 2007 +0200...

Importants ralentissements de FireFox 3.5.7 sous Windows 7 *** Major slowdowns in Firefox 3.5.7 on Windows 7
Name: Bernard Le Lann Email: bernarddotlelannatlapostedotnet Product: Firefox Summary: Importants ralentissements de FireFox 3.5.7 sous Windows 7 *** Major slowdowns in Firefox 3.5.7 on Windows 7 Comments: Depuis que j'utilise Windows 7 FireFox 3.5.7 est extrêmement lent, pour afficher une nouvelle page ou pour passer d'un onglet à un autre. ======================================= Since I use Windows 7 FireFox 3.5.7 is extremely slow to display a new page or move from one tab to another Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.9.1...

[PATCH] mark cannot be const because MEXTEND() modifies it, and tkGlue.c uses MEXTEND()
At least for the maint-5.8 branch the consting of MARK in dAXMARK should be reverted to prevent breaking Tk. tkGlue.c from Tk 804.027 uses MEXTEND() to assign to it. Cheers, -Jan --- XSUB.h.~1~ Mon Sep 26 20:55:02 2005 +++ XSUB.h Mon Sep 26 20:55:02 2005 @@ -102,7 +102,7 @@ #define dAXMARK \ I32 ax = POPMARK; \ - register SV ** const mark = PL_stack_base + ax++ + register SV **mark = PL_stack_base + ax++ #define dITEMS I32 items = SP - MARK End of Patch. Jan Dubois wrote: > At least for the maint-5.8 branch the consting of MARK in dAXMARK should &...

[PATCH 5.7.3] Suppress warnings about @F when -a flag supplied
--- perl.c 2002/04/14 22:50:18 1.1 +++ perl.c 2002/04/15 03:40:41 @@ -3472,6 +3472,10 @@ (void)sv_utf8_decode(sv); } } + + if (PL_minus_a) { + (void) get_av("main::F", TRUE); + } } #ifdef HAS_PROCSELFEXE --- t/lib/warnings/toke 2002/04/15 03:40:30 1.1 +++ t/lib/warnings/toke 2002/04/15 04:02:36 @@ -744,7 +744,7 @@ Unrecognized escape \q passed through at - line 4. ######## # toke.c -# 20020328 mjd@plover.com at behest of jfriedl@yahoo.com +# 20020328 mjd-perl-patch+plover.com at behest of jfriedl@yahoo.com use warnings 'regexp'...

[PATCH 5.7.3 universal.c] problem with ex-tainted scalars. Possible more general...
Hi! There is the code illustrated this problem: ------------------ test.pl -------------- #!/usr/bin/perl -w use strict; my ($func, $mod) = @ARGV; # $func and $mod are tainted now $ARGV[0] =~ /^([a-zA-Z0-9_]+)$/; $func = $1; $ARGV[1] =~ /^([a-zA-Z0-9_:]+)$/; $mod = $1; # $func and $mod are not tainted, but still GMAGIC # and has no SVf_POK flag print $mod->can($func); -------------------------------------- $ perl test.pl param CGI CODE(0x80d2408) $ perl -T test.pl param CGI Use of uninitialized value in print at test.pl line 12...

Web resources about - [PATCH 5.7.3] warning at use of /c modifier without /g modifier - perl.perl5.porters

Modifier letter right half ring - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Emoji Voice Modifier for Happy Birthday Video & Greetings on the App Store
Read reviews, compare customer ratings, see screenshots, and learn more about Emoji Voice Modifier for Happy Birthday Video & Greetings. Download ...

Syphon Filter Combat Modifier - Flickr - Photo Sharing!
blog.us.playstation.com/2008/06/06/welcome-new-syphon-fil...

Mario Kart DS Action Replay Codes: Music Modifier - YouTube
This code will replace one song with another. 1xxxxxxx 00000yyy xxxxxxx = Song to replace yyy = Replacement song USA: Title Screen: 21DB4A4 - ...

Rude finger, skin tone modifiers coming to Windows 10 emoji
Among a host of other new additions and changes, an image of the middle (rude) finger will be coming to Windows when the next iteration of the ...

[Pop The Champagne] Unicode Standard 8.0 Brings 36 New Emojis And 5 Skin Tone Modifiers
It seems that I'm not the only one who has always wanted to send a zipped-mouth, a nerd face, an eye-rolling expression, a sign of the horns, ...

Reduce the size of your music files with MP3 Quality Modifier
... or MP3 player could now be a challenge. You could just try to be a little more selective in what you transfer, of course, but MP3 Quality Modifier ...

"How would you feel if your 10-year prison sentence depended on a dangling modifier?"
... Reading that description, it's quite clear that Lockhart should win and that Professor Noah Feldman doesn't know the meaning of "dangling modifier." ...

Strategic Defaulters vs. Strategic Modifiers
In FHFA acting director Ed DeMarco's speech on Tuesday, he discussed the risk of "strategic modifiers". Felix Salmon and I have been discussing ...

How to customize modifier keys in OS X
With OS X you can use a PC keyboard and still use the same familiar layout of modifier keys that is the default for Apple's systems.

Resources last updated: 1/21/2016 12:56:32 AM