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 | |
61 | Probable precedence problem on logical or at -e line 1. |
62 | use warning 'syntax'; my $x = print(ABC || 1); |
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 |
87 | (Maybe you meant system() when you said exec()? |
88 | exec "true" ; my $a |
89 | |
90 | |
91 | __END__ |
92 | # op.c |
93 | use warning 'unsafe' ; |
94 | my $x ; |
95 | my $x ; |
96 | EXPECT |
97 | "my" variable $x masks earlier declaration in same scope at - line 4. |
98 | ######## |
99 | # op.c |
100 | use warning 'unsafe' ; |
101 | sub x { |
102 | my $x; |
103 | sub y { |
104 | $x |
105 | } |
106 | } |
107 | EXPECT |
108 | Variable "$x" will not stay shared at - line 7. |
109 | ######## |
110 | # op.c |
111 | use warning 'unsafe' ; |
112 | sub x { |
113 | my $x; |
114 | sub y { |
115 | sub { $x } |
116 | } |
117 | } |
118 | EXPECT |
119 | Variable "$x" may be unavailable at - line 6. |
120 | ######## |
121 | # op.c |
122 | use warning 'syntax' ; |
123 | 1 if $a = 1 ; |
124 | EXPECT |
125 | Found = in conditional, should be == at - line 3. |
126 | ######## |
127 | # op.c |
128 | use warning 'deprecated' ; |
129 | split ; |
130 | EXPECT |
131 | Use of implicit split to @_ is deprecated at - line 3. |
132 | ######## |
133 | # op.c |
134 | use warning 'deprecated' ; |
135 | $a = split ; |
136 | EXPECT |
137 | Use of implicit split to @_ is deprecated at - line 3. |
138 | ######## |
139 | # op.c |
140 | use warning 'void' ; close STDIN ; |
141 | 1 x 3 ; # OP_REPEAT |
142 | # OP_GVSV |
143 | wantarray ; # OP_WANTARRAY |
144 | # OP_GV |
145 | # OP_PADSV |
146 | # OP_PADAV |
147 | # OP_PADHV |
148 | # OP_PADANY |
149 | # OP_AV2ARYLEN |
150 | ref ; # OP_REF |
151 | \@a ; # OP_REFGEN |
152 | \$a ; # OP_SREFGEN |
153 | defined $a ; # OP_DEFINED |
154 | hex $a ; # OP_HEX |
155 | oct $a ; # OP_OCT |
156 | length $a ; # OP_LENGTH |
157 | substr $a,1 ; # OP_SUBSTR |
158 | vec $a,1,2 ; # OP_VEC |
159 | index $a,1,2 ; # OP_INDEX |
160 | rindex $a,1,2 ; # OP_RINDEX |
161 | sprintf $a ; # OP_SPRINTF |
162 | $a[0] ; # OP_AELEM |
163 | # OP_AELEMFAST |
164 | @a[0] ; # OP_ASLICE |
165 | #values %a ; # OP_VALUES |
166 | #keys %a ; # OP_KEYS |
167 | $a{0} ; # OP_HELEM |
168 | @a{0} ; # OP_HSLICE |
169 | unpack "a", "a" ; # OP_UNPACK |
170 | pack $a,"" ; # OP_PACK |
171 | join "" ; # OP_JOIN |
172 | (@a)[0,1] ; # OP_LSLICE |
173 | # OP_ANONLIST |
174 | # OP_ANONHASH |
175 | sort(1,2) ; # OP_SORT |
176 | reverse(1,2) ; # OP_REVERSE |
177 | # OP_RANGE |
178 | # OP_FLIP |
179 | (1 ..2) ; # OP_FLOP |
180 | caller ; # OP_CALLER |
181 | fileno STDIN ; # OP_FILENO |
182 | eof STDIN ; # OP_EOF |
183 | tell STDIN ; # OP_TELL |
184 | readlink 1; # OP_READLINK |
185 | time ; # OP_TIME |
186 | localtime ; # OP_LOCALTIME |
187 | gmtime ; # OP_GMTIME |
dfe13c55 |
188 | eval { getgrnam 1 }; # OP_GGRNAM |
189 | eval { getgrgid 1 }; # OP_GGRGID |
190 | eval { getpwnam 1 }; # OP_GPWNAM |
191 | eval { getpwuid 1 }; # OP_GPWUID |
599cee73 |
192 | EXPECT |
193 | Useless use of repeat in void context at - line 3. |
194 | Useless use of wantarray in void context at - line 5. |
195 | Useless use of reference-type operator in void context at - line 12. |
196 | Useless use of reference constructor in void context at - line 13. |
197 | Useless use of scalar ref constructor in void context at - line 14. |
198 | Useless use of defined operator in void context at - line 15. |
199 | Useless use of hex in void context at - line 16. |
200 | Useless use of oct in void context at - line 17. |
201 | Useless use of length in void context at - line 18. |
202 | Useless use of substr in void context at - line 19. |
203 | Useless use of vec in void context at - line 20. |
204 | Useless use of index in void context at - line 21. |
205 | Useless use of rindex in void context at - line 22. |
206 | Useless use of sprintf in void context at - line 23. |
207 | Useless use of array element in void context at - line 24. |
208 | Useless use of array slice in void context at - line 26. |
209 | Useless use of hash elem in void context at - line 29. |
210 | Useless use of hash slice in void context at - line 30. |
211 | Useless use of unpack in void context at - line 31. |
212 | Useless use of pack in void context at - line 32. |
213 | Useless use of join in void context at - line 33. |
214 | Useless use of list slice in void context at - line 34. |
215 | Useless use of sort in void context at - line 37. |
216 | Useless use of reverse in void context at - line 38. |
217 | Useless use of range (or flop) in void context at - line 41. |
218 | Useless use of caller in void context at - line 42. |
219 | Useless use of fileno in void context at - line 43. |
220 | Useless use of eof in void context at - line 44. |
221 | Useless use of tell in void context at - line 45. |
222 | Useless use of readlink in void context at - line 46. |
223 | Useless use of time in void context at - line 47. |
224 | Useless use of localtime in void context at - line 48. |
225 | Useless use of gmtime in void context at - line 49. |
226 | Useless use of getgrnam in void context at - line 50. |
227 | Useless use of getgrgid in void context at - line 51. |
228 | Useless use of getpwnam in void context at - line 52. |
229 | Useless use of getpwuid in void context at - line 53. |
230 | ######## |
231 | # op.c |
232 | use warning 'void' ; |
68c73484 |
233 | for (@{[0]}) { "$_" } # check warning isn't duplicated |
234 | EXPECT |
235 | Useless use of string in void context at - line 3. |
236 | ######## |
237 | # op.c |
238 | use warning 'void' ; |
599cee73 |
239 | use Config ; |
240 | BEGIN { |
241 | if ( ! $Config{d_telldir}) { |
242 | print <<EOM ; |
243 | SKIPPED |
244 | # telldir not present |
245 | EOM |
246 | exit |
247 | } |
248 | } |
249 | telldir 1 ; # OP_TELLDIR |
250 | EXPECT |
251 | Useless use of telldir in void context at - line 13. |
252 | ######## |
253 | # op.c |
254 | use warning 'void' ; |
255 | use Config ; |
256 | BEGIN { |
257 | if ( ! $Config{d_getppid}) { |
258 | print <<EOM ; |
259 | SKIPPED |
260 | # getppid not present |
261 | EOM |
262 | exit |
263 | } |
264 | } |
265 | getppid ; # OP_GETPPID |
266 | EXPECT |
267 | Useless use of getppid in void context at - line 13. |
268 | ######## |
269 | # op.c |
270 | use warning 'void' ; |
271 | use Config ; |
272 | BEGIN { |
273 | if ( ! $Config{d_getpgrp}) { |
274 | print <<EOM ; |
275 | SKIPPED |
276 | # getpgrp not present |
277 | EOM |
278 | exit |
279 | } |
280 | } |
281 | getpgrp ; # OP_GETPGRP |
282 | EXPECT |
283 | Useless use of getpgrp in void context at - line 13. |
284 | ######## |
285 | # op.c |
286 | use warning 'void' ; |
287 | use Config ; |
288 | BEGIN { |
289 | if ( ! $Config{d_times}) { |
290 | print <<EOM ; |
291 | SKIPPED |
292 | # times not present |
293 | EOM |
294 | exit |
295 | } |
296 | } |
297 | times ; # OP_TMS |
298 | EXPECT |
299 | Useless use of times in void context at - line 13. |
300 | ######## |
301 | # op.c |
302 | use warning 'void' ; |
303 | use Config ; |
304 | BEGIN { |
e96326af |
305 | if ( ! $Config{d_getprior} or $^O eq 'os2') { # Locks before fixpak22 |
599cee73 |
306 | print <<EOM ; |
307 | SKIPPED |
308 | # getpriority not present |
309 | EOM |
310 | exit |
311 | } |
312 | } |
313 | getpriority 1,2; # OP_GETPRIORITY |
314 | EXPECT |
315 | Useless use of getpriority in void context at - line 13. |
316 | ######## |
317 | # op.c |
318 | use warning 'void' ; |
319 | use Config ; |
320 | BEGIN { |
321 | if ( ! $Config{d_getlogin}) { |
322 | print <<EOM ; |
323 | SKIPPED |
324 | # getlogin not present |
325 | EOM |
326 | exit |
327 | } |
328 | } |
329 | getlogin ; # OP_GETLOGIN |
330 | EXPECT |
331 | Useless use of getlogin in void context at - line 13. |
332 | ######## |
333 | # op.c |
334 | use warning 'void' ; |
335 | use Config ; BEGIN { |
336 | if ( ! $Config{d_socket}) { |
337 | print <<EOM ; |
338 | SKIPPED |
339 | # getsockname not present |
340 | # getpeername not present |
341 | # gethostbyname not present |
342 | # gethostbyaddr not present |
343 | # gethostent not present |
344 | # getnetbyname not present |
345 | # getnetbyaddr not present |
346 | # getnetent not present |
347 | # getprotobyname not present |
348 | # getprotobynumber not present |
349 | # getprotoent not present |
350 | # getservbyname not present |
351 | # getservbyport not present |
352 | # getservent not present |
353 | EOM |
354 | exit |
355 | } } |
356 | getsockname STDIN ; # OP_GETSOCKNAME |
357 | getpeername STDIN ; # OP_GETPEERNAME |
358 | gethostbyname 1 ; # OP_GHBYNAME |
359 | gethostbyaddr 1,2; # OP_GHBYADDR |
360 | gethostent ; # OP_GHOSTENT |
361 | getnetbyname 1 ; # OP_GNBYNAME |
362 | getnetbyaddr 1,2 ; # OP_GNBYADDR |
363 | getnetent ; # OP_GNETENT |
364 | getprotobyname 1; # OP_GPBYNAME |
365 | getprotobynumber 1; # OP_GPBYNUMBER |
366 | getprotoent ; # OP_GPROTOENT |
367 | getservbyname 1,2; # OP_GSBYNAME |
368 | getservbyport 1,2; # OP_GSBYPORT |
369 | getservent ; # OP_GSERVENT |
dfe13c55 |
370 | INIT { |
371 | # some functions may not be there, so we exit without running |
372 | exit; |
373 | } |
599cee73 |
374 | EXPECT |
375 | Useless use of getsockname in void context at - line 24. |
376 | Useless use of getpeername in void context at - line 25. |
377 | Useless use of gethostbyname in void context at - line 26. |
378 | Useless use of gethostbyaddr in void context at - line 27. |
379 | Useless use of gethostent in void context at - line 28. |
380 | Useless use of getnetbyname in void context at - line 29. |
381 | Useless use of getnetbyaddr in void context at - line 30. |
382 | Useless use of getnetent in void context at - line 31. |
383 | Useless use of getprotobyname in void context at - line 32. |
384 | Useless use of getprotobynumber in void context at - line 33. |
385 | Useless use of getprotoent in void context at - line 34. |
386 | Useless use of getservbyname in void context at - line 35. |
387 | Useless use of getservbyport in void context at - line 36. |
388 | Useless use of getservent in void context at - line 37. |
389 | ######## |
390 | # op.c |
391 | use warning 'void' ; |
392 | *a ; # OP_RV2GV |
393 | $a ; # OP_RV2SV |
394 | @a ; # OP_RV2AV |
395 | %a ; # OP_RV2HV |
396 | EXPECT |
397 | Useless use of a variable in void context at - line 3. |
398 | Useless use of a variable in void context at - line 4. |
399 | Useless use of a variable in void context at - line 5. |
400 | Useless use of a variable in void context at - line 6. |
401 | ######## |
402 | # op.c |
403 | use warning 'void' ; |
404 | "abc"; # OP_CONST |
405 | 7 ; # OP_CONST |
406 | EXPECT |
407 | Useless use of a constant in void context at - line 3. |
408 | Useless use of a constant in void context at - line 4. |
409 | ######## |
410 | # op.c |
411 | use warning 'unsafe' ; |
412 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; |
413 | @a =~ /abc/ ; |
414 | @a =~ s/a/b/ ; |
415 | @a =~ tr/a/b/ ; |
416 | @$b =~ /abc/ ; |
417 | @$b =~ s/a/b/ ; |
418 | @$b =~ tr/a/b/ ; |
419 | %a =~ /abc/ ; |
420 | %a =~ s/a/b/ ; |
421 | %a =~ tr/a/b/ ; |
422 | %$c =~ /abc/ ; |
423 | %$c =~ s/a/b/ ; |
424 | %$c =~ tr/a/b/ ; |
425 | EXPECT |
426 | Applying pattern match to @array will act on scalar(@array) at - line 4. |
427 | Applying substitution to @array will act on scalar(@array) at - line 5. |
428 | Can't modify private array in substitution at - line 5, near "s/a/b/ ;" |
429 | Applying character translation to @array will act on scalar(@array) at - line 6. |
430 | Applying pattern match to @array will act on scalar(@array) at - line 7. |
431 | Applying substitution to @array will act on scalar(@array) at - line 8. |
432 | Applying character translation to @array will act on scalar(@array) at - line 9. |
433 | Applying pattern match to %hash will act on scalar(%hash) at - line 10. |
434 | Applying substitution to %hash will act on scalar(%hash) at - line 11. |
435 | Applying character translation to %hash will act on scalar(%hash) at - line 12. |
436 | Applying pattern match to %hash will act on scalar(%hash) at - line 13. |
437 | Applying substitution to %hash will act on scalar(%hash) at - line 14. |
438 | Applying character translation to %hash will act on scalar(%hash) at - line 15. |
439 | Execution of - aborted due to compilation errors. |
440 | ######## |
441 | # op.c |
442 | use warning 'syntax' ; |
443 | my $a, $b = (1,2); |
444 | EXPECT |
df5b6949 |
445 | Parentheses missing around "my" list at - line 3. |
599cee73 |
446 | ######## |
447 | # op.c |
448 | use warning 'syntax' ; |
449 | local $a, $b = (1,2); |
450 | EXPECT |
df5b6949 |
451 | Parentheses missing around "local" list at - line 3. |
599cee73 |
452 | ######## |
453 | # op.c |
454 | use warning 'syntax' ; |
455 | print (ABC || 1) ; |
456 | EXPECT |
457 | Probable precedence problem on logical or at - line 3. |
458 | ######## |
459 | --FILE-- abc |
460 | |
461 | --FILE-- |
462 | # op.c |
463 | use warning 'unsafe' ; |
464 | open FH, "<abc" ; |
465 | $x = 1 if $x = <FH> ; |
466 | EXPECT |
467 | Value of <HANDLE> construct can be "0"; test with defined() at - line 4. |
468 | ######## |
469 | # op.c |
470 | use warning 'unsafe' ; |
471 | opendir FH, "." ; |
472 | $x = 1 if $x = readdir FH ; |
473 | closedir FH ; |
474 | EXPECT |
475 | Value of readdir() operator can be "0"; test with defined() at - line 4. |
476 | ######## |
477 | # op.c |
478 | use warning 'unsafe' ; |
479 | $x = 1 if $x = <*> ; |
480 | EXPECT |
481 | Value of glob construct can be "0"; test with defined() at - line 3. |
482 | ######## |
483 | # op.c |
484 | use warning 'unsafe' ; |
485 | %a = (1,2,3,4) ; |
486 | $x = 1 if $x = each %a ; |
487 | EXPECT |
488 | Value of each() operator can be "0"; test with defined() at - line 4. |
489 | ######## |
490 | # op.c |
491 | use warning 'unsafe' ; |
492 | $x = 1 while $x = <*> and 0 ; |
493 | EXPECT |
494 | Value of glob construct can be "0"; test with defined() at - line 3. |
495 | ######## |
496 | # op.c |
497 | use warning 'unsafe' ; |
498 | opendir FH, "." ; |
499 | $x = 1 while $x = readdir FH and 0 ; |
500 | closedir FH ; |
501 | EXPECT |
502 | Value of readdir() operator can be "0"; test with defined() at - line 4. |
503 | ######## |
504 | # op.c |
505 | use warning 'redefine' ; |
506 | sub fred {} |
507 | sub fred {} |
508 | EXPECT |
509 | Subroutine fred redefined at - line 4. |
510 | ######## |
511 | # op.c |
512 | use warning 'redefine' ; |
513 | sub fred () { 1 } |
514 | sub fred () { 1 } |
515 | EXPECT |
516 | Constant subroutine fred redefined at - line 4. |
517 | ######## |
518 | # op.c |
519 | use warning 'redefine' ; |
520 | format FRED = |
521 | . |
522 | format FRED = |
523 | . |
524 | EXPECT |
525 | Format FRED redefined at - line 5. |
526 | ######## |
527 | # op.c |
528 | use warning 'syntax' ; |
529 | push FRED; |
530 | EXPECT |
531 | Array @FRED missing the @ in argument 1 of push() at - line 3. |
532 | ######## |
533 | # op.c |
534 | use warning 'syntax' ; |
535 | @a = keys FRED ; |
536 | EXPECT |
537 | Hash %FRED missing the % in argument 1 of keys() at - line 3. |
538 | ######## |
539 | # op.c |
540 | use warning 'syntax' ; |
dfe13c55 |
541 | exec "$^X -e 1" ; |
599cee73 |
542 | my $a |
543 | EXPECT |
544 | Statement unlikely to be reached at - line 4. |
545 | (Maybe you meant system() when you said exec()?) |