Commit | Line | Data |
599cee73 |
1 | op.c AOK |
2 | |
599cee73 |
3 | Found = in conditional, should be == |
4 | 1 if $a = 1 ; |
5 | |
6 | Use of implicit split to @_ is deprecated |
7 | split ; |
8 | |
9 | Use of implicit split to @_ is deprecated |
10 | $a = split ; |
11 | |
12 | Useless use of time in void context |
13 | Useless use of a variable in void context |
14 | Useless use of a constant in void context |
15 | time ; |
16 | $a ; |
17 | "abc" |
18 | |
a801c63c |
19 | Useless use of sort in scalar context |
20 | my $x = sort (2,1,3); |
21 | |
599cee73 |
22 | Applying %s to %s will act on scalar(%s) |
23 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; |
24 | @a =~ /abc/ ; |
25 | @a =~ s/a/b/ ; |
26 | @a =~ tr/a/b/ ; |
27 | @$b =~ /abc/ ; |
28 | @$b =~ s/a/b/ ; |
29 | @$b =~ tr/a/b/ ; |
30 | %a =~ /abc/ ; |
31 | %a =~ s/a/b/ ; |
32 | %a =~ tr/a/b/ ; |
33 | %$c =~ /abc/ ; |
34 | %$c =~ s/a/b/ ; |
35 | %$c =~ tr/a/b/ ; |
36 | |
37 | |
df5b6949 |
38 | Parentheses missing around "my" list at -e line 1. |
599cee73 |
39 | my $a, $b = (1,2); |
40 | |
df5b6949 |
41 | Parentheses missing around "local" list at -e line 1. |
599cee73 |
42 | local $a, $b = (1,2); |
43 | |
34d09196 |
44 | Bareword found in conditional at -e line 1. |
e476b1b5 |
45 | use warnings 'bareword'; my $x = print(ABC || 1); |
599cee73 |
46 | |
47 | Value of %s may be \"0\"; use \"defined\" |
48 | $x = 1 if $x = <FH> ; |
49 | $x = 1 while $x = <FH> ; |
50 | |
51 | Subroutine fred redefined at -e line 1. |
52 | sub fred{1;} sub fred{1;} |
53 | |
54 | Constant subroutine %s redefined |
55 | sub fred() {1;} sub fred() {1;} |
56 | |
57 | Format FRED redefined at /tmp/x line 5. |
58 | format FRED = |
59 | . |
60 | format FRED = |
61 | . |
62 | |
63 | Array @%s missing the @ in argument %d of %s() |
64 | push fred ; |
65 | |
66 | Hash %%%s missing the %% in argument %d of %s() |
67 | keys joe ; |
68 | |
69 | Statement unlikely to be reached |
cc507455 |
70 | (Maybe you meant system() when you said exec()? |
599cee73 |
71 | exec "true" ; my $a |
72 | |
f10b0346 |
73 | defined(@array) is deprecated |
cc507455 |
74 | (Maybe you should just omit the defined()?) |
69794302 |
75 | my @a ; defined @a ; |
76 | defined (@a = (1,2,3)) ; |
77 | |
f10b0346 |
78 | defined(%hash) is deprecated |
cc507455 |
79 | (Maybe you should just omit the defined()?) |
69794302 |
80 | my %h ; defined %h ; |
eb6e2d6f |
81 | |
82 | /---/ should probably be written as "---" |
83 | join(/---/, @foo); |
599cee73 |
84 | |
767a6a26 |
85 | %s() called too early to check prototype [Perl_peep] |
86 | fred() ; sub fred ($$) {} |
87 | |
88 | |
3b434eb1 |
89 | Package `%s' not found (did you use the incorrect case?) |
90 | |
f34840d8 |
91 | Use of /g modifier is meaningless in split |
92 | |
276b2a0c |
93 | Possible precedence problem on bitwise %c operator [Perl_ck_bitop] |
94 | |
0453d815 |
95 | Mandatory Warnings |
96 | ------------------ |
97 | Prototype mismatch: [cv_ckproto] |
98 | sub fred() ; |
99 | sub fred($) {} |
100 | |
0453d815 |
101 | Runaway prototype [newSUB] TODO |
102 | oops: oopsAV [oopsAV] TODO |
103 | oops: oopsHV [oopsHV] TODO |
104 | |
599cee73 |
105 | __END__ |
106 | # op.c |
4438c4b7 |
107 | use warnings 'syntax' ; |
599cee73 |
108 | 1 if $a = 1 ; |
4438c4b7 |
109 | no warnings 'syntax' ; |
0453d815 |
110 | 1 if $a = 1 ; |
599cee73 |
111 | EXPECT |
112 | Found = in conditional, should be == at - line 3. |
113 | ######## |
114 | # op.c |
4438c4b7 |
115 | use warnings 'deprecated' ; |
599cee73 |
116 | split ; |
4438c4b7 |
117 | no warnings 'deprecated' ; |
0453d815 |
118 | split ; |
599cee73 |
119 | EXPECT |
120 | Use of implicit split to @_ is deprecated at - line 3. |
121 | ######## |
122 | # op.c |
4438c4b7 |
123 | use warnings 'deprecated' ; |
599cee73 |
124 | $a = split ; |
4438c4b7 |
125 | no warnings 'deprecated' ; |
0453d815 |
126 | $a = split ; |
599cee73 |
127 | EXPECT |
128 | Use of implicit split to @_ is deprecated at - line 3. |
129 | ######## |
130 | # op.c |
a1063b2d |
131 | use warnings 'deprecated'; |
132 | my (@foo, %foo); |
133 | %main::foo->{"bar"}; |
134 | %foo->{"bar"}; |
135 | @main::foo->[23]; |
136 | @foo->[23]; |
137 | $main::foo = {}; %$main::foo->{"bar"}; |
138 | $foo = {}; %$foo->{"bar"}; |
139 | $main::foo = []; @$main::foo->[34]; |
140 | $foo = []; @$foo->[34]; |
141 | no warnings 'deprecated'; |
142 | %main::foo->{"bar"}; |
143 | %foo->{"bar"}; |
144 | @main::foo->[23]; |
145 | @foo->[23]; |
146 | $main::foo = {}; %$main::foo->{"bar"}; |
147 | $foo = {}; %$foo->{"bar"}; |
148 | $main::foo = []; @$main::foo->[34]; |
149 | $foo = []; @$foo->[34]; |
150 | EXPECT |
151 | Using a hash as a reference is deprecated at - line 4. |
152 | Using a hash as a reference is deprecated at - line 5. |
153 | Using an array as a reference is deprecated at - line 6. |
154 | Using an array as a reference is deprecated at - line 7. |
155 | Using a hash as a reference is deprecated at - line 8. |
156 | Using a hash as a reference is deprecated at - line 9. |
157 | Using an array as a reference is deprecated at - line 10. |
158 | Using an array as a reference is deprecated at - line 11. |
159 | ######## |
160 | # op.c |
4438c4b7 |
161 | use warnings 'void' ; close STDIN ; |
599cee73 |
162 | 1 x 3 ; # OP_REPEAT |
163 | # OP_GVSV |
164 | wantarray ; # OP_WANTARRAY |
165 | # OP_GV |
166 | # OP_PADSV |
167 | # OP_PADAV |
168 | # OP_PADHV |
169 | # OP_PADANY |
170 | # OP_AV2ARYLEN |
171 | ref ; # OP_REF |
172 | \@a ; # OP_REFGEN |
173 | \$a ; # OP_SREFGEN |
174 | defined $a ; # OP_DEFINED |
175 | hex $a ; # OP_HEX |
176 | oct $a ; # OP_OCT |
177 | length $a ; # OP_LENGTH |
178 | substr $a,1 ; # OP_SUBSTR |
179 | vec $a,1,2 ; # OP_VEC |
180 | index $a,1,2 ; # OP_INDEX |
181 | rindex $a,1,2 ; # OP_RINDEX |
182 | sprintf $a ; # OP_SPRINTF |
183 | $a[0] ; # OP_AELEM |
184 | # OP_AELEMFAST |
185 | @a[0] ; # OP_ASLICE |
186 | #values %a ; # OP_VALUES |
187 | #keys %a ; # OP_KEYS |
188 | $a{0} ; # OP_HELEM |
189 | @a{0} ; # OP_HSLICE |
190 | unpack "a", "a" ; # OP_UNPACK |
191 | pack $a,"" ; # OP_PACK |
192 | join "" ; # OP_JOIN |
193 | (@a)[0,1] ; # OP_LSLICE |
194 | # OP_ANONLIST |
195 | # OP_ANONHASH |
196 | sort(1,2) ; # OP_SORT |
197 | reverse(1,2) ; # OP_REVERSE |
198 | # OP_RANGE |
199 | # OP_FLIP |
200 | (1 ..2) ; # OP_FLOP |
201 | caller ; # OP_CALLER |
202 | fileno STDIN ; # OP_FILENO |
203 | eof STDIN ; # OP_EOF |
204 | tell STDIN ; # OP_TELL |
205 | readlink 1; # OP_READLINK |
206 | time ; # OP_TIME |
207 | localtime ; # OP_LOCALTIME |
208 | gmtime ; # OP_GMTIME |
dfe13c55 |
209 | eval { getgrnam 1 }; # OP_GGRNAM |
210 | eval { getgrgid 1 }; # OP_GGRGID |
211 | eval { getpwnam 1 }; # OP_GPWNAM |
212 | eval { getpwuid 1 }; # OP_GPWUID |
78e1b766 |
213 | prototype "foo"; # OP_PROTOTYPE |
74295f0b |
214 | $a ~~ $b; # OP_SMARTMATCH |
215 | $a <=> $b; # OP_NCMP |
599cee73 |
216 | EXPECT |
42d38218 |
217 | Useless use of repeat (x) in void context at - line 3. |
599cee73 |
218 | Useless use of wantarray in void context at - line 5. |
219 | Useless use of reference-type operator in void context at - line 12. |
220 | Useless use of reference constructor in void context at - line 13. |
d6c467eb |
221 | Useless use of single ref constructor in void context at - line 14. |
599cee73 |
222 | Useless use of defined operator in void context at - line 15. |
223 | Useless use of hex in void context at - line 16. |
224 | Useless use of oct in void context at - line 17. |
225 | Useless use of length in void context at - line 18. |
226 | Useless use of substr in void context at - line 19. |
227 | Useless use of vec in void context at - line 20. |
228 | Useless use of index in void context at - line 21. |
229 | Useless use of rindex in void context at - line 22. |
230 | Useless use of sprintf in void context at - line 23. |
231 | Useless use of array element in void context at - line 24. |
232 | Useless use of array slice in void context at - line 26. |
f1612b5c |
233 | Useless use of hash element in void context at - line 29. |
599cee73 |
234 | Useless use of hash slice in void context at - line 30. |
235 | Useless use of unpack in void context at - line 31. |
236 | Useless use of pack in void context at - line 32. |
297b36dc |
237 | Useless use of join or string in void context at - line 33. |
599cee73 |
238 | Useless use of list slice in void context at - line 34. |
239 | Useless use of sort in void context at - line 37. |
240 | Useless use of reverse in void context at - line 38. |
241 | Useless use of range (or flop) in void context at - line 41. |
242 | Useless use of caller in void context at - line 42. |
243 | Useless use of fileno in void context at - line 43. |
244 | Useless use of eof in void context at - line 44. |
245 | Useless use of tell in void context at - line 45. |
246 | Useless use of readlink in void context at - line 46. |
247 | Useless use of time in void context at - line 47. |
248 | Useless use of localtime in void context at - line 48. |
249 | Useless use of gmtime in void context at - line 49. |
250 | Useless use of getgrnam in void context at - line 50. |
251 | Useless use of getgrgid in void context at - line 51. |
252 | Useless use of getpwnam in void context at - line 52. |
253 | Useless use of getpwuid in void context at - line 53. |
78e1b766 |
254 | Useless use of subroutine prototype in void context at - line 54. |
f5df4782 |
255 | Useless use of smart match in void context at - line 55. |
256 | Useless use of numeric comparison (<=>) in void context at - line 56. |
599cee73 |
257 | ######## |
258 | # op.c |
a801c63c |
259 | use warnings 'void' ; close STDIN ; |
260 | my $x = sort (2,1,3); |
261 | no warnings 'void' ; |
262 | $x = sort (2,1,3); |
263 | EXPECT |
264 | Useless use of sort in scalar context at - line 3. |
265 | ######## |
266 | # op.c |
4438c4b7 |
267 | no warnings 'void' ; close STDIN ; |
0453d815 |
268 | 1 x 3 ; # OP_REPEAT |
269 | # OP_GVSV |
270 | wantarray ; # OP_WANTARRAY |
271 | # OP_GV |
272 | # OP_PADSV |
273 | # OP_PADAV |
274 | # OP_PADHV |
275 | # OP_PADANY |
276 | # OP_AV2ARYLEN |
277 | ref ; # OP_REF |
278 | \@a ; # OP_REFGEN |
279 | \$a ; # OP_SREFGEN |
280 | defined $a ; # OP_DEFINED |
281 | hex $a ; # OP_HEX |
282 | oct $a ; # OP_OCT |
283 | length $a ; # OP_LENGTH |
284 | substr $a,1 ; # OP_SUBSTR |
285 | vec $a,1,2 ; # OP_VEC |
286 | index $a,1,2 ; # OP_INDEX |
287 | rindex $a,1,2 ; # OP_RINDEX |
288 | sprintf $a ; # OP_SPRINTF |
289 | $a[0] ; # OP_AELEM |
290 | # OP_AELEMFAST |
291 | @a[0] ; # OP_ASLICE |
292 | #values %a ; # OP_VALUES |
293 | #keys %a ; # OP_KEYS |
294 | $a{0} ; # OP_HELEM |
295 | @a{0} ; # OP_HSLICE |
296 | unpack "a", "a" ; # OP_UNPACK |
297 | pack $a,"" ; # OP_PACK |
298 | join "" ; # OP_JOIN |
299 | (@a)[0,1] ; # OP_LSLICE |
300 | # OP_ANONLIST |
301 | # OP_ANONHASH |
302 | sort(1,2) ; # OP_SORT |
303 | reverse(1,2) ; # OP_REVERSE |
304 | # OP_RANGE |
305 | # OP_FLIP |
306 | (1 ..2) ; # OP_FLOP |
307 | caller ; # OP_CALLER |
308 | fileno STDIN ; # OP_FILENO |
309 | eof STDIN ; # OP_EOF |
310 | tell STDIN ; # OP_TELL |
311 | readlink 1; # OP_READLINK |
312 | time ; # OP_TIME |
313 | localtime ; # OP_LOCALTIME |
314 | gmtime ; # OP_GMTIME |
315 | eval { getgrnam 1 }; # OP_GGRNAM |
316 | eval { getgrgid 1 }; # OP_GGRGID |
317 | eval { getpwnam 1 }; # OP_GPWNAM |
318 | eval { getpwuid 1 }; # OP_GPWUID |
78e1b766 |
319 | prototype "foo"; # OP_PROTOTYPE |
0453d815 |
320 | EXPECT |
321 | ######## |
322 | # op.c |
4438c4b7 |
323 | use warnings 'void' ; |
68c73484 |
324 | for (@{[0]}) { "$_" } # check warning isn't duplicated |
4438c4b7 |
325 | no warnings 'void' ; |
0453d815 |
326 | for (@{[0]}) { "$_" } # check warning isn't duplicated |
68c73484 |
327 | EXPECT |
328 | Useless use of string in void context at - line 3. |
329 | ######## |
330 | # op.c |
4438c4b7 |
331 | use warnings 'void' ; |
599cee73 |
332 | use Config ; |
333 | BEGIN { |
334 | if ( ! $Config{d_telldir}) { |
335 | print <<EOM ; |
336 | SKIPPED |
337 | # telldir not present |
338 | EOM |
339 | exit |
340 | } |
341 | } |
342 | telldir 1 ; # OP_TELLDIR |
4438c4b7 |
343 | no warnings 'void' ; |
0453d815 |
344 | telldir 1 ; # OP_TELLDIR |
599cee73 |
345 | EXPECT |
346 | Useless use of telldir in void context at - line 13. |
347 | ######## |
348 | # op.c |
4438c4b7 |
349 | use warnings 'void' ; |
599cee73 |
350 | use Config ; |
351 | BEGIN { |
352 | if ( ! $Config{d_getppid}) { |
353 | print <<EOM ; |
354 | SKIPPED |
355 | # getppid not present |
356 | EOM |
357 | exit |
358 | } |
359 | } |
360 | getppid ; # OP_GETPPID |
4438c4b7 |
361 | no warnings 'void' ; |
0453d815 |
362 | getppid ; # OP_GETPPID |
599cee73 |
363 | EXPECT |
364 | Useless use of getppid in void context at - line 13. |
365 | ######## |
366 | # op.c |
4438c4b7 |
367 | use warnings 'void' ; |
599cee73 |
368 | use Config ; |
369 | BEGIN { |
370 | if ( ! $Config{d_getpgrp}) { |
371 | print <<EOM ; |
372 | SKIPPED |
373 | # getpgrp not present |
374 | EOM |
375 | exit |
376 | } |
377 | } |
378 | getpgrp ; # OP_GETPGRP |
4438c4b7 |
379 | no warnings 'void' ; |
0453d815 |
380 | getpgrp ; # OP_GETPGRP |
599cee73 |
381 | EXPECT |
382 | Useless use of getpgrp in void context at - line 13. |
383 | ######## |
384 | # op.c |
4438c4b7 |
385 | use warnings 'void' ; |
599cee73 |
386 | use Config ; |
387 | BEGIN { |
388 | if ( ! $Config{d_times}) { |
389 | print <<EOM ; |
390 | SKIPPED |
391 | # times not present |
392 | EOM |
393 | exit |
394 | } |
395 | } |
396 | times ; # OP_TMS |
4438c4b7 |
397 | no warnings 'void' ; |
0453d815 |
398 | times ; # OP_TMS |
599cee73 |
399 | EXPECT |
400 | Useless use of times in void context at - line 13. |
401 | ######## |
402 | # op.c |
4438c4b7 |
403 | use warnings 'void' ; |
599cee73 |
404 | use Config ; |
405 | BEGIN { |
e96326af |
406 | if ( ! $Config{d_getprior} or $^O eq 'os2') { # Locks before fixpak22 |
599cee73 |
407 | print <<EOM ; |
408 | SKIPPED |
409 | # getpriority not present |
410 | EOM |
411 | exit |
412 | } |
413 | } |
414 | getpriority 1,2; # OP_GETPRIORITY |
4438c4b7 |
415 | no warnings 'void' ; |
0453d815 |
416 | getpriority 1,2; # OP_GETPRIORITY |
599cee73 |
417 | EXPECT |
418 | Useless use of getpriority in void context at - line 13. |
419 | ######## |
420 | # op.c |
4438c4b7 |
421 | use warnings 'void' ; |
599cee73 |
422 | use Config ; |
423 | BEGIN { |
424 | if ( ! $Config{d_getlogin}) { |
425 | print <<EOM ; |
426 | SKIPPED |
427 | # getlogin not present |
428 | EOM |
429 | exit |
430 | } |
431 | } |
432 | getlogin ; # OP_GETLOGIN |
4438c4b7 |
433 | no warnings 'void' ; |
0453d815 |
434 | getlogin ; # OP_GETLOGIN |
599cee73 |
435 | EXPECT |
436 | Useless use of getlogin in void context at - line 13. |
437 | ######## |
438 | # op.c |
4438c4b7 |
439 | use warnings 'void' ; |
599cee73 |
440 | use Config ; BEGIN { |
441 | if ( ! $Config{d_socket}) { |
442 | print <<EOM ; |
443 | SKIPPED |
444 | # getsockname not present |
445 | # getpeername not present |
446 | # gethostbyname not present |
447 | # gethostbyaddr not present |
448 | # gethostent not present |
449 | # getnetbyname not present |
450 | # getnetbyaddr not present |
451 | # getnetent not present |
452 | # getprotobyname not present |
453 | # getprotobynumber not present |
454 | # getprotoent not present |
455 | # getservbyname not present |
456 | # getservbyport not present |
457 | # getservent not present |
458 | EOM |
459 | exit |
460 | } } |
461 | getsockname STDIN ; # OP_GETSOCKNAME |
462 | getpeername STDIN ; # OP_GETPEERNAME |
463 | gethostbyname 1 ; # OP_GHBYNAME |
464 | gethostbyaddr 1,2; # OP_GHBYADDR |
465 | gethostent ; # OP_GHOSTENT |
466 | getnetbyname 1 ; # OP_GNBYNAME |
467 | getnetbyaddr 1,2 ; # OP_GNBYADDR |
468 | getnetent ; # OP_GNETENT |
469 | getprotobyname 1; # OP_GPBYNAME |
470 | getprotobynumber 1; # OP_GPBYNUMBER |
471 | getprotoent ; # OP_GPROTOENT |
472 | getservbyname 1,2; # OP_GSBYNAME |
473 | getservbyport 1,2; # OP_GSBYPORT |
474 | getservent ; # OP_GSERVENT |
0453d815 |
475 | |
4438c4b7 |
476 | no warnings 'void' ; |
0453d815 |
477 | getsockname STDIN ; # OP_GETSOCKNAME |
478 | getpeername STDIN ; # OP_GETPEERNAME |
479 | gethostbyname 1 ; # OP_GHBYNAME |
480 | gethostbyaddr 1,2; # OP_GHBYADDR |
481 | gethostent ; # OP_GHOSTENT |
482 | getnetbyname 1 ; # OP_GNBYNAME |
483 | getnetbyaddr 1,2 ; # OP_GNBYADDR |
484 | getnetent ; # OP_GNETENT |
485 | getprotobyname 1; # OP_GPBYNAME |
486 | getprotobynumber 1; # OP_GPBYNUMBER |
487 | getprotoent ; # OP_GPROTOENT |
488 | getservbyname 1,2; # OP_GSBYNAME |
489 | getservbyport 1,2; # OP_GSBYPORT |
490 | getservent ; # OP_GSERVENT |
dfe13c55 |
491 | INIT { |
492 | # some functions may not be there, so we exit without running |
493 | exit; |
494 | } |
599cee73 |
495 | EXPECT |
496 | Useless use of getsockname in void context at - line 24. |
497 | Useless use of getpeername in void context at - line 25. |
498 | Useless use of gethostbyname in void context at - line 26. |
499 | Useless use of gethostbyaddr in void context at - line 27. |
500 | Useless use of gethostent in void context at - line 28. |
501 | Useless use of getnetbyname in void context at - line 29. |
502 | Useless use of getnetbyaddr in void context at - line 30. |
503 | Useless use of getnetent in void context at - line 31. |
504 | Useless use of getprotobyname in void context at - line 32. |
505 | Useless use of getprotobynumber in void context at - line 33. |
506 | Useless use of getprotoent in void context at - line 34. |
507 | Useless use of getservbyname in void context at - line 35. |
508 | Useless use of getservbyport in void context at - line 36. |
509 | Useless use of getservent in void context at - line 37. |
510 | ######## |
511 | # op.c |
4438c4b7 |
512 | use warnings 'void' ; |
599cee73 |
513 | *a ; # OP_RV2GV |
514 | $a ; # OP_RV2SV |
515 | @a ; # OP_RV2AV |
516 | %a ; # OP_RV2HV |
4438c4b7 |
517 | no warnings 'void' ; |
0453d815 |
518 | *a ; # OP_RV2GV |
519 | $a ; # OP_RV2SV |
520 | @a ; # OP_RV2AV |
521 | %a ; # OP_RV2HV |
599cee73 |
522 | EXPECT |
523 | Useless use of a variable in void context at - line 3. |
524 | Useless use of a variable in void context at - line 4. |
525 | Useless use of a variable in void context at - line 5. |
526 | Useless use of a variable in void context at - line 6. |
527 | ######## |
528 | # op.c |
4438c4b7 |
529 | use warnings 'void' ; |
599cee73 |
530 | "abc"; # OP_CONST |
531 | 7 ; # OP_CONST |
86f9315f |
532 | "x" . "y"; # optimized to OP_CONST |
533 | 2 + 2; # optimized to OP_CONST |
e7fec78e |
534 | use constant U => undef; |
fa01e093 |
535 | U; |
536 | 5 || print "bad\n"; # test OPpCONST_SHORTCIRCUIT |
e7fec78e |
537 | print "boo\n" if U; # test OPpCONST_SHORTCIRCUIT |
2e0ae2d3 |
538 | $[ = 2; # should not warn |
4438c4b7 |
539 | no warnings 'void' ; |
0453d815 |
540 | "abc"; # OP_CONST |
541 | 7 ; # OP_CONST |
86f9315f |
542 | "x" . "y"; # optimized to OP_CONST |
543 | 2 + 2; # optimized to OP_CONST |
599cee73 |
544 | EXPECT |
86f9315f |
545 | Useless use of a constant (abc) in void context at - line 3. |
546 | Useless use of a constant (7) in void context at - line 4. |
547 | Useless use of a constant (xy) in void context at - line 5. |
548 | Useless use of a constant (4) in void context at - line 6. |
fa01e093 |
549 | Useless use of a constant (undef) in void context at - line 8. |
599cee73 |
550 | ######## |
551 | # op.c |
7f01dc7a |
552 | # |
e476b1b5 |
553 | use warnings 'misc' ; |
b08e453b |
554 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;my $d = 'test'; |
599cee73 |
555 | @a =~ /abc/ ; |
556 | @a =~ s/a/b/ ; |
557 | @a =~ tr/a/b/ ; |
558 | @$b =~ /abc/ ; |
559 | @$b =~ s/a/b/ ; |
560 | @$b =~ tr/a/b/ ; |
561 | %a =~ /abc/ ; |
562 | %a =~ s/a/b/ ; |
563 | %a =~ tr/a/b/ ; |
564 | %$c =~ /abc/ ; |
565 | %$c =~ s/a/b/ ; |
566 | %$c =~ tr/a/b/ ; |
b08e453b |
567 | $d =~ tr/a/b/d ; |
568 | $d =~ tr/a/bc/; |
0453d815 |
569 | { |
e476b1b5 |
570 | no warnings 'misc' ; |
b08e453b |
571 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; my $d = 'test'; |
0453d815 |
572 | @a =~ /abc/ ; |
573 | @a =~ s/a/b/ ; |
574 | @a =~ tr/a/b/ ; |
575 | @$b =~ /abc/ ; |
576 | @$b =~ s/a/b/ ; |
577 | @$b =~ tr/a/b/ ; |
578 | %a =~ /abc/ ; |
579 | %a =~ s/a/b/ ; |
580 | %a =~ tr/a/b/ ; |
581 | %$c =~ /abc/ ; |
582 | %$c =~ s/a/b/ ; |
583 | %$c =~ tr/a/b/ ; |
b08e453b |
584 | $d =~ tr/a/b/d ; |
585 | $d =~ tr/a/bc/ ; |
0453d815 |
586 | } |
599cee73 |
587 | EXPECT |
42d38218 |
588 | Applying pattern match (m//) to @array will act on scalar(@array) at - line 5. |
589 | Applying substitution (s///) to @array will act on scalar(@array) at - line 6. |
f1612b5c |
590 | Applying transliteration (tr///) to @array will act on scalar(@array) at - line 7. |
42d38218 |
591 | Applying pattern match (m//) to @array will act on scalar(@array) at - line 8. |
592 | Applying substitution (s///) to @array will act on scalar(@array) at - line 9. |
f1612b5c |
593 | Applying transliteration (tr///) to @array will act on scalar(@array) at - line 10. |
42d38218 |
594 | Applying pattern match (m//) to %hash will act on scalar(%hash) at - line 11. |
595 | Applying substitution (s///) to %hash will act on scalar(%hash) at - line 12. |
f1612b5c |
596 | Applying transliteration (tr///) to %hash will act on scalar(%hash) at - line 13. |
42d38218 |
597 | Applying pattern match (m//) to %hash will act on scalar(%hash) at - line 14. |
598 | Applying substitution (s///) to %hash will act on scalar(%hash) at - line 15. |
f1612b5c |
599 | Applying transliteration (tr///) to %hash will act on scalar(%hash) at - line 16. |
b08e453b |
600 | Useless use of /d modifier in transliteration operator at - line 17. |
601 | Replacement list is longer than search list at - line 18. |
24944567 |
602 | Can't modify private array in substitution (s///) at - line 6, near "s/a/b/ ;" |
b08e453b |
603 | BEGIN not safe after errors--compilation aborted at - line 20. |
599cee73 |
604 | ######## |
605 | # op.c |
8473848f |
606 | use warnings 'parenthesis' ; |
599cee73 |
607 | my $a, $b = (1,2); |
8473848f |
608 | my @foo,%bar, $quux; # there's a TAB here |
bac662ee |
609 | my $x, $y or print; |
8473848f |
610 | no warnings 'parenthesis' ; |
0453d815 |
611 | my $c, $d = (1,2); |
599cee73 |
612 | EXPECT |
df5b6949 |
613 | Parentheses missing around "my" list at - line 3. |
8473848f |
614 | Parentheses missing around "my" list at - line 4. |
599cee73 |
615 | ######## |
616 | # op.c |
8473848f |
617 | use warnings 'parenthesis' ; |
618 | our $a, $b = (1,2); |
619 | no warnings 'parenthesis' ; |
620 | our $c, $d = (1,2); |
621 | EXPECT |
622 | Parentheses missing around "our" list at - line 3. |
623 | ######## |
624 | # op.c |
625 | use warnings 'parenthesis' ; |
599cee73 |
626 | local $a, $b = (1,2); |
8473848f |
627 | local *f, *g; |
628 | no warnings 'parenthesis' ; |
0453d815 |
629 | local $c, $d = (1,2); |
599cee73 |
630 | EXPECT |
df5b6949 |
631 | Parentheses missing around "local" list at - line 3. |
8473848f |
632 | Parentheses missing around "local" list at - line 4. |
599cee73 |
633 | ######## |
634 | # op.c |
e476b1b5 |
635 | use warnings 'bareword' ; |
599cee73 |
636 | print (ABC || 1) ; |
e476b1b5 |
637 | no warnings 'bareword' ; |
0453d815 |
638 | print (ABC || 1) ; |
599cee73 |
639 | EXPECT |
34d09196 |
640 | Bareword found in conditional at - line 3. |
599cee73 |
641 | ######## |
642 | --FILE-- abc |
643 | |
644 | --FILE-- |
645 | # op.c |
e476b1b5 |
646 | use warnings 'misc' ; |
599cee73 |
647 | open FH, "<abc" ; |
648 | $x = 1 if $x = <FH> ; |
e476b1b5 |
649 | no warnings 'misc' ; |
0453d815 |
650 | $x = 1 if $x = <FH> ; |
599cee73 |
651 | EXPECT |
652 | Value of <HANDLE> construct can be "0"; test with defined() at - line 4. |
653 | ######## |
654 | # op.c |
e476b1b5 |
655 | use warnings 'misc' ; |
599cee73 |
656 | opendir FH, "." ; |
657 | $x = 1 if $x = readdir FH ; |
e476b1b5 |
658 | no warnings 'misc' ; |
0453d815 |
659 | $x = 1 if $x = readdir FH ; |
599cee73 |
660 | closedir FH ; |
661 | EXPECT |
662 | Value of readdir() operator can be "0"; test with defined() at - line 4. |
663 | ######## |
664 | # op.c |
e476b1b5 |
665 | use warnings 'misc' ; |
599cee73 |
666 | $x = 1 if $x = <*> ; |
e476b1b5 |
667 | no warnings 'misc' ; |
0453d815 |
668 | $x = 1 if $x = <*> ; |
599cee73 |
669 | EXPECT |
670 | Value of glob construct can be "0"; test with defined() at - line 3. |
671 | ######## |
672 | # op.c |
e476b1b5 |
673 | use warnings 'misc' ; |
599cee73 |
674 | %a = (1,2,3,4) ; |
675 | $x = 1 if $x = each %a ; |
e476b1b5 |
676 | no warnings 'misc' ; |
0453d815 |
677 | $x = 1 if $x = each %a ; |
599cee73 |
678 | EXPECT |
679 | Value of each() operator can be "0"; test with defined() at - line 4. |
680 | ######## |
681 | # op.c |
e476b1b5 |
682 | use warnings 'misc' ; |
599cee73 |
683 | $x = 1 while $x = <*> and 0 ; |
e476b1b5 |
684 | no warnings 'misc' ; |
0453d815 |
685 | $x = 1 while $x = <*> and 0 ; |
599cee73 |
686 | EXPECT |
687 | Value of glob construct can be "0"; test with defined() at - line 3. |
688 | ######## |
689 | # op.c |
e476b1b5 |
690 | use warnings 'misc' ; |
599cee73 |
691 | opendir FH, "." ; |
692 | $x = 1 while $x = readdir FH and 0 ; |
e476b1b5 |
693 | no warnings 'misc' ; |
0453d815 |
694 | $x = 1 while $x = readdir FH and 0 ; |
599cee73 |
695 | closedir FH ; |
696 | EXPECT |
697 | Value of readdir() operator can be "0"; test with defined() at - line 4. |
698 | ######## |
699 | # op.c |
59e10468 |
700 | use warnings 'misc'; |
701 | open FH, "<abc"; |
59e10468 |
702 | ($_ = <FH>) // ($_ = 1); |
703 | opendir DH, "."; |
59e10468 |
704 | %a = (1,2,3,4) ; |
59e10468 |
705 | EXPECT |
706 | ######## |
707 | # op.c |
4438c4b7 |
708 | use warnings 'redefine' ; |
599cee73 |
709 | sub fred {} |
710 | sub fred {} |
4438c4b7 |
711 | no warnings 'redefine' ; |
0453d815 |
712 | sub fred {} |
599cee73 |
713 | EXPECT |
714 | Subroutine fred redefined at - line 4. |
715 | ######## |
716 | # op.c |
4438c4b7 |
717 | use warnings 'redefine' ; |
599cee73 |
718 | sub fred () { 1 } |
719 | sub fred () { 1 } |
4438c4b7 |
720 | no warnings 'redefine' ; |
0453d815 |
721 | sub fred () { 1 } |
599cee73 |
722 | EXPECT |
723 | Constant subroutine fred redefined at - line 4. |
724 | ######## |
725 | # op.c |
036b4402 |
726 | no warnings 'redefine' ; |
727 | sub fred () { 1 } |
728 | sub fred () { 2 } |
729 | EXPECT |
730 | Constant subroutine fred redefined at - line 4. |
731 | ######## |
732 | # op.c |
733 | no warnings 'redefine' ; |
734 | sub fred () { 1 } |
735 | *fred = sub () { 2 }; |
736 | EXPECT |
910764e6 |
737 | Constant subroutine main::fred redefined at - line 4. |
036b4402 |
738 | ######## |
739 | # op.c |
4438c4b7 |
740 | use warnings 'redefine' ; |
599cee73 |
741 | format FRED = |
742 | . |
743 | format FRED = |
744 | . |
4438c4b7 |
745 | no warnings 'redefine' ; |
0453d815 |
746 | format FRED = |
747 | . |
599cee73 |
748 | EXPECT |
749 | Format FRED redefined at - line 5. |
750 | ######## |
751 | # op.c |
e476b1b5 |
752 | use warnings 'deprecated' ; |
599cee73 |
753 | push FRED; |
e476b1b5 |
754 | no warnings 'deprecated' ; |
0453d815 |
755 | push FRED; |
599cee73 |
756 | EXPECT |
757 | Array @FRED missing the @ in argument 1 of push() at - line 3. |
758 | ######## |
759 | # op.c |
e476b1b5 |
760 | use warnings 'deprecated' ; |
599cee73 |
761 | @a = keys FRED ; |
e476b1b5 |
762 | no warnings 'deprecated' ; |
0453d815 |
763 | @a = keys FRED ; |
599cee73 |
764 | EXPECT |
765 | Hash %FRED missing the % in argument 1 of keys() at - line 3. |
766 | ######## |
767 | # op.c |
e69a2255 |
768 | BEGIN { |
769 | if ($^O eq 'MacOS') { |
770 | print <<EOM; |
771 | SKIPPED |
772 | # no exec on Mac OS |
773 | EOM |
774 | exit; |
775 | } |
776 | } |
4438c4b7 |
777 | use warnings 'syntax' ; |
dfe13c55 |
778 | exec "$^X -e 1" ; |
599cee73 |
779 | my $a |
780 | EXPECT |
16398b42 |
781 | Statement unlikely to be reached at - line 13. |
cc507455 |
782 | (Maybe you meant system() when you said exec()?) |
69794302 |
783 | ######## |
784 | # op.c |
4438c4b7 |
785 | use warnings 'deprecated' ; |
69794302 |
786 | my @a; defined(@a); |
787 | EXPECT |
f10b0346 |
788 | defined(@array) is deprecated at - line 3. |
cc507455 |
789 | (Maybe you should just omit the defined()?) |
69794302 |
790 | ######## |
791 | # op.c |
4438c4b7 |
792 | use warnings 'deprecated' ; |
69794302 |
793 | defined(@a = (1,2,3)); |
794 | EXPECT |
f10b0346 |
795 | defined(@array) is deprecated at - line 3. |
cc507455 |
796 | (Maybe you should just omit the defined()?) |
69794302 |
797 | ######## |
798 | # op.c |
4438c4b7 |
799 | use warnings 'deprecated' ; |
69794302 |
800 | my %h; defined(%h); |
801 | EXPECT |
f10b0346 |
802 | defined(%hash) is deprecated at - line 3. |
cc507455 |
803 | (Maybe you should just omit the defined()?) |
0453d815 |
804 | ######## |
805 | # op.c |
e69a2255 |
806 | BEGIN { |
807 | if ($^O eq 'MacOS') { |
808 | print <<EOM; |
809 | SKIPPED |
810 | # no exec on Mac OS |
811 | EOM |
812 | exit; |
813 | } |
814 | } |
4438c4b7 |
815 | no warnings 'syntax' ; |
0453d815 |
816 | exec "$^X -e 1" ; |
817 | my $a |
818 | EXPECT |
819 | |
820 | ######## |
821 | # op.c |
822 | sub fred(); |
823 | sub fred($) {} |
824 | EXPECT |
825 | Prototype mismatch: sub main::fred () vs ($) at - line 3. |
826 | ######## |
827 | # op.c |
828 | $^W = 0 ; |
829 | sub fred() ; |
830 | sub fred($) {} |
831 | { |
e476b1b5 |
832 | no warnings 'prototype' ; |
0453d815 |
833 | sub Fred() ; |
834 | sub Fred($) {} |
e476b1b5 |
835 | use warnings 'prototype' ; |
0453d815 |
836 | sub freD() ; |
837 | sub freD($) {} |
838 | } |
839 | sub FRED() ; |
840 | sub FRED($) {} |
841 | EXPECT |
842 | Prototype mismatch: sub main::fred () vs ($) at - line 4. |
843 | Prototype mismatch: sub main::freD () vs ($) at - line 11. |
844 | Prototype mismatch: sub main::FRED () vs ($) at - line 14. |
eb6e2d6f |
845 | ######## |
846 | # op.c |
847 | use warnings 'syntax' ; |
848 | join /---/, 'x', 'y', 'z'; |
849 | EXPECT |
850 | /---/ should probably be written as "---" at - line 3. |
767a6a26 |
851 | ######## |
852 | # op.c [Perl_peep] |
e476b1b5 |
853 | use warnings 'prototype' ; |
767a6a26 |
854 | fred() ; |
855 | sub fred ($$) {} |
e476b1b5 |
856 | no warnings 'prototype' ; |
767a6a26 |
857 | joe() ; |
858 | sub joe ($$) {} |
859 | EXPECT |
860 | main::fred() called too early to check prototype at - line 3. |
ddda08b7 |
861 | ######## |
862 | # op.c [Perl_newATTRSUB] |
863 | --FILE-- abc.pm |
864 | use warnings 'void' ; |
865 | BEGIN { $| = 1; print "in begin\n"; } |
866 | CHECK { print "in check\n"; } |
867 | INIT { print "in init\n"; } |
868 | END { print "in end\n"; } |
869 | print "in mainline\n"; |
870 | 1; |
871 | --FILE-- |
872 | use abc; |
873 | delete $INC{"abc.pm"}; |
874 | require abc; |
875 | do "abc.pm"; |
876 | EXPECT |
877 | in begin |
878 | in mainline |
879 | in check |
880 | in init |
881 | in begin |
882 | Too late to run CHECK block at abc.pm line 3. |
883 | Too late to run INIT block at abc.pm line 4. |
884 | in mainline |
885 | in begin |
886 | Too late to run CHECK block at abc.pm line 3. |
887 | Too late to run INIT block at abc.pm line 4. |
888 | in mainline |
889 | in end |
890 | in end |
891 | in end |
892 | ######## |
893 | # op.c [Perl_newATTRSUB] |
894 | --FILE-- abc.pm |
895 | no warnings 'void' ; |
896 | BEGIN { $| = 1; print "in begin\n"; } |
897 | CHECK { print "in check\n"; } |
898 | INIT { print "in init\n"; } |
899 | END { print "in end\n"; } |
900 | print "in mainline\n"; |
901 | 1; |
902 | --FILE-- |
903 | require abc; |
904 | do "abc.pm"; |
905 | EXPECT |
906 | in begin |
907 | in mainline |
908 | in begin |
909 | in mainline |
910 | in end |
911 | in end |
936edb8b |
912 | ######## |
913 | # op.c |
914 | my @x; |
f87c3213 |
915 | use warnings 'syntax' ; |
936edb8b |
916 | push(@x); |
917 | unshift(@x); |
f87c3213 |
918 | no warnings 'syntax' ; |
936edb8b |
919 | push(@x); |
920 | unshift(@x); |
921 | EXPECT |
de4864e4 |
922 | Useless use of push with no values at - line 4. |
923 | Useless use of unshift with no values at - line 5. |
a27978d3 |
924 | ######## |
925 | # op.c |
f34840d8 |
926 | # 20020401 mjd@plover.com at suggestion of jfriedl@yahoo.com |
927 | use warnings 'regexp'; |
928 | split /blah/g, "blah"; |
929 | no warnings 'regexp'; |
930 | split /blah/g, "blah"; |
931 | EXPECT |
932 | Use of /g modifier is meaningless in split at - line 4. |
276b2a0c |
933 | ######## |
934 | # op.c |
935 | use warnings 'precedence'; |
936 | $a = $b & $c == $d; |
937 | $a = $b ^ $c != $d; |
938 | $a = $b | $c > $d; |
939 | $a = $b < $c & $d; |
940 | $a = $b >= $c ^ $d; |
941 | $a = $b <= $c | $d; |
942 | $a = $b <=> $c & $d; |
2b84528b |
943 | $a &= $b == $c; $a |= $b == $c; $a ^= $b == $c; # shouldn't warn |
276b2a0c |
944 | no warnings 'precedence'; |
945 | $a = $b & $c == $d; |
946 | $a = $b ^ $c != $d; |
947 | $a = $b | $c > $d; |
948 | $a = $b < $c & $d; |
949 | $a = $b >= $c ^ $d; |
950 | $a = $b <= $c | $d; |
951 | $a = $b <=> $c & $d; |
952 | EXPECT |
953 | Possible precedence problem on bitwise & operator at - line 3. |
954 | Possible precedence problem on bitwise ^ operator at - line 4. |
955 | Possible precedence problem on bitwise | operator at - line 5. |
956 | Possible precedence problem on bitwise & operator at - line 6. |
957 | Possible precedence problem on bitwise ^ operator at - line 7. |
958 | Possible precedence problem on bitwise | operator at - line 8. |
959 | Possible precedence problem on bitwise & operator at - line 9. |
960 | ######## |
961 | # op.c |
962 | use integer; |
963 | use warnings 'precedence'; |
964 | $a = $b & $c == $d; |
965 | $a = $b ^ $c != $d; |
966 | $a = $b | $c > $d; |
967 | $a = $b < $c & $d; |
968 | $a = $b >= $c ^ $d; |
969 | $a = $b <= $c | $d; |
970 | $a = $b <=> $c & $d; |
971 | no warnings 'precedence'; |
972 | $a = $b & $c == $d; |
973 | $a = $b ^ $c != $d; |
974 | $a = $b | $c > $d; |
975 | $a = $b < $c & $d; |
976 | $a = $b >= $c ^ $d; |
977 | $a = $b <= $c | $d; |
978 | $a = $b <=> $c & $d; |
979 | EXPECT |
980 | Possible precedence problem on bitwise & operator at - line 4. |
981 | Possible precedence problem on bitwise ^ operator at - line 5. |
982 | Possible precedence problem on bitwise | operator at - line 6. |
983 | Possible precedence problem on bitwise & operator at - line 7. |
984 | Possible precedence problem on bitwise ^ operator at - line 8. |
985 | Possible precedence problem on bitwise | operator at - line 9. |
986 | Possible precedence problem on bitwise & operator at - line 10. |
ddeae0f1 |
987 | ######## |
988 | # op.c |
989 | |
990 | # ok => local() has desired effect; |
991 | # ignore=> local() silently ignored |
992 | |
993 | use warnings 'syntax'; |
994 | |
995 | local(undef); # OP_UNDEF ignore |
996 | sub lval : lvalue {}; |
997 | local(lval()); # OP_ENTERSUB |
998 | local($x **= 1); # OP_POW |
999 | local($x *= 1); # OP_MULTIPLY |
1000 | local($x /= 1); # OP_DIVIDE |
1001 | local($x %= 1); # OP_MODULO |
1002 | local($x x= 1); # OP_REPEAT |
1003 | local($x += 1); # OP_ADD |
1004 | local($x -= 1); # OP_SUBTRACT |
1005 | local($x .= 1); # OP_CONCAT |
1006 | local($x <<= 1); # OP_LEFT_SHIFT |
1007 | local($x >>= 1); # OP_RIGHT_SHIFT |
1008 | local($x &= 1); # OP_BIT_AND |
1009 | local($x ^= 1); # OP_BIT_XOR |
1010 | local($x |= 1); # OP_BIT_OR |
1011 | { |
1012 | use integer; |
1013 | local($x *= 1); # OP_I_MULTIPLY |
1014 | local($x /= 1); # OP_I_DIVIDE |
1015 | local($x %= 1); # OP_I_MODULO |
1016 | local($x += 1); # OP_I_ADD |
1017 | local($x -= 1); # OP_I_SUBTRACT |
1018 | } |
1019 | local($x?$y:$z) = 1; # OP_COND_EXPR ok |
1020 | # these two are fatal run-time errors instead |
1021 | #local(@$a); # OP_RV2AV ok |
1022 | #local(%$a); # OP_RV2HV ok |
1023 | local(*a); # OP_RV2GV ok |
1024 | local(@a[1,2]); # OP_ASLICE ok |
1025 | local(@a{1,2}); # OP_HSLICE ok |
1026 | local(@a = (1,2)); # OP_AASSIGN |
1027 | local($$x); # OP_RV2SV ok |
1028 | local($#a); # OP_AV2ARYLEN |
1029 | local($x = 1); # OP_SASSIGN |
1030 | local($x &&= 1); # OP_ANDASSIGN |
1031 | local($x ||= 1); # OP_ORASSIGN |
1032 | local($x //= 1); # OP_DORASSIGN |
1033 | local($a[0]); # OP_AELEMFAST ok |
1034 | |
1035 | local(substr($x,0,1)); # OP_SUBSTR |
1036 | local(pos($x)); # OP_POS |
1037 | local(vec($x,0,1)); # OP_VEC |
1038 | local($a[$b]); # OP_AELEM ok |
1039 | local($a{$b}); # OP_HELEM ok |
54dc0f91 |
1040 | local($[); # OP_CONST |
ddeae0f1 |
1041 | |
1042 | no warnings 'syntax'; |
1043 | EXPECT |
1044 | Useless localization of subroutine entry at - line 10. |
1045 | Useless localization of exponentiation (**) at - line 11. |
1046 | Useless localization of multiplication (*) at - line 12. |
1047 | Useless localization of division (/) at - line 13. |
1048 | Useless localization of modulus (%) at - line 14. |
1049 | Useless localization of repeat (x) at - line 15. |
1050 | Useless localization of addition (+) at - line 16. |
1051 | Useless localization of subtraction (-) at - line 17. |
1052 | Useless localization of concatenation (.) or string at - line 18. |
1053 | Useless localization of left bitshift (<<) at - line 19. |
1054 | Useless localization of right bitshift (>>) at - line 20. |
1055 | Useless localization of bitwise and (&) at - line 21. |
1056 | Useless localization of bitwise xor (^) at - line 22. |
1057 | Useless localization of bitwise or (|) at - line 23. |
1058 | Useless localization of integer multiplication (*) at - line 26. |
1059 | Useless localization of integer division (/) at - line 27. |
1060 | Useless localization of integer modulus (%) at - line 28. |
1061 | Useless localization of integer addition (+) at - line 29. |
1062 | Useless localization of integer subtraction (-) at - line 30. |
1063 | Useless localization of list assignment at - line 39. |
1064 | Useless localization of array length at - line 41. |
1065 | Useless localization of scalar assignment at - line 42. |
1066 | Useless localization of logical and assignment (&&=) at - line 43. |
1067 | Useless localization of logical or assignment (||=) at - line 44. |
1068 | Useless localization of defined or assignment (//=) at - line 45. |
1069 | Useless localization of substr at - line 48. |
1070 | Useless localization of match position at - line 49. |
1071 | Useless localization of vec at - line 50. |
7921d0f2 |
1072 | ######## |
1073 | # op.c |
1074 | use warnings 'deprecated'; |
1075 | my $x1 if 0; |
1076 | my @x2 if 0; |
1077 | my %x3 if 0; |
1078 | my ($x4) if 0; |
1079 | my ($x5,@x6, %x7) if 0; |
1080 | 0 && my $z1; |
1081 | 0 && my (%z2); |
1082 | # these shouldn't warn |
1083 | our $x if 0; |
1084 | our $x unless 0; |
1085 | if (0) { my $w1 } |
1086 | if (my $w2) { $a=1 } |
1087 | if ($a && (my $w3 = 1)) {$a = 2} |
1088 | |
1089 | EXPECT |
1090 | Deprecated use of my() in false conditional at - line 3. |
1091 | Deprecated use of my() in false conditional at - line 4. |
1092 | Deprecated use of my() in false conditional at - line 5. |
1093 | Deprecated use of my() in false conditional at - line 6. |
1094 | Deprecated use of my() in false conditional at - line 7. |
1095 | Deprecated use of my() in false conditional at - line 8. |
1096 | Deprecated use of my() in false conditional at - line 9. |
55b67815 |
1097 | ######## |
1098 | # op.c |
1099 | $[ = 1; |
1100 | use warnings 'deprecated'; |
1101 | $[ = 2; |
1102 | no warnings 'deprecated'; |
1103 | $[ = 3; |
1104 | EXPECT |
1105 | Use of assignment to $[ is deprecated at - line 4. |