Commit | Line | Data |
---|---|---|
599cee73 PM |
1 | op.c AOK |
2 | ||
599cee73 PM |
3 | Found = in conditional, should be == |
4 | 1 if $a = 1 ; | |
5 | ||
599cee73 PM |
6 | Useless use of time in void context |
7 | Useless use of a variable in void context | |
8 | Useless use of a constant in void context | |
9 | time ; | |
10 | $a ; | |
11 | "abc" | |
12 | ||
a801c63c RGS |
13 | Useless use of sort in scalar context |
14 | my $x = sort (2,1,3); | |
15 | ||
599cee73 PM |
16 | Applying %s to %s will act on scalar(%s) |
17 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; | |
18 | @a =~ /abc/ ; | |
19 | @a =~ s/a/b/ ; | |
20 | @a =~ tr/a/b/ ; | |
21 | @$b =~ /abc/ ; | |
22 | @$b =~ s/a/b/ ; | |
23 | @$b =~ tr/a/b/ ; | |
24 | %a =~ /abc/ ; | |
25 | %a =~ s/a/b/ ; | |
26 | %a =~ tr/a/b/ ; | |
27 | %$c =~ /abc/ ; | |
28 | %$c =~ s/a/b/ ; | |
29 | %$c =~ tr/a/b/ ; | |
30 | ||
31 | ||
df5b6949 | 32 | Parentheses missing around "my" list at -e line 1. |
599cee73 PM |
33 | my $a, $b = (1,2); |
34 | ||
df5b6949 | 35 | Parentheses missing around "local" list at -e line 1. |
599cee73 PM |
36 | local $a, $b = (1,2); |
37 | ||
34d09196 | 38 | Bareword found in conditional at -e line 1. |
e476b1b5 | 39 | use warnings 'bareword'; my $x = print(ABC || 1); |
599cee73 PM |
40 | |
41 | Value of %s may be \"0\"; use \"defined\" | |
42 | $x = 1 if $x = <FH> ; | |
43 | $x = 1 while $x = <FH> ; | |
44 | ||
45 | Subroutine fred redefined at -e line 1. | |
46 | sub fred{1;} sub fred{1;} | |
47 | ||
48 | Constant subroutine %s redefined | |
49 | sub fred() {1;} sub fred() {1;} | |
50 | ||
51 | Format FRED redefined at /tmp/x line 5. | |
52 | format FRED = | |
53 | . | |
54 | format FRED = | |
55 | . | |
56 | ||
57 | Array @%s missing the @ in argument %d of %s() | |
58 | push fred ; | |
59 | ||
60 | Hash %%%s missing the %% in argument %d of %s() | |
61 | keys joe ; | |
62 | ||
63 | Statement unlikely to be reached | |
cc507455 | 64 | (Maybe you meant system() when you said exec()? |
599cee73 PM |
65 | exec "true" ; my $a |
66 | ||
f10b0346 | 67 | defined(@array) is deprecated |
cc507455 | 68 | (Maybe you should just omit the defined()?) |
69794302 MJD |
69 | my @a ; defined @a ; |
70 | defined (@a = (1,2,3)) ; | |
71 | ||
f10b0346 | 72 | defined(%hash) is deprecated |
cc507455 | 73 | (Maybe you should just omit the defined()?) |
69794302 | 74 | my %h ; defined %h ; |
89474f50 | 75 | |
271c8bde FC |
76 | "my %s" used in sort comparison |
77 | ||
89474f50 | 78 | $[ used in comparison (did you mean $] ?) |
e508c8a4 MH |
79 | |
80 | length() used on @array (did you mean "scalar(@array)"?) | |
81 | length() used on %hash (did you mean "scalar(keys %hash)"?) | |
82 | ||
eb6e2d6f GS |
83 | /---/ should probably be written as "---" |
84 | join(/---/, @foo); | |
599cee73 | 85 | |
767a6a26 PM |
86 | %s() called too early to check prototype [Perl_peep] |
87 | fred() ; sub fred ($$) {} | |
88 | ||
89 | ||
15a8c21e | 90 | Package '%s' not found (did you use the incorrect case?) |
3b434eb1 | 91 | |
f34840d8 MJD |
92 | Use of /g modifier is meaningless in split |
93 | ||
276b2a0c RGS |
94 | Possible precedence problem on bitwise %c operator [Perl_ck_bitop] |
95 | ||
0453d815 PM |
96 | Mandatory Warnings |
97 | ------------------ | |
98 | Prototype mismatch: [cv_ckproto] | |
99 | sub fred() ; | |
100 | sub fred($) {} | |
101 | ||
0453d815 PM |
102 | oops: oopsAV [oopsAV] TODO |
103 | oops: oopsHV [oopsHV] TODO | |
104 | ||
599cee73 PM |
105 | __END__ |
106 | # op.c | |
4438c4b7 | 107 | use warnings 'syntax' ; |
599cee73 | 108 | 1 if $a = 1 ; |
2b7cddde NC |
109 | 1 if $a |
110 | = 1 ; | |
4438c4b7 | 111 | no warnings 'syntax' ; |
0453d815 | 112 | 1 if $a = 1 ; |
2b7cddde NC |
113 | 1 if $a |
114 | = 1 ; | |
599cee73 PM |
115 | EXPECT |
116 | Found = in conditional, should be == at - line 3. | |
2b7cddde | 117 | Found = in conditional, should be == at - line 4. |
599cee73 PM |
118 | ######## |
119 | # op.c | |
6b7c6d95 FC |
120 | use warnings 'syntax' ; |
121 | use constant foo => 1; | |
122 | 1 if $a = foo ; | |
123 | no warnings 'syntax' ; | |
124 | 1 if $a = foo ; | |
125 | EXPECT | |
126 | ######## | |
127 | # op.c | |
a1063b2d RH |
128 | my (@foo, %foo); |
129 | %main::foo->{"bar"}; | |
130 | %foo->{"bar"}; | |
131 | @main::foo->[23]; | |
132 | @foo->[23]; | |
133 | $main::foo = {}; %$main::foo->{"bar"}; | |
134 | $foo = {}; %$foo->{"bar"}; | |
135 | $main::foo = []; @$main::foo->[34]; | |
136 | $foo = []; @$foo->[34]; | |
137 | no warnings 'deprecated'; | |
138 | %main::foo->{"bar"}; | |
139 | %foo->{"bar"}; | |
140 | @main::foo->[23]; | |
141 | @foo->[23]; | |
142 | $main::foo = {}; %$main::foo->{"bar"}; | |
143 | $foo = {}; %$foo->{"bar"}; | |
144 | $main::foo = []; @$main::foo->[34]; | |
145 | $foo = []; @$foo->[34]; | |
146 | EXPECT | |
d1d15184 | 147 | Using a hash as a reference is deprecated at - line 3. |
a1063b2d | 148 | Using a hash as a reference is deprecated at - line 4. |
d1d15184 | 149 | Using an array as a reference is deprecated at - line 5. |
a1063b2d | 150 | Using an array as a reference is deprecated at - line 6. |
d1d15184 | 151 | Using a hash as a reference is deprecated at - line 7. |
a1063b2d | 152 | Using a hash as a reference is deprecated at - line 8. |
d1d15184 | 153 | Using an array as a reference is deprecated at - line 9. |
a1063b2d | 154 | Using an array as a reference is deprecated at - line 10. |
a1063b2d RH |
155 | ######## |
156 | # op.c | |
4438c4b7 | 157 | use warnings 'void' ; close STDIN ; |
baed7faa FC |
158 | #line 2 |
159 | 1 x 3 ; # OP_REPEAT (folded) | |
160 | (1) x 3 ; # OP_REPEAT | |
599cee73 PM |
161 | # OP_GVSV |
162 | wantarray ; # OP_WANTARRAY | |
163 | # OP_GV | |
164 | # OP_PADSV | |
165 | # OP_PADAV | |
166 | # OP_PADHV | |
167 | # OP_PADANY | |
168 | # OP_AV2ARYLEN | |
169 | ref ; # OP_REF | |
170 | \@a ; # OP_REFGEN | |
171 | \$a ; # OP_SREFGEN | |
172 | defined $a ; # OP_DEFINED | |
173 | hex $a ; # OP_HEX | |
174 | oct $a ; # OP_OCT | |
175 | length $a ; # OP_LENGTH | |
176 | substr $a,1 ; # OP_SUBSTR | |
177 | vec $a,1,2 ; # OP_VEC | |
178 | index $a,1,2 ; # OP_INDEX | |
179 | rindex $a,1,2 ; # OP_RINDEX | |
180 | sprintf $a ; # OP_SPRINTF | |
181 | $a[0] ; # OP_AELEM | |
182 | # OP_AELEMFAST | |
183 | @a[0] ; # OP_ASLICE | |
184 | #values %a ; # OP_VALUES | |
185 | #keys %a ; # OP_KEYS | |
186 | $a{0} ; # OP_HELEM | |
187 | @a{0} ; # OP_HSLICE | |
188 | unpack "a", "a" ; # OP_UNPACK | |
189 | pack $a,"" ; # OP_PACK | |
190 | join "" ; # OP_JOIN | |
191 | (@a)[0,1] ; # OP_LSLICE | |
192 | # OP_ANONLIST | |
193 | # OP_ANONHASH | |
194 | sort(1,2) ; # OP_SORT | |
195 | reverse(1,2) ; # OP_REVERSE | |
196 | # OP_RANGE | |
197 | # OP_FLIP | |
198 | (1 ..2) ; # OP_FLOP | |
199 | caller ; # OP_CALLER | |
200 | fileno STDIN ; # OP_FILENO | |
201 | eof STDIN ; # OP_EOF | |
202 | tell STDIN ; # OP_TELL | |
203 | readlink 1; # OP_READLINK | |
204 | time ; # OP_TIME | |
205 | localtime ; # OP_LOCALTIME | |
206 | gmtime ; # OP_GMTIME | |
dfe13c55 GS |
207 | eval { getgrnam 1 }; # OP_GGRNAM |
208 | eval { getgrgid 1 }; # OP_GGRGID | |
209 | eval { getpwnam 1 }; # OP_GPWNAM | |
210 | eval { getpwuid 1 }; # OP_GPWUID | |
78e1b766 | 211 | prototype "foo"; # OP_PROTOTYPE |
74295f0b MS |
212 | $a ~~ $b; # OP_SMARTMATCH |
213 | $a <=> $b; # OP_NCMP | |
703227f5 FC |
214 | use 5.015; |
215 | __SUB__ # OP_RUNCV | |
599cee73 | 216 | EXPECT |
baed7faa | 217 | Useless use of a constant ("111") in void context at - line 2. |
42d38218 | 218 | Useless use of repeat (x) in void context at - line 3. |
599cee73 PM |
219 | Useless use of wantarray in void context at - line 5. |
220 | Useless use of reference-type operator in void context at - line 12. | |
221 | Useless use of reference constructor in void context at - line 13. | |
d6c467eb | 222 | Useless use of single ref constructor in void context at - line 14. |
599cee73 PM |
223 | Useless use of defined operator in void context at - line 15. |
224 | Useless use of hex in void context at - line 16. | |
225 | Useless use of oct in void context at - line 17. | |
226 | Useless use of length in void context at - line 18. | |
227 | Useless use of substr in void context at - line 19. | |
228 | Useless use of vec in void context at - line 20. | |
229 | Useless use of index in void context at - line 21. | |
230 | Useless use of rindex in void context at - line 22. | |
231 | Useless use of sprintf in void context at - line 23. | |
232 | Useless use of array element in void context at - line 24. | |
233 | Useless use of array slice in void context at - line 26. | |
f1612b5c | 234 | Useless use of hash element in void context at - line 29. |
599cee73 PM |
235 | Useless use of hash slice in void context at - line 30. |
236 | Useless use of unpack in void context at - line 31. | |
237 | Useless use of pack in void context at - line 32. | |
297b36dc | 238 | Useless use of join or string in void context at - line 33. |
599cee73 PM |
239 | Useless use of list slice in void context at - line 34. |
240 | Useless use of sort in void context at - line 37. | |
241 | Useless use of reverse in void context at - line 38. | |
242 | Useless use of range (or flop) in void context at - line 41. | |
243 | Useless use of caller in void context at - line 42. | |
244 | Useless use of fileno in void context at - line 43. | |
245 | Useless use of eof in void context at - line 44. | |
246 | Useless use of tell in void context at - line 45. | |
247 | Useless use of readlink in void context at - line 46. | |
248 | Useless use of time in void context at - line 47. | |
249 | Useless use of localtime in void context at - line 48. | |
250 | Useless use of gmtime in void context at - line 49. | |
251 | Useless use of getgrnam in void context at - line 50. | |
252 | Useless use of getgrgid in void context at - line 51. | |
253 | Useless use of getpwnam in void context at - line 52. | |
254 | Useless use of getpwuid in void context at - line 53. | |
78e1b766 | 255 | Useless use of subroutine prototype in void context at - line 54. |
f5df4782 RGS |
256 | Useless use of smart match in void context at - line 55. |
257 | Useless use of numeric comparison (<=>) in void context at - line 56. | |
703227f5 | 258 | Useless use of __SUB__ in void context at - line 58. |
599cee73 PM |
259 | ######## |
260 | # op.c | |
a801c63c RGS |
261 | use warnings 'void' ; close STDIN ; |
262 | my $x = sort (2,1,3); | |
263 | no warnings 'void' ; | |
264 | $x = sort (2,1,3); | |
265 | EXPECT | |
266 | Useless use of sort in scalar context at - line 3. | |
267 | ######## | |
268 | # op.c | |
4438c4b7 | 269 | no warnings 'void' ; close STDIN ; |
0453d815 PM |
270 | 1 x 3 ; # OP_REPEAT |
271 | # OP_GVSV | |
272 | wantarray ; # OP_WANTARRAY | |
273 | # OP_GV | |
274 | # OP_PADSV | |
275 | # OP_PADAV | |
276 | # OP_PADHV | |
277 | # OP_PADANY | |
278 | # OP_AV2ARYLEN | |
279 | ref ; # OP_REF | |
280 | \@a ; # OP_REFGEN | |
281 | \$a ; # OP_SREFGEN | |
282 | defined $a ; # OP_DEFINED | |
283 | hex $a ; # OP_HEX | |
284 | oct $a ; # OP_OCT | |
285 | length $a ; # OP_LENGTH | |
286 | substr $a,1 ; # OP_SUBSTR | |
287 | vec $a,1,2 ; # OP_VEC | |
288 | index $a,1,2 ; # OP_INDEX | |
289 | rindex $a,1,2 ; # OP_RINDEX | |
290 | sprintf $a ; # OP_SPRINTF | |
291 | $a[0] ; # OP_AELEM | |
292 | # OP_AELEMFAST | |
293 | @a[0] ; # OP_ASLICE | |
294 | #values %a ; # OP_VALUES | |
295 | #keys %a ; # OP_KEYS | |
296 | $a{0} ; # OP_HELEM | |
297 | @a{0} ; # OP_HSLICE | |
298 | unpack "a", "a" ; # OP_UNPACK | |
299 | pack $a,"" ; # OP_PACK | |
300 | join "" ; # OP_JOIN | |
301 | (@a)[0,1] ; # OP_LSLICE | |
302 | # OP_ANONLIST | |
303 | # OP_ANONHASH | |
304 | sort(1,2) ; # OP_SORT | |
305 | reverse(1,2) ; # OP_REVERSE | |
306 | # OP_RANGE | |
307 | # OP_FLIP | |
308 | (1 ..2) ; # OP_FLOP | |
309 | caller ; # OP_CALLER | |
310 | fileno STDIN ; # OP_FILENO | |
311 | eof STDIN ; # OP_EOF | |
312 | tell STDIN ; # OP_TELL | |
313 | readlink 1; # OP_READLINK | |
314 | time ; # OP_TIME | |
315 | localtime ; # OP_LOCALTIME | |
316 | gmtime ; # OP_GMTIME | |
317 | eval { getgrnam 1 }; # OP_GGRNAM | |
318 | eval { getgrgid 1 }; # OP_GGRGID | |
319 | eval { getpwnam 1 }; # OP_GPWNAM | |
320 | eval { getpwuid 1 }; # OP_GPWUID | |
78e1b766 | 321 | prototype "foo"; # OP_PROTOTYPE |
0453d815 PM |
322 | EXPECT |
323 | ######## | |
324 | # op.c | |
4438c4b7 | 325 | use warnings 'void' ; |
68c73484 | 326 | for (@{[0]}) { "$_" } # check warning isn't duplicated |
4438c4b7 | 327 | no warnings 'void' ; |
0453d815 | 328 | for (@{[0]}) { "$_" } # check warning isn't duplicated |
68c73484 JH |
329 | EXPECT |
330 | Useless use of string in void context at - line 3. | |
331 | ######## | |
332 | # op.c | |
4438c4b7 | 333 | use warnings 'void' ; |
599cee73 PM |
334 | use Config ; |
335 | BEGIN { | |
336 | if ( ! $Config{d_telldir}) { | |
337 | print <<EOM ; | |
338 | SKIPPED | |
339 | # telldir not present | |
340 | EOM | |
341 | exit | |
342 | } | |
343 | } | |
344 | telldir 1 ; # OP_TELLDIR | |
4438c4b7 | 345 | no warnings 'void' ; |
0453d815 | 346 | telldir 1 ; # OP_TELLDIR |
599cee73 PM |
347 | EXPECT |
348 | Useless use of telldir in void context at - line 13. | |
349 | ######## | |
350 | # op.c | |
4438c4b7 | 351 | use warnings 'void' ; |
599cee73 PM |
352 | use Config ; |
353 | BEGIN { | |
354 | if ( ! $Config{d_getppid}) { | |
355 | print <<EOM ; | |
356 | SKIPPED | |
357 | # getppid not present | |
358 | EOM | |
359 | exit | |
360 | } | |
361 | } | |
362 | getppid ; # OP_GETPPID | |
4438c4b7 | 363 | no warnings 'void' ; |
0453d815 | 364 | getppid ; # OP_GETPPID |
599cee73 PM |
365 | EXPECT |
366 | Useless use of getppid in void context at - line 13. | |
367 | ######## | |
368 | # op.c | |
4438c4b7 | 369 | use warnings 'void' ; |
599cee73 PM |
370 | use Config ; |
371 | BEGIN { | |
372 | if ( ! $Config{d_getpgrp}) { | |
373 | print <<EOM ; | |
374 | SKIPPED | |
375 | # getpgrp not present | |
376 | EOM | |
377 | exit | |
378 | } | |
379 | } | |
380 | getpgrp ; # OP_GETPGRP | |
4438c4b7 | 381 | no warnings 'void' ; |
0453d815 | 382 | getpgrp ; # OP_GETPGRP |
599cee73 PM |
383 | EXPECT |
384 | Useless use of getpgrp in void context at - line 13. | |
385 | ######## | |
386 | # op.c | |
4438c4b7 | 387 | use warnings 'void' ; |
599cee73 PM |
388 | use Config ; |
389 | BEGIN { | |
390 | if ( ! $Config{d_times}) { | |
391 | print <<EOM ; | |
392 | SKIPPED | |
393 | # times not present | |
394 | EOM | |
395 | exit | |
396 | } | |
397 | } | |
398 | times ; # OP_TMS | |
4438c4b7 | 399 | no warnings 'void' ; |
0453d815 | 400 | times ; # OP_TMS |
599cee73 PM |
401 | EXPECT |
402 | Useless use of times in void context at - line 13. | |
403 | ######## | |
404 | # op.c | |
4438c4b7 | 405 | use warnings 'void' ; |
599cee73 PM |
406 | use Config ; |
407 | BEGIN { | |
e96326af | 408 | if ( ! $Config{d_getprior} or $^O eq 'os2') { # Locks before fixpak22 |
599cee73 PM |
409 | print <<EOM ; |
410 | SKIPPED | |
411 | # getpriority not present | |
412 | EOM | |
413 | exit | |
414 | } | |
415 | } | |
416 | getpriority 1,2; # OP_GETPRIORITY | |
4438c4b7 | 417 | no warnings 'void' ; |
0453d815 | 418 | getpriority 1,2; # OP_GETPRIORITY |
599cee73 PM |
419 | EXPECT |
420 | Useless use of getpriority in void context at - line 13. | |
421 | ######## | |
422 | # op.c | |
4438c4b7 | 423 | use warnings 'void' ; |
599cee73 PM |
424 | use Config ; |
425 | BEGIN { | |
426 | if ( ! $Config{d_getlogin}) { | |
427 | print <<EOM ; | |
428 | SKIPPED | |
429 | # getlogin not present | |
430 | EOM | |
431 | exit | |
432 | } | |
433 | } | |
434 | getlogin ; # OP_GETLOGIN | |
4438c4b7 | 435 | no warnings 'void' ; |
0453d815 | 436 | getlogin ; # OP_GETLOGIN |
599cee73 PM |
437 | EXPECT |
438 | Useless use of getlogin in void context at - line 13. | |
439 | ######## | |
440 | # op.c | |
4438c4b7 | 441 | use warnings 'void' ; |
599cee73 PM |
442 | use Config ; BEGIN { |
443 | if ( ! $Config{d_socket}) { | |
444 | print <<EOM ; | |
445 | SKIPPED | |
446 | # getsockname not present | |
447 | # getpeername not present | |
448 | # gethostbyname not present | |
449 | # gethostbyaddr not present | |
450 | # gethostent not present | |
451 | # getnetbyname not present | |
452 | # getnetbyaddr not present | |
453 | # getnetent not present | |
454 | # getprotobyname not present | |
455 | # getprotobynumber not present | |
456 | # getprotoent not present | |
457 | # getservbyname not present | |
458 | # getservbyport not present | |
459 | # getservent not present | |
460 | EOM | |
461 | exit | |
462 | } } | |
463 | getsockname STDIN ; # OP_GETSOCKNAME | |
464 | getpeername STDIN ; # OP_GETPEERNAME | |
465 | gethostbyname 1 ; # OP_GHBYNAME | |
466 | gethostbyaddr 1,2; # OP_GHBYADDR | |
467 | gethostent ; # OP_GHOSTENT | |
468 | getnetbyname 1 ; # OP_GNBYNAME | |
469 | getnetbyaddr 1,2 ; # OP_GNBYADDR | |
470 | getnetent ; # OP_GNETENT | |
471 | getprotobyname 1; # OP_GPBYNAME | |
472 | getprotobynumber 1; # OP_GPBYNUMBER | |
473 | getprotoent ; # OP_GPROTOENT | |
474 | getservbyname 1,2; # OP_GSBYNAME | |
475 | getservbyport 1,2; # OP_GSBYPORT | |
476 | getservent ; # OP_GSERVENT | |
0453d815 | 477 | |
4438c4b7 | 478 | no warnings 'void' ; |
0453d815 PM |
479 | getsockname STDIN ; # OP_GETSOCKNAME |
480 | getpeername STDIN ; # OP_GETPEERNAME | |
481 | gethostbyname 1 ; # OP_GHBYNAME | |
482 | gethostbyaddr 1,2; # OP_GHBYADDR | |
483 | gethostent ; # OP_GHOSTENT | |
484 | getnetbyname 1 ; # OP_GNBYNAME | |
485 | getnetbyaddr 1,2 ; # OP_GNBYADDR | |
486 | getnetent ; # OP_GNETENT | |
487 | getprotobyname 1; # OP_GPBYNAME | |
488 | getprotobynumber 1; # OP_GPBYNUMBER | |
489 | getprotoent ; # OP_GPROTOENT | |
490 | getservbyname 1,2; # OP_GSBYNAME | |
491 | getservbyport 1,2; # OP_GSBYPORT | |
492 | getservent ; # OP_GSERVENT | |
dfe13c55 GS |
493 | INIT { |
494 | # some functions may not be there, so we exit without running | |
495 | exit; | |
496 | } | |
599cee73 PM |
497 | EXPECT |
498 | Useless use of getsockname in void context at - line 24. | |
499 | Useless use of getpeername in void context at - line 25. | |
500 | Useless use of gethostbyname in void context at - line 26. | |
501 | Useless use of gethostbyaddr in void context at - line 27. | |
502 | Useless use of gethostent in void context at - line 28. | |
503 | Useless use of getnetbyname in void context at - line 29. | |
504 | Useless use of getnetbyaddr in void context at - line 30. | |
505 | Useless use of getnetent in void context at - line 31. | |
506 | Useless use of getprotobyname in void context at - line 32. | |
507 | Useless use of getprotobynumber in void context at - line 33. | |
508 | Useless use of getprotoent in void context at - line 34. | |
509 | Useless use of getservbyname in void context at - line 35. | |
510 | Useless use of getservbyport in void context at - line 36. | |
511 | Useless use of getservent in void context at - line 37. | |
512 | ######## | |
513 | # op.c | |
4438c4b7 | 514 | use warnings 'void' ; |
599cee73 PM |
515 | *a ; # OP_RV2GV |
516 | $a ; # OP_RV2SV | |
517 | @a ; # OP_RV2AV | |
518 | %a ; # OP_RV2HV | |
4438c4b7 | 519 | no warnings 'void' ; |
0453d815 PM |
520 | *a ; # OP_RV2GV |
521 | $a ; # OP_RV2SV | |
522 | @a ; # OP_RV2AV | |
523 | %a ; # OP_RV2HV | |
599cee73 PM |
524 | EXPECT |
525 | Useless use of a variable in void context at - line 3. | |
526 | Useless use of a variable in void context at - line 4. | |
527 | Useless use of a variable in void context at - line 5. | |
528 | Useless use of a variable in void context at - line 6. | |
529 | ######## | |
530 | # op.c | |
4438c4b7 | 531 | use warnings 'void' ; |
599cee73 PM |
532 | "abc"; # OP_CONST |
533 | 7 ; # OP_CONST | |
86f9315f RD |
534 | "x" . "y"; # optimized to OP_CONST |
535 | 2 + 2; # optimized to OP_CONST | |
e7fec78e | 536 | use constant U => undef; |
fa01e093 | 537 | U; |
919f76a3 | 538 | qq/" \n/; |
fa01e093 | 539 | 5 || print "bad\n"; # test OPpCONST_SHORTCIRCUIT |
e7fec78e | 540 | print "boo\n" if U; # test OPpCONST_SHORTCIRCUIT |
4438c4b7 | 541 | no warnings 'void' ; |
0453d815 PM |
542 | "abc"; # OP_CONST |
543 | 7 ; # OP_CONST | |
86f9315f RD |
544 | "x" . "y"; # optimized to OP_CONST |
545 | 2 + 2; # optimized to OP_CONST | |
599cee73 | 546 | EXPECT |
919f76a3 | 547 | Useless use of a constant ("abc") in void context at - line 3. |
86f9315f | 548 | Useless use of a constant (7) in void context at - line 4. |
919f76a3 | 549 | Useless use of a constant ("xy") in void context at - line 5. |
86f9315f | 550 | Useless use of a constant (4) in void context at - line 6. |
fa01e093 | 551 | Useless use of a constant (undef) in void context at - line 8. |
919f76a3 | 552 | Useless use of a constant ("\"\t\n") in void context at - line 9. |
599cee73 PM |
553 | ######## |
554 | # op.c | |
34ee6772 BF |
555 | use utf8; |
556 | use open qw( :utf8 :std ); | |
557 | use warnings 'void' ; | |
558 | "àḆc"; # OP_CONST | |
559 | "Ẋ" . "ƴ"; # optimized to OP_CONST | |
560 | FOO; # Bareword optimized to OP_CONST | |
561 | use constant ů => undef; | |
562 | ů; | |
563 | 5 || print "bad\n"; # test OPpCONST_SHORTCIRCUIT | |
564 | print "boo\n" if ů; # test OPpCONST_SHORTCIRCUIT | |
565 | no warnings 'void' ; | |
566 | "àḆc"; # OP_CONST | |
567 | "Ẋ" . "ƴ"; # optimized to OP_CONST | |
568 | EXPECT | |
919f76a3 RGS |
569 | Useless use of a constant ("\340\x{1e06}c") in void context at - line 5. |
570 | Useless use of a constant ("\x{1e8a}\x{1b4}") in void context at - line 6. | |
571 | Useless use of a constant ("\x{ff26}\x{ff2f}\x{ff2f}") in void context at - line 7. | |
34ee6772 BF |
572 | Useless use of a constant (undef) in void context at - line 9. |
573 | ######## | |
574 | # op.c | |
7f01dc7a | 575 | # |
e476b1b5 | 576 | use warnings 'misc' ; |
b08e453b | 577 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ;my $d = 'test'; |
599cee73 | 578 | @a =~ /abc/ ; |
c6771ab6 FC |
579 | @a2 =~ s/a/b/ ; |
580 | @a3 =~ tr/a/b/ ; | |
599cee73 PM |
581 | @$b =~ /abc/ ; |
582 | @$b =~ s/a/b/ ; | |
583 | @$b =~ tr/a/b/ ; | |
584 | %a =~ /abc/ ; | |
c6771ab6 FC |
585 | %a2 =~ s/a/b/ ; |
586 | %a3 =~ tr/a/b/ ; | |
599cee73 PM |
587 | %$c =~ /abc/ ; |
588 | %$c =~ s/a/b/ ; | |
589 | %$c =~ tr/a/b/ ; | |
b08e453b | 590 | $d =~ tr/a/b/d ; |
c6771ab6 | 591 | $d2 =~ tr/a/bc/; |
0453d815 | 592 | { |
e476b1b5 | 593 | no warnings 'misc' ; |
b08e453b | 594 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; my $d = 'test'; |
0453d815 PM |
595 | @a =~ /abc/ ; |
596 | @a =~ s/a/b/ ; | |
597 | @a =~ tr/a/b/ ; | |
598 | @$b =~ /abc/ ; | |
599 | @$b =~ s/a/b/ ; | |
600 | @$b =~ tr/a/b/ ; | |
601 | %a =~ /abc/ ; | |
602 | %a =~ s/a/b/ ; | |
603 | %a =~ tr/a/b/ ; | |
604 | %$c =~ /abc/ ; | |
605 | %$c =~ s/a/b/ ; | |
606 | %$c =~ tr/a/b/ ; | |
b08e453b RB |
607 | $d =~ tr/a/b/d ; |
608 | $d =~ tr/a/bc/ ; | |
0453d815 | 609 | } |
599cee73 | 610 | EXPECT |
c6771ab6 FC |
611 | Applying pattern match (m//) to @a will act on scalar(@a) at - line 5. |
612 | Applying substitution (s///) to @a2 will act on scalar(@a2) at - line 6. | |
613 | Applying transliteration (tr///) to @a3 will act on scalar(@a3) at - line 7. | |
42d38218 MS |
614 | Applying pattern match (m//) to @array will act on scalar(@array) at - line 8. |
615 | Applying substitution (s///) to @array will act on scalar(@array) at - line 9. | |
f1612b5c | 616 | Applying transliteration (tr///) to @array will act on scalar(@array) at - line 10. |
c6771ab6 FC |
617 | Applying pattern match (m//) to %a will act on scalar(%a) at - line 11. |
618 | Applying substitution (s///) to %a2 will act on scalar(%a2) at - line 12. | |
619 | Applying transliteration (tr///) to %a3 will act on scalar(%a3) at - line 13. | |
42d38218 MS |
620 | Applying pattern match (m//) to %hash will act on scalar(%hash) at - line 14. |
621 | Applying substitution (s///) to %hash will act on scalar(%hash) at - line 15. | |
f1612b5c | 622 | Applying transliteration (tr///) to %hash will act on scalar(%hash) at - line 16. |
b08e453b RB |
623 | Useless use of /d modifier in transliteration operator at - line 17. |
624 | Replacement list is longer than search list at - line 18. | |
c6771ab6 | 625 | Can't modify array dereference in substitution (s///) at - line 6, near "s/a/b/ ;" |
b08e453b | 626 | BEGIN not safe after errors--compilation aborted at - line 20. |
599cee73 PM |
627 | ######## |
628 | # op.c | |
8473848f | 629 | use warnings 'parenthesis' ; |
599cee73 | 630 | my $a, $b = (1,2); |
8473848f | 631 | my @foo,%bar, $quux; # there's a TAB here |
bac662ee | 632 | my $x, $y or print; |
8473848f | 633 | no warnings 'parenthesis' ; |
0453d815 | 634 | my $c, $d = (1,2); |
599cee73 | 635 | EXPECT |
df5b6949 | 636 | Parentheses missing around "my" list at - line 3. |
8473848f | 637 | Parentheses missing around "my" list at - line 4. |
599cee73 PM |
638 | ######## |
639 | # op.c | |
8473848f RGS |
640 | use warnings 'parenthesis' ; |
641 | our $a, $b = (1,2); | |
642 | no warnings 'parenthesis' ; | |
643 | our $c, $d = (1,2); | |
644 | EXPECT | |
645 | Parentheses missing around "our" list at - line 3. | |
646 | ######## | |
647 | # op.c | |
648 | use warnings 'parenthesis' ; | |
599cee73 | 649 | local $a, $b = (1,2); |
8473848f RGS |
650 | local *f, *g; |
651 | no warnings 'parenthesis' ; | |
0453d815 | 652 | local $c, $d = (1,2); |
599cee73 | 653 | EXPECT |
df5b6949 | 654 | Parentheses missing around "local" list at - line 3. |
8473848f | 655 | Parentheses missing around "local" list at - line 4. |
599cee73 PM |
656 | ######## |
657 | # op.c | |
e476b1b5 | 658 | use warnings 'bareword' ; |
599cee73 | 659 | print (ABC || 1) ; |
e476b1b5 | 660 | no warnings 'bareword' ; |
0453d815 | 661 | print (ABC || 1) ; |
599cee73 | 662 | EXPECT |
34d09196 | 663 | Bareword found in conditional at - line 3. |
599cee73 PM |
664 | ######## |
665 | --FILE-- abc | |
666 | ||
667 | --FILE-- | |
668 | # op.c | |
e476b1b5 | 669 | use warnings 'misc' ; |
599cee73 PM |
670 | open FH, "<abc" ; |
671 | $x = 1 if $x = <FH> ; | |
502e5101 NC |
672 | $x = 1 if $x |
673 | = <FH> ; | |
e476b1b5 | 674 | no warnings 'misc' ; |
0453d815 | 675 | $x = 1 if $x = <FH> ; |
502e5101 NC |
676 | $x = 1 if $x |
677 | = <FH> ; | |
599cee73 PM |
678 | EXPECT |
679 | Value of <HANDLE> construct can be "0"; test with defined() at - line 4. | |
502e5101 | 680 | Value of <HANDLE> construct can be "0"; test with defined() at - line 5. |
599cee73 PM |
681 | ######## |
682 | # op.c | |
e476b1b5 | 683 | use warnings 'misc' ; |
599cee73 PM |
684 | opendir FH, "." ; |
685 | $x = 1 if $x = readdir FH ; | |
502e5101 NC |
686 | $x = 1 if $x |
687 | = readdir FH ; | |
e476b1b5 | 688 | no warnings 'misc' ; |
0453d815 | 689 | $x = 1 if $x = readdir FH ; |
502e5101 NC |
690 | $x = 1 if $x |
691 | = readdir FH ; | |
599cee73 PM |
692 | closedir FH ; |
693 | EXPECT | |
694 | Value of readdir() operator can be "0"; test with defined() at - line 4. | |
502e5101 | 695 | Value of readdir() operator can be "0"; test with defined() at - line 5. |
599cee73 PM |
696 | ######## |
697 | # op.c | |
e476b1b5 | 698 | use warnings 'misc' ; |
599cee73 | 699 | $x = 1 if $x = <*> ; |
502e5101 NC |
700 | $x = 1 if $x |
701 | = <*> ; | |
e476b1b5 | 702 | no warnings 'misc' ; |
0453d815 | 703 | $x = 1 if $x = <*> ; |
502e5101 NC |
704 | $x = 1 if $x |
705 | = <*> ; | |
599cee73 PM |
706 | EXPECT |
707 | Value of glob construct can be "0"; test with defined() at - line 3. | |
502e5101 | 708 | Value of glob construct can be "0"; test with defined() at - line 4. |
599cee73 PM |
709 | ######## |
710 | # op.c | |
e476b1b5 | 711 | use warnings 'misc' ; |
599cee73 PM |
712 | %a = (1,2,3,4) ; |
713 | $x = 1 if $x = each %a ; | |
e476b1b5 | 714 | no warnings 'misc' ; |
0453d815 | 715 | $x = 1 if $x = each %a ; |
599cee73 PM |
716 | EXPECT |
717 | Value of each() operator can be "0"; test with defined() at - line 4. | |
718 | ######## | |
719 | # op.c | |
e476b1b5 | 720 | use warnings 'misc' ; |
599cee73 | 721 | $x = 1 while $x = <*> and 0 ; |
e476b1b5 | 722 | no warnings 'misc' ; |
0453d815 | 723 | $x = 1 while $x = <*> and 0 ; |
599cee73 PM |
724 | EXPECT |
725 | Value of glob construct can be "0"; test with defined() at - line 3. | |
726 | ######## | |
727 | # op.c | |
e476b1b5 | 728 | use warnings 'misc' ; |
599cee73 PM |
729 | opendir FH, "." ; |
730 | $x = 1 while $x = readdir FH and 0 ; | |
e476b1b5 | 731 | no warnings 'misc' ; |
0453d815 | 732 | $x = 1 while $x = readdir FH and 0 ; |
599cee73 PM |
733 | closedir FH ; |
734 | EXPECT | |
735 | Value of readdir() operator can be "0"; test with defined() at - line 4. | |
736 | ######## | |
737 | # op.c | |
59e10468 RGS |
738 | use warnings 'misc'; |
739 | open FH, "<abc"; | |
59e10468 RGS |
740 | ($_ = <FH>) // ($_ = 1); |
741 | opendir DH, "."; | |
59e10468 | 742 | %a = (1,2,3,4) ; |
59e10468 RGS |
743 | EXPECT |
744 | ######## | |
745 | # op.c | |
4438c4b7 | 746 | use warnings 'redefine' ; |
599cee73 PM |
747 | sub fred {} |
748 | sub fred {} | |
2d4e1700 NC |
749 | sub fred { # warning should be for this line |
750 | } | |
4438c4b7 | 751 | no warnings 'redefine' ; |
0453d815 | 752 | sub fred {} |
2d4e1700 NC |
753 | sub fred { |
754 | } | |
599cee73 PM |
755 | EXPECT |
756 | Subroutine fred redefined at - line 4. | |
2d4e1700 | 757 | Subroutine fred redefined at - line 5. |
599cee73 PM |
758 | ######## |
759 | # op.c | |
4438c4b7 | 760 | use warnings 'redefine' ; |
599cee73 PM |
761 | sub fred () { 1 } |
762 | sub fred () { 1 } | |
4438c4b7 | 763 | no warnings 'redefine' ; |
0453d815 | 764 | sub fred () { 1 } |
599cee73 PM |
765 | EXPECT |
766 | Constant subroutine fred redefined at - line 4. | |
767 | ######## | |
768 | # op.c | |
efcf35c4 FC |
769 | sub fred () { 1 } |
770 | sub fred () { 2 } | |
771 | EXPECT | |
772 | Constant subroutine fred redefined at - line 3. | |
773 | ######## | |
774 | # op.c | |
775 | sub fred () { 1 } | |
776 | *fred = sub () { 2 }; | |
777 | EXPECT | |
778 | Constant subroutine main::fred redefined at - line 3. | |
779 | ######## | |
780 | # op.c | |
ee0832ce FC |
781 | use feature "lexical_subs", "state"; |
782 | my sub fred () { 1 } | |
783 | sub fred { 2 }; | |
784 | my sub george { 1 } | |
785 | sub george () { 2 } # should *not* produce redef warnings by default | |
786 | state sub phred () { 1 } | |
787 | sub phred { 2 }; | |
788 | state sub jorge { 1 } | |
789 | sub jorge () { 2 } # should *not* produce redef warnings by default | |
790 | EXPECT | |
791 | The lexical_subs feature is experimental at - line 2. | |
792 | Prototype mismatch: sub fred () vs none at - line 4. | |
793 | Constant subroutine fred redefined at - line 4. | |
794 | Prototype mismatch: sub george: none vs () at - line 6. | |
795 | Prototype mismatch: sub phred () vs none at - line 8. | |
796 | Constant subroutine phred redefined at - line 8. | |
797 | Prototype mismatch: sub jorge: none vs () at - line 10. | |
798 | ######## | |
799 | # op.c | |
036b4402 GS |
800 | no warnings 'redefine' ; |
801 | sub fred () { 1 } | |
802 | sub fred () { 2 } | |
803 | EXPECT | |
036b4402 GS |
804 | ######## |
805 | # op.c | |
806 | no warnings 'redefine' ; | |
807 | sub fred () { 1 } | |
808 | *fred = sub () { 2 }; | |
809 | EXPECT | |
036b4402 GS |
810 | ######## |
811 | # op.c | |
4438c4b7 | 812 | use warnings 'redefine' ; |
599cee73 PM |
813 | format FRED = |
814 | . | |
815 | format FRED = | |
816 | . | |
4438c4b7 | 817 | no warnings 'redefine' ; |
0453d815 PM |
818 | format FRED = |
819 | . | |
599cee73 PM |
820 | EXPECT |
821 | Format FRED redefined at - line 5. | |
822 | ######## | |
823 | # op.c | |
599cee73 | 824 | push FRED; |
e476b1b5 | 825 | no warnings 'deprecated' ; |
0453d815 | 826 | push FRED; |
599cee73 | 827 | EXPECT |
d1d15184 | 828 | Array @FRED missing the @ in argument 1 of push() at - line 2. |
599cee73 PM |
829 | ######## |
830 | # op.c | |
599cee73 | 831 | @a = keys FRED ; |
e476b1b5 | 832 | no warnings 'deprecated' ; |
0453d815 | 833 | @a = keys FRED ; |
599cee73 | 834 | EXPECT |
d1d15184 | 835 | Hash %FRED missing the % in argument 1 of keys() at - line 2. |
599cee73 PM |
836 | ######## |
837 | # op.c | |
4438c4b7 | 838 | use warnings 'syntax' ; |
dfe13c55 | 839 | exec "$^X -e 1" ; |
599cee73 PM |
840 | my $a |
841 | EXPECT | |
7b903762 | 842 | Statement unlikely to be reached at - line 4. |
cc507455 | 843 | (Maybe you meant system() when you said exec()?) |
69794302 | 844 | ######## |
ea31ed66 GG |
845 | # op.c, no warning if exec isn't a statement. |
846 | use warnings 'syntax' ; | |
847 | $a || exec "$^X -e 1" ; | |
848 | my $a | |
849 | EXPECT | |
850 | ######## | |
69794302 | 851 | # op.c |
b880f709 NC |
852 | defined(@a); |
853 | EXPECT | |
854 | defined(@array) is deprecated at - line 2. | |
855 | (Maybe you should just omit the defined()?) | |
856 | ######## | |
857 | # op.c | |
69794302 MJD |
858 | my @a; defined(@a); |
859 | EXPECT | |
d1d15184 | 860 | defined(@array) is deprecated at - line 2. |
cc507455 | 861 | (Maybe you should just omit the defined()?) |
69794302 MJD |
862 | ######## |
863 | # op.c | |
69794302 MJD |
864 | defined(@a = (1,2,3)); |
865 | EXPECT | |
d1d15184 | 866 | defined(@array) is deprecated at - line 2. |
cc507455 | 867 | (Maybe you should just omit the defined()?) |
69794302 MJD |
868 | ######## |
869 | # op.c | |
b880f709 NC |
870 | defined(%h); |
871 | EXPECT | |
872 | defined(%hash) is deprecated at - line 2. | |
873 | (Maybe you should just omit the defined()?) | |
874 | ######## | |
875 | # op.c | |
69794302 MJD |
876 | my %h; defined(%h); |
877 | EXPECT | |
d1d15184 | 878 | defined(%hash) is deprecated at - line 2. |
cc507455 | 879 | (Maybe you should just omit the defined()?) |
0453d815 PM |
880 | ######## |
881 | # op.c | |
4438c4b7 | 882 | no warnings 'syntax' ; |
0453d815 PM |
883 | exec "$^X -e 1" ; |
884 | my $a | |
885 | EXPECT | |
886 | ||
887 | ######## | |
888 | # op.c | |
889 | sub fred(); | |
890 | sub fred($) {} | |
105ff74c FC |
891 | use constant foo=>bar; sub foo(@); |
892 | use constant bav=>bar; sub bav(); # no warning | |
893 | sub btu; sub btu(); | |
0453d815 PM |
894 | EXPECT |
895 | Prototype mismatch: sub main::fred () vs ($) at - line 3. | |
105ff74c FC |
896 | Prototype mismatch: sub foo () vs (@) at - line 4. |
897 | Prototype mismatch: sub btu: none vs () at - line 6. | |
0453d815 PM |
898 | ######## |
899 | # op.c | |
dab1c735 BF |
900 | use utf8; |
901 | use open qw( :utf8 :std ); | |
902 | sub frèd(); | |
903 | sub frèd($) {} | |
904 | EXPECT | |
905 | Prototype mismatch: sub main::frèd () vs ($) at - line 5. | |
906 | ######## | |
907 | # op.c | |
908 | use utf8; | |
909 | use open qw( :utf8 :std ); | |
910 | use warnings; | |
911 | eval "sub fòò (\$\0) {}"; | |
912 | EXPECT | |
97eb901d | 913 | Illegal character in prototype for main::fòò : $\0 at (eval 1) line 1. |
dab1c735 BF |
914 | ######## |
915 | # op.c | |
916 | use utf8; | |
917 | use open qw( :utf8 :std ); | |
918 | use warnings; | |
919 | eval "sub foo (\0) {}"; | |
920 | EXPECT | |
97eb901d | 921 | Illegal character in prototype for main::foo : \0 at (eval 1) line 1. |
dab1c735 BF |
922 | ######## |
923 | # op.c | |
924 | use utf8; | |
925 | use open qw( :utf8 :std ); | |
926 | use warnings; | |
927 | BEGIN { $::{"foo"} = "\$\0L\351on" } | |
928 | BEGIN { eval "sub foo (\$\0L\x{c3}\x{a9}on) {}"; } | |
929 | EXPECT | |
930 | Illegal character in prototype for main::foo : $\x{0}L... at (eval 1) line 1. | |
931 | ######## | |
932 | # op.c | |
933 | use utf8; | |
934 | use open qw( :utf8 :std ); | |
935 | use warnings; | |
936 | BEGIN { eval "sub foo (\0) {}"; } | |
937 | EXPECT | |
97eb901d BF |
938 | Illegal character in prototype for main::foo : \0 at (eval 1) line 1. |
939 | ######## | |
940 | # op.c | |
941 | use warnings; | |
942 | eval "sub foo (\xAB) {}"; | |
943 | EXPECT | |
944 | Illegal character in prototype for main::foo : \x{ab} at (eval 1) line 1. | |
945 | ######## | |
946 | # op.c | |
947 | use utf8; | |
948 | use open qw( :utf8 :std ); | |
949 | use warnings; | |
950 | BEGIN { eval "sub foo (\x{30cb}) {}"; } | |
951 | EXPECT | |
952 | Illegal character in prototype for main::foo : \x{30cb} at (eval 1) line 1. | |
dab1c735 BF |
953 | ######## |
954 | # op.c | |
955 | use utf8; | |
956 | use open qw( :utf8 :std ); | |
957 | use warnings; | |
958 | BEGIN { $::{"foo"} = "\x{30cb}" } | |
959 | BEGIN { eval "sub foo {}"; } | |
960 | EXPECT | |
961 | Prototype mismatch: sub main::foo (ニ) vs none at (eval 1) line 1. | |
962 | ######## | |
963 | # op.c | |
0453d815 PM |
964 | $^W = 0 ; |
965 | sub fred() ; | |
966 | sub fred($) {} | |
967 | { | |
e476b1b5 | 968 | no warnings 'prototype' ; |
0453d815 PM |
969 | sub Fred() ; |
970 | sub Fred($) {} | |
e476b1b5 | 971 | use warnings 'prototype' ; |
0453d815 PM |
972 | sub freD() ; |
973 | sub freD($) {} | |
974 | } | |
975 | sub FRED() ; | |
976 | sub FRED($) {} | |
977 | EXPECT | |
978 | Prototype mismatch: sub main::fred () vs ($) at - line 4. | |
979 | Prototype mismatch: sub main::freD () vs ($) at - line 11. | |
980 | Prototype mismatch: sub main::FRED () vs ($) at - line 14. | |
eb6e2d6f | 981 | ######## |
271c8bde FC |
982 | # op.c [S_simplify_sort] |
983 | # [perl #86136] | |
984 | my @tests = split /^/, ' | |
985 | sort {$a <=> $b} @a; | |
986 | sort {$a cmp $b} @a; | |
987 | { use integer; sort {$a <=> $b} @a} | |
988 | sort {$b <=> $a} @a; | |
989 | sort {$b cmp $a} @a; | |
990 | { use integer; sort {$b <=> $a} @a} | |
991 | '; | |
992 | for my $pragma ('use warnings "syntax";', '') { | |
993 | for my $vars ('', 'my $a;', 'my $b;', 'my ($a,$b);') { | |
994 | for my $inner_stmt ('', 'print;', 'func();') { | |
995 | eval "#line " . ++$line . "01 -\n$pragma\n$vars" | |
996 | . join "", map s/sort \{\K/$inner_stmt/r, @tests; | |
997 | $@ and die; | |
998 | } | |
999 | } | |
1000 | } | |
1001 | sub func{} | |
1002 | use warnings 'syntax'; | |
1003 | my $a; | |
1004 | # These used to be errors! | |
1005 | sort { ; } $a <=> $b; | |
1006 | sort { ; } $a, "<=>"; | |
1007 | sort { ; } $a, $cmp; | |
1008 | sort $a, $b if $cmpany_name; | |
1009 | sort if $a + $cmp; | |
1010 | sort @t; $a + $cmp; | |
1011 | EXPECT | |
1012 | "my $a" used in sort comparison at - line 403. | |
1013 | "my $a" used in sort comparison at - line 404. | |
1014 | "my $a" used in sort comparison at - line 405. | |
1015 | "my $a" used in sort comparison at - line 406. | |
1016 | "my $a" used in sort comparison at - line 407. | |
1017 | "my $a" used in sort comparison at - line 408. | |
1018 | "my $a" used in sort comparison at - line 503. | |
1019 | "my $a" used in sort comparison at - line 504. | |
1020 | "my $a" used in sort comparison at - line 505. | |
1021 | "my $a" used in sort comparison at - line 506. | |
1022 | "my $a" used in sort comparison at - line 507. | |
1023 | "my $a" used in sort comparison at - line 508. | |
1024 | "my $a" used in sort comparison at - line 603. | |
1025 | "my $a" used in sort comparison at - line 604. | |
1026 | "my $a" used in sort comparison at - line 605. | |
1027 | "my $a" used in sort comparison at - line 606. | |
1028 | "my $a" used in sort comparison at - line 607. | |
1029 | "my $a" used in sort comparison at - line 608. | |
1030 | "my $b" used in sort comparison at - line 703. | |
1031 | "my $b" used in sort comparison at - line 704. | |
1032 | "my $b" used in sort comparison at - line 705. | |
1033 | "my $b" used in sort comparison at - line 706. | |
1034 | "my $b" used in sort comparison at - line 707. | |
1035 | "my $b" used in sort comparison at - line 708. | |
1036 | "my $b" used in sort comparison at - line 803. | |
1037 | "my $b" used in sort comparison at - line 804. | |
1038 | "my $b" used in sort comparison at - line 805. | |
1039 | "my $b" used in sort comparison at - line 806. | |
1040 | "my $b" used in sort comparison at - line 807. | |
1041 | "my $b" used in sort comparison at - line 808. | |
1042 | "my $b" used in sort comparison at - line 903. | |
1043 | "my $b" used in sort comparison at - line 904. | |
1044 | "my $b" used in sort comparison at - line 905. | |
1045 | "my $b" used in sort comparison at - line 906. | |
1046 | "my $b" used in sort comparison at - line 907. | |
1047 | "my $b" used in sort comparison at - line 908. | |
1048 | "my $a" used in sort comparison at - line 1003. | |
1049 | "my $b" used in sort comparison at - line 1003. | |
1050 | "my $a" used in sort comparison at - line 1004. | |
1051 | "my $b" used in sort comparison at - line 1004. | |
1052 | "my $a" used in sort comparison at - line 1005. | |
1053 | "my $b" used in sort comparison at - line 1005. | |
1054 | "my $b" used in sort comparison at - line 1006. | |
1055 | "my $a" used in sort comparison at - line 1006. | |
1056 | "my $b" used in sort comparison at - line 1007. | |
1057 | "my $a" used in sort comparison at - line 1007. | |
1058 | "my $b" used in sort comparison at - line 1008. | |
1059 | "my $a" used in sort comparison at - line 1008. | |
1060 | "my $a" used in sort comparison at - line 1103. | |
1061 | "my $b" used in sort comparison at - line 1103. | |
1062 | "my $a" used in sort comparison at - line 1104. | |
1063 | "my $b" used in sort comparison at - line 1104. | |
1064 | "my $a" used in sort comparison at - line 1105. | |
1065 | "my $b" used in sort comparison at - line 1105. | |
1066 | "my $b" used in sort comparison at - line 1106. | |
1067 | "my $a" used in sort comparison at - line 1106. | |
1068 | "my $b" used in sort comparison at - line 1107. | |
1069 | "my $a" used in sort comparison at - line 1107. | |
1070 | "my $b" used in sort comparison at - line 1108. | |
1071 | "my $a" used in sort comparison at - line 1108. | |
1072 | "my $a" used in sort comparison at - line 1203. | |
1073 | "my $b" used in sort comparison at - line 1203. | |
1074 | "my $a" used in sort comparison at - line 1204. | |
1075 | "my $b" used in sort comparison at - line 1204. | |
1076 | "my $a" used in sort comparison at - line 1205. | |
1077 | "my $b" used in sort comparison at - line 1205. | |
1078 | "my $b" used in sort comparison at - line 1206. | |
1079 | "my $a" used in sort comparison at - line 1206. | |
1080 | "my $b" used in sort comparison at - line 1207. | |
1081 | "my $a" used in sort comparison at - line 1207. | |
1082 | "my $b" used in sort comparison at - line 1208. | |
1083 | "my $a" used in sort comparison at - line 1208. | |
1084 | ######## | |
a2e39214 FC |
1085 | # op.c [S_simplify_sort] |
1086 | use warnings 'syntax'; use 5.01; | |
1087 | state $a; | |
1088 | sort { $a <=> $b } (); | |
1089 | EXPECT | |
1090 | "state $a" used in sort comparison at - line 4. | |
1091 | ######## | |
89474f50 FC |
1092 | # op.c [Perl_ck_cmp] |
1093 | use warnings 'syntax' ; | |
1094 | no warnings 'deprecated'; | |
1095 | @a = $[ < 5; | |
1096 | @a = $[ > 5; | |
1097 | @a = $[ <= 5; | |
1098 | @a = $[ >= 5; | |
1099 | @a = 42 < $[; | |
1100 | @a = 42 > $[; | |
1101 | @a = 42 <= $[; | |
1102 | @a = 42 >= $[; | |
1103 | use integer; | |
1104 | @a = $[ < 5; | |
1105 | @a = $[ > 5; | |
1106 | @a = $[ <= 5; | |
1107 | @a = $[ >= 5; | |
1108 | @a = 42 < $[; | |
1109 | @a = 42 > $[; | |
1110 | @a = 42 <= $[; | |
1111 | @a = 42 >= $[; | |
7c2b3c78 FC |
1112 | no integer; |
1113 | @a = $[ < $5; | |
1114 | @a = $[ > $5; | |
1115 | @a = $[ <= $5; | |
1116 | @a = $[ >= $5; | |
1117 | @a = $42 < $[; | |
1118 | @a = $42 > $[; | |
1119 | @a = $42 <= $[; | |
1120 | @a = $42 >= $[; | |
1121 | use integer; | |
1122 | @a = $[ < $5; | |
1123 | @a = $[ > $5; | |
1124 | @a = $[ <= $5; | |
1125 | @a = $[ >= $5; | |
1126 | @a = $42 < $[; | |
1127 | @a = $42 > $[; | |
1128 | @a = $42 <= $[; | |
1129 | @a = $42 >= $[; | |
89474f50 FC |
1130 | EXPECT |
1131 | $[ used in numeric lt (<) (did you mean $] ?) at - line 4. | |
1132 | $[ used in numeric gt (>) (did you mean $] ?) at - line 5. | |
1133 | $[ used in numeric le (<=) (did you mean $] ?) at - line 6. | |
1134 | $[ used in numeric ge (>=) (did you mean $] ?) at - line 7. | |
1135 | $[ used in numeric lt (<) (did you mean $] ?) at - line 8. | |
1136 | $[ used in numeric gt (>) (did you mean $] ?) at - line 9. | |
1137 | $[ used in numeric le (<=) (did you mean $] ?) at - line 10. | |
1138 | $[ used in numeric ge (>=) (did you mean $] ?) at - line 11. | |
1139 | $[ used in numeric lt (<) (did you mean $] ?) at - line 13. | |
1140 | $[ used in numeric gt (>) (did you mean $] ?) at - line 14. | |
1141 | $[ used in numeric le (<=) (did you mean $] ?) at - line 15. | |
1142 | $[ used in numeric ge (>=) (did you mean $] ?) at - line 16. | |
1143 | $[ used in numeric lt (<) (did you mean $] ?) at - line 17. | |
1144 | $[ used in numeric gt (>) (did you mean $] ?) at - line 18. | |
1145 | $[ used in numeric le (<=) (did you mean $] ?) at - line 19. | |
1146 | $[ used in numeric ge (>=) (did you mean $] ?) at - line 20. | |
1147 | ######## | |
e508c8a4 MH |
1148 | # op.c [Perl_ck_length] |
1149 | use warnings 'syntax' ; | |
1150 | length(@a); | |
579333ee FC |
1151 | length(%b); |
1152 | length(@$c); | |
1153 | length(%$d); | |
e508c8a4 | 1154 | length($a); |
9710ad41 | 1155 | length(my %h); |
579333ee | 1156 | length(my @g); |
e508c8a4 | 1157 | EXPECT |
579333ee FC |
1158 | length() used on @a (did you mean "scalar(@a)"?) at - line 3. |
1159 | length() used on %b (did you mean "scalar(keys %b)"?) at - line 4. | |
e508c8a4 MH |
1160 | length() used on @array (did you mean "scalar(@array)"?) at - line 5. |
1161 | length() used on %hash (did you mean "scalar(keys %hash)"?) at - line 6. | |
579333ee FC |
1162 | length() used on %h (did you mean "scalar(keys %h)"?) at - line 8. |
1163 | length() used on @g (did you mean "scalar(@g)"?) at - line 9. | |
e508c8a4 | 1164 | ######## |
eb6e2d6f GS |
1165 | # op.c |
1166 | use warnings 'syntax' ; | |
1167 | join /---/, 'x', 'y', 'z'; | |
1168 | EXPECT | |
1169 | /---/ should probably be written as "---" at - line 3. | |
767a6a26 | 1170 | ######## |
ce16c625 BF |
1171 | # op.c |
1172 | use utf8; | |
1173 | use open qw( :utf8 :std ); | |
1174 | use warnings 'syntax' ; | |
1175 | join /~~~/, 'x', 'y', 'z'; | |
1176 | EXPECT | |
1177 | /~~~/ should probably be written as "~~~" at - line 5. | |
1178 | ######## | |
767a6a26 | 1179 | # op.c [Perl_peep] |
e476b1b5 | 1180 | use warnings 'prototype' ; |
767a6a26 PM |
1181 | fred() ; |
1182 | sub fred ($$) {} | |
e476b1b5 | 1183 | no warnings 'prototype' ; |
767a6a26 PM |
1184 | joe() ; |
1185 | sub joe ($$) {} | |
1186 | EXPECT | |
1187 | main::fred() called too early to check prototype at - line 3. | |
ddda08b7 GS |
1188 | ######## |
1189 | # op.c [Perl_newATTRSUB] | |
1190 | --FILE-- abc.pm | |
1191 | use warnings 'void' ; | |
1192 | BEGIN { $| = 1; print "in begin\n"; } | |
1193 | CHECK { print "in check\n"; } | |
1194 | INIT { print "in init\n"; } | |
1195 | END { print "in end\n"; } | |
1196 | print "in mainline\n"; | |
1197 | 1; | |
1198 | --FILE-- | |
1199 | use abc; | |
1200 | delete $INC{"abc.pm"}; | |
1201 | require abc; | |
1202 | do "abc.pm"; | |
1203 | EXPECT | |
1204 | in begin | |
1205 | in mainline | |
1206 | in check | |
1207 | in init | |
1208 | in begin | |
1209 | Too late to run CHECK block at abc.pm line 3. | |
1210 | Too late to run INIT block at abc.pm line 4. | |
1211 | in mainline | |
1212 | in begin | |
1213 | Too late to run CHECK block at abc.pm line 3. | |
1214 | Too late to run INIT block at abc.pm line 4. | |
1215 | in mainline | |
1216 | in end | |
1217 | in end | |
1218 | in end | |
1219 | ######## | |
1220 | # op.c [Perl_newATTRSUB] | |
1221 | --FILE-- abc.pm | |
1222 | no warnings 'void' ; | |
1223 | BEGIN { $| = 1; print "in begin\n"; } | |
1224 | CHECK { print "in check\n"; } | |
1225 | INIT { print "in init\n"; } | |
1226 | END { print "in end\n"; } | |
1227 | print "in mainline\n"; | |
1228 | 1; | |
1229 | --FILE-- | |
1230 | require abc; | |
1231 | do "abc.pm"; | |
1232 | EXPECT | |
1233 | in begin | |
1234 | in mainline | |
1235 | in begin | |
1236 | in mainline | |
1237 | in end | |
1238 | in end | |
936edb8b RH |
1239 | ######## |
1240 | # op.c | |
1241 | my @x; | |
f87c3213 | 1242 | use warnings 'syntax' ; |
936edb8b RH |
1243 | push(@x); |
1244 | unshift(@x); | |
f87c3213 | 1245 | no warnings 'syntax' ; |
936edb8b RH |
1246 | push(@x); |
1247 | unshift(@x); | |
1248 | EXPECT | |
de4864e4 JH |
1249 | Useless use of push with no values at - line 4. |
1250 | Useless use of unshift with no values at - line 5. | |
a27978d3 AMS |
1251 | ######## |
1252 | # op.c | |
f34840d8 MJD |
1253 | # 20020401 mjd@plover.com at suggestion of jfriedl@yahoo.com |
1254 | use warnings 'regexp'; | |
1255 | split /blah/g, "blah"; | |
1256 | no warnings 'regexp'; | |
1257 | split /blah/g, "blah"; | |
1258 | EXPECT | |
1259 | Use of /g modifier is meaningless in split at - line 4. | |
276b2a0c RGS |
1260 | ######## |
1261 | # op.c | |
1262 | use warnings 'precedence'; | |
1263 | $a = $b & $c == $d; | |
1264 | $a = $b ^ $c != $d; | |
1265 | $a = $b | $c > $d; | |
1266 | $a = $b < $c & $d; | |
1267 | $a = $b >= $c ^ $d; | |
1268 | $a = $b <= $c | $d; | |
1269 | $a = $b <=> $c & $d; | |
2b84528b | 1270 | $a &= $b == $c; $a |= $b == $c; $a ^= $b == $c; # shouldn't warn |
276b2a0c RGS |
1271 | no warnings 'precedence'; |
1272 | $a = $b & $c == $d; | |
1273 | $a = $b ^ $c != $d; | |
1274 | $a = $b | $c > $d; | |
1275 | $a = $b < $c & $d; | |
1276 | $a = $b >= $c ^ $d; | |
1277 | $a = $b <= $c | $d; | |
1278 | $a = $b <=> $c & $d; | |
1279 | EXPECT | |
1280 | Possible precedence problem on bitwise & operator at - line 3. | |
1281 | Possible precedence problem on bitwise ^ operator at - line 4. | |
1282 | Possible precedence problem on bitwise | operator at - line 5. | |
1283 | Possible precedence problem on bitwise & operator at - line 6. | |
1284 | Possible precedence problem on bitwise ^ operator at - line 7. | |
1285 | Possible precedence problem on bitwise | operator at - line 8. | |
1286 | Possible precedence problem on bitwise & operator at - line 9. | |
1287 | ######## | |
1288 | # op.c | |
1289 | use integer; | |
1290 | use warnings 'precedence'; | |
1291 | $a = $b & $c == $d; | |
1292 | $a = $b ^ $c != $d; | |
1293 | $a = $b | $c > $d; | |
1294 | $a = $b < $c & $d; | |
1295 | $a = $b >= $c ^ $d; | |
1296 | $a = $b <= $c | $d; | |
1297 | $a = $b <=> $c & $d; | |
1298 | no warnings 'precedence'; | |
1299 | $a = $b & $c == $d; | |
1300 | $a = $b ^ $c != $d; | |
1301 | $a = $b | $c > $d; | |
1302 | $a = $b < $c & $d; | |
1303 | $a = $b >= $c ^ $d; | |
1304 | $a = $b <= $c | $d; | |
1305 | $a = $b <=> $c & $d; | |
1306 | EXPECT | |
1307 | Possible precedence problem on bitwise & operator at - line 4. | |
1308 | Possible precedence problem on bitwise ^ operator at - line 5. | |
1309 | Possible precedence problem on bitwise | operator at - line 6. | |
1310 | Possible precedence problem on bitwise & operator at - line 7. | |
1311 | Possible precedence problem on bitwise ^ operator at - line 8. | |
1312 | Possible precedence problem on bitwise | operator at - line 9. | |
1313 | Possible precedence problem on bitwise & operator at - line 10. | |
ddeae0f1 DM |
1314 | ######## |
1315 | # op.c | |
1316 | ||
1317 | # ok => local() has desired effect; | |
1318 | # ignore=> local() silently ignored | |
1319 | ||
1320 | use warnings 'syntax'; | |
1321 | ||
1322 | local(undef); # OP_UNDEF ignore | |
1323 | sub lval : lvalue {}; | |
1324 | local(lval()); # OP_ENTERSUB | |
1325 | local($x **= 1); # OP_POW | |
1326 | local($x *= 1); # OP_MULTIPLY | |
1327 | local($x /= 1); # OP_DIVIDE | |
1328 | local($x %= 1); # OP_MODULO | |
1329 | local($x x= 1); # OP_REPEAT | |
1330 | local($x += 1); # OP_ADD | |
1331 | local($x -= 1); # OP_SUBTRACT | |
1332 | local($x .= 1); # OP_CONCAT | |
1333 | local($x <<= 1); # OP_LEFT_SHIFT | |
1334 | local($x >>= 1); # OP_RIGHT_SHIFT | |
1335 | local($x &= 1); # OP_BIT_AND | |
1336 | local($x ^= 1); # OP_BIT_XOR | |
1337 | local($x |= 1); # OP_BIT_OR | |
1338 | { | |
1339 | use integer; | |
1340 | local($x *= 1); # OP_I_MULTIPLY | |
1341 | local($x /= 1); # OP_I_DIVIDE | |
1342 | local($x %= 1); # OP_I_MODULO | |
1343 | local($x += 1); # OP_I_ADD | |
1344 | local($x -= 1); # OP_I_SUBTRACT | |
1345 | } | |
1346 | local($x?$y:$z) = 1; # OP_COND_EXPR ok | |
1347 | # these two are fatal run-time errors instead | |
1348 | #local(@$a); # OP_RV2AV ok | |
1349 | #local(%$a); # OP_RV2HV ok | |
1350 | local(*a); # OP_RV2GV ok | |
1351 | local(@a[1,2]); # OP_ASLICE ok | |
1352 | local(@a{1,2}); # OP_HSLICE ok | |
1353 | local(@a = (1,2)); # OP_AASSIGN | |
1354 | local($$x); # OP_RV2SV ok | |
1355 | local($#a); # OP_AV2ARYLEN | |
1356 | local($x = 1); # OP_SASSIGN | |
1357 | local($x &&= 1); # OP_ANDASSIGN | |
1358 | local($x ||= 1); # OP_ORASSIGN | |
1359 | local($x //= 1); # OP_DORASSIGN | |
1360 | local($a[0]); # OP_AELEMFAST ok | |
1361 | ||
1362 | local(substr($x,0,1)); # OP_SUBSTR | |
1363 | local(pos($x)); # OP_POS | |
1364 | local(vec($x,0,1)); # OP_VEC | |
1365 | local($a[$b]); # OP_AELEM ok | |
1366 | local($a{$b}); # OP_HELEM ok | |
1367 | ||
1368 | no warnings 'syntax'; | |
1369 | EXPECT | |
1370 | Useless localization of subroutine entry at - line 10. | |
1371 | Useless localization of exponentiation (**) at - line 11. | |
1372 | Useless localization of multiplication (*) at - line 12. | |
1373 | Useless localization of division (/) at - line 13. | |
1374 | Useless localization of modulus (%) at - line 14. | |
1375 | Useless localization of repeat (x) at - line 15. | |
1376 | Useless localization of addition (+) at - line 16. | |
1377 | Useless localization of subtraction (-) at - line 17. | |
1378 | Useless localization of concatenation (.) or string at - line 18. | |
1379 | Useless localization of left bitshift (<<) at - line 19. | |
1380 | Useless localization of right bitshift (>>) at - line 20. | |
1381 | Useless localization of bitwise and (&) at - line 21. | |
1382 | Useless localization of bitwise xor (^) at - line 22. | |
1383 | Useless localization of bitwise or (|) at - line 23. | |
1384 | Useless localization of integer multiplication (*) at - line 26. | |
1385 | Useless localization of integer division (/) at - line 27. | |
1386 | Useless localization of integer modulus (%) at - line 28. | |
1387 | Useless localization of integer addition (+) at - line 29. | |
1388 | Useless localization of integer subtraction (-) at - line 30. | |
1389 | Useless localization of list assignment at - line 39. | |
1390 | Useless localization of array length at - line 41. | |
1391 | Useless localization of scalar assignment at - line 42. | |
1392 | Useless localization of logical and assignment (&&=) at - line 43. | |
1393 | Useless localization of logical or assignment (||=) at - line 44. | |
1394 | Useless localization of defined or assignment (//=) at - line 45. | |
1395 | Useless localization of substr at - line 48. | |
1396 | Useless localization of match position at - line 49. | |
1397 | Useless localization of vec at - line 50. | |
7921d0f2 DM |
1398 | ######## |
1399 | # op.c | |
7921d0f2 DM |
1400 | my $x1 if 0; |
1401 | my @x2 if 0; | |
1402 | my %x3 if 0; | |
1403 | my ($x4) if 0; | |
1404 | my ($x5,@x6, %x7) if 0; | |
1405 | 0 && my $z1; | |
1406 | 0 && my (%z2); | |
1407 | # these shouldn't warn | |
1408 | our $x if 0; | |
1409 | our $x unless 0; | |
1410 | if (0) { my $w1 } | |
1411 | if (my $w2) { $a=1 } | |
1412 | if ($a && (my $w3 = 1)) {$a = 2} | |
1413 | ||
1414 | EXPECT | |
d1d15184 | 1415 | Deprecated use of my() in false conditional at - line 2. |
7921d0f2 DM |
1416 | Deprecated use of my() in false conditional at - line 3. |
1417 | Deprecated use of my() in false conditional at - line 4. | |
1418 | Deprecated use of my() in false conditional at - line 5. | |
1419 | Deprecated use of my() in false conditional at - line 6. | |
1420 | Deprecated use of my() in false conditional at - line 7. | |
1421 | Deprecated use of my() in false conditional at - line 8. | |
55b67815 RGS |
1422 | ######## |
1423 | # op.c | |
36b2db7e FC |
1424 | $[ = 1; |
1425 | ($[) = 1; | |
1426 | use warnings 'deprecated'; | |
1427 | $[ = 2; | |
1428 | ($[) = 2; | |
1429 | no warnings 'deprecated'; | |
1430 | $[ = 3; | |
1431 | ($[) = 3; | |
1432 | EXPECT | |
1433 | Use of assignment to $[ is deprecated at - line 2. | |
1434 | Use of assignment to $[ is deprecated at - line 3. | |
1435 | Use of assignment to $[ is deprecated at - line 5. | |
1436 | Use of assignment to $[ is deprecated at - line 6. | |
1437 | ######## | |
1438 | # op.c | |
75068674 RGS |
1439 | use warnings 'void'; |
1440 | @x = split /y/, "z"; | |
1441 | $x = split /y/, "z"; | |
1442 | split /y/, "z"; | |
1443 | no warnings 'void'; | |
1444 | @x = split /y/, "z"; | |
1445 | $x = split /y/, "z"; | |
1446 | split /y/, "z"; | |
1447 | EXPECT | |
1448 | Useless use of split in void context at - line 5. | |
34ee6772 BF |
1449 | ######## |
1450 | # op.c | |
1451 | use warnings 'redefine' ; | |
1452 | use utf8; | |
1453 | use open qw( :utf8 :std ); | |
1454 | sub frèd {} | |
1455 | sub frèd {} | |
1456 | no warnings 'redefine' ; | |
1457 | sub frèd {} | |
1458 | EXPECT | |
1459 | Subroutine frèd redefined at - line 6. | |
1460 | ######## | |
1461 | # op.c | |
1462 | use warnings 'redefine' ; | |
1463 | use utf8; | |
1464 | use open qw( :utf8 :std ); | |
1465 | sub frèd () { 1 } | |
1466 | sub frèd () { 1 } | |
1467 | no warnings 'redefine' ; | |
1468 | sub frèd () { 1 } | |
1469 | EXPECT | |
1470 | Constant subroutine frèd redefined at - line 6. | |
1471 | ######## | |
1472 | # op.c | |
34ee6772 BF |
1473 | use utf8; |
1474 | use open qw( :utf8 :std ); | |
1475 | sub frèd () { 1 } | |
1476 | sub frèd () { 2 } | |
1477 | EXPECT | |
efcf35c4 | 1478 | Constant subroutine frèd redefined at - line 5. |
34ee6772 BF |
1479 | ######## |
1480 | # op.c | |
34ee6772 BF |
1481 | use utf8; |
1482 | use open qw( :utf8 :std ); | |
1483 | sub frèd () { 1 } | |
1484 | *frèd = sub () { 2 }; | |
1485 | EXPECT | |
efcf35c4 | 1486 | Constant subroutine main::frèd redefined at - line 5. |
34ee6772 BF |
1487 | ######## |
1488 | # op.c | |
1489 | use warnings 'redefine' ; | |
1490 | use utf8; | |
1491 | use open qw( :utf8 :std ); | |
1492 | sub ᚠርƊ {} | |
1493 | sub ᚠርƊ {} | |
1494 | no warnings 'redefine' ; | |
1495 | sub ᚠርƊ {} | |
1496 | EXPECT | |
1497 | Subroutine ᚠርƊ redefined at - line 6. | |
1498 | ######## | |
1499 | # op.c | |
1500 | use warnings 'redefine' ; | |
1501 | use utf8; | |
1502 | use open qw( :utf8 :std ); | |
1503 | sub ᚠርƊ () { 1 } | |
1504 | sub ᚠርƊ () { 1 } | |
1505 | no warnings 'redefine' ; | |
1506 | sub ᚠርƊ () { 1 } | |
1507 | EXPECT | |
1508 | Constant subroutine ᚠርƊ redefined at - line 6. | |
1509 | ######## | |
1510 | # op.c | |
34ee6772 BF |
1511 | use utf8; |
1512 | use open qw( :utf8 :std ); | |
1513 | sub ᚠርƊ () { 1 } | |
1514 | sub ᚠርƊ () { 2 } | |
1515 | EXPECT | |
efcf35c4 | 1516 | Constant subroutine ᚠርƊ redefined at - line 5. |
34ee6772 BF |
1517 | ######## |
1518 | # op.c | |
34ee6772 BF |
1519 | use utf8; |
1520 | use open qw( :utf8 :std ); | |
1521 | sub ᚠርƊ () { 1 } | |
1522 | *ᚠርƊ = sub () { 2 }; | |
1523 | EXPECT | |
efcf35c4 | 1524 | Constant subroutine main::ᚠርƊ redefined at - line 5. |
34ee6772 | 1525 | ######## |
d787f4a5 NC |
1526 | # OPTION regex |
1527 | sub DynaLoader::dl_error {}; | |
1528 | use warnings; | |
1529 | # We're testing that the warnings report the same line number: | |
1530 | eval <<'EOC' or die $@; | |
1531 | { | |
1532 | DynaLoader::boot_DynaLoader("DynaLoader"); | |
1533 | } | |
1534 | EOC | |
1535 | eval <<'EOC' or die $@; | |
1536 | BEGIN { | |
1537 | DynaLoader::boot_DynaLoader("DynaLoader"); | |
1538 | } | |
1539 | 1 | |
1540 | EOC | |
1541 | EXPECT | |
1542 | OPTION regex | |
1543 | \ASubroutine DynaLoader::dl_error redefined at \(eval 1\) line 2\. | |
b5ab070a | 1544 | ?(?s).* |
d787f4a5 NC |
1545 | Subroutine DynaLoader::dl_error redefined at \(eval 2\) line 2\. |
1546 | ######## |