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