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