File tree Expand file tree Collapse file tree 2 files changed +43
-5
lines changed Expand file tree Collapse file tree 2 files changed +43
-5
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,39 @@ EXPECT
375375Possible attempt to escape whitespace in qw() list at - line 3.
376376########
377377# toke.c
378+ use warnings 'qw';
379+ @a = qw( foo bar \ baz );
380+ EXPECT
381+ Possible attempt to escape whitespace in qw() list at - line 3.
382+ ########
383+ # toke.c
384+ use warnings 'qw';
385+ @a = qw(\ );
386+ EXPECT
387+ Possible attempt to escape whitespace in qw() list at - line 3.
388+ ########
389+ # toke.c
390+ use warnings 'qw';
391+ @a = qw(\\\ )
392+ EXPECT
393+ Possible attempt to escape whitespace in qw() list at - line 3.
394+ ########
395+ # toke.c
396+ use warnings 'qw';
397+ @a = qw(\\ );
398+ EXPECT
399+ ########
400+ # toke.c
401+ use warnings 'qw';
402+ @a = qw( \\ );
403+ EXPECT
404+ ########
405+ # toke.c
406+ use warnings 'qw';
407+ @a = qw( foo bar \\ baz );
408+ EXPECT
409+ ########
410+ # toke.c
378411use warnings 'syntax' ;
379412print ("");
380413print ("") and $x = 1;
Original file line number Diff line number Diff line change @@ -5826,7 +5826,7 @@ yyl_qw(pTHX_ char *s, STRLEN len)
58265826 if (len ) {
58275827 SV * sv ;
58285828 const char * b = d ;
5829- if (!warned_comma || !warned_comment ) {
5829+ if (!warned_comma || !warned_comment || ! warned_escape ) {
58305830 for (; !isSPACE (* d ) && len ; -- len , ++ d ) {
58315831 if (!warned_comma && * d == ',' ) {
58325832 warner (packWARN (WARN_QW ),
@@ -5838,10 +5838,15 @@ yyl_qw(pTHX_ char *s, STRLEN len)
58385838 "Possible attempt to put comments in qw() list" );
58395839 ++ warned_comment ;
58405840 }
5841- else if (!warned_escape && * d == '\\' && len > 1 && isSPACE (* (d + 1 )) ) {
5842- warner (packWARN (WARN_QW ),
5843- "Possible attempt to escape whitespace in qw() list" );
5844- ++ warned_escape ;
5841+ else if (!warned_escape && * d == '\\' && len > 1 ) {
5842+ if (* (d + 1 ) == '\\' ) {
5843+ -- len , ++ d ;
5844+ }
5845+ else if (isSPACE (* (d + 1 ))) {
5846+ warner (packWARN (WARN_QW ),
5847+ "Possible attempt to escape whitespace in qw() list" );
5848+ ++ warned_escape ;
5849+ }
58455850 }
58465851 }
58475852 }
You can’t perform that action at this time.
0 commit comments