File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,33 @@ EXPECT
375
375
Possible attempt to escape whitespace in qw() list at - line 3.
376
376
########
377
377
# 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
+ ########
394
+ # toke.c
395
+ use warnings 'qw';
396
+ @a = qw( \\ );
397
+ EXPECT
398
+ ########
399
+ # toke.c
400
+ use warnings 'qw';
401
+ @a = qw( foo bar \\ baz );
402
+ EXPECT
403
+ ########
404
+ # toke.c
378
405
use warnings 'syntax' ;
379
406
print ("");
380
407
print ("") and $x = 1;
Original file line number Diff line number Diff line change @@ -5820,13 +5820,14 @@ yyl_qw(pTHX_ char *s, STRLEN len)
5820
5820
int warned_comment = warned_comma ;
5821
5821
int warned_escape = warned_comma ;
5822
5822
char * d = SvPV_force (PL_lex_stuff , len );
5823
+ const STRLEN orig_len = len ;
5823
5824
while (len ) {
5824
5825
for (; isSPACE (* d ) && len ; -- len , ++ d )
5825
5826
/**/ ;
5826
5827
if (len ) {
5827
5828
SV * sv ;
5828
5829
const char * b = d ;
5829
- if (!warned_comma || !warned_comment ) {
5830
+ if (!warned_comma || !warned_comment || ! warned_escape ) {
5830
5831
for (; !isSPACE (* d ) && len ; -- len , ++ d ) {
5831
5832
if (!warned_comma && * d == ',' ) {
5832
5833
warner (packWARN (WARN_QW ),
@@ -5838,7 +5839,8 @@ yyl_qw(pTHX_ char *s, STRLEN len)
5838
5839
"Possible attempt to put comments in qw() list" );
5839
5840
++ warned_comment ;
5840
5841
}
5841
- else if (!warned_escape && * d == '\\' && len > 1 && isSPACE (* (d + 1 )) ) {
5842
+ else if (!warned_escape && * d == '\\' && len > 1 && isSPACE (* (d + 1 ))
5843
+ && (len == orig_len || * (d - 1 ) != '\\' )) {
5842
5844
warner (packWARN (WARN_QW ),
5843
5845
"Possible attempt to escape whitespace in qw() list" );
5844
5846
++ warned_escape ;
You can’t perform that action at this time.
0 commit comments