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