Commit | Line | Data |
599cee73 |
1 | toke.c AOK |
2 | |
3 | we seem to have lost a few ambiguous warnings!! |
4 | |
5 | |
599cee73 |
6 | $a = <<; |
7 | Use of comma-less variable list is deprecated |
8 | (called 3 times via depcom) |
9 | |
10 | \1 better written as $1 |
4438c4b7 |
11 | use warnings 'syntax' ; |
599cee73 |
12 | s/(abc)/\1/; |
13 | |
14 | warn(warn_nosemi) |
15 | Semicolon seems to be missing |
16 | $a = 1 |
17 | &time ; |
18 | |
19 | |
20 | Reversed %c= operator |
21 | my $a =+ 2 ; |
22 | $a =- 2 ; |
23 | $a =* 2 ; |
24 | $a =% 2 ; |
25 | $a =& 2 ; |
26 | $a =. 2 ; |
27 | $a =^ 2 ; |
28 | $a =| 2 ; |
29 | $a =< 2 ; |
30 | $a =/ 2 ; |
31 | |
32 | Multidimensional syntax %.*s not supported |
33 | my $a = $a[1,2] ; |
34 | |
35 | You need to quote \"%s\"" |
36 | sub fred {} ; $SIG{TERM} = fred; |
37 | |
38 | Scalar value %.*s better written as $%.*s" |
39 | @a[3] = 2; |
40 | @a{3} = 2; |
41 | |
42 | Can't use \\%c to mean $%c in expression |
43 | $_ = "ab" ; s/(ab)/\1/e; |
44 | |
45 | Unquoted string "abc" may clash with future reserved word at - line 3. |
46 | warn(warn_reserved |
47 | $a = abc; |
48 | |
599cee73 |
49 | Possible attempt to separate words with commas |
50 | @a = qw(a, b, c) ; |
51 | |
52 | Possible attempt to put comments in qw() list |
53 | @a = qw(a b # c) ; |
54 | |
599cee73 |
55 | %s (...) interpreted as function |
56 | print ("") |
57 | printf ("") |
58 | sort ("") |
59 | |
60 | Ambiguous use of %c{%s%s} resolved to %c%s%s |
61 | $a = ${time[2]} |
62 | $a = ${time{2}} |
63 | |
64 | |
65 | Ambiguous use of %c{%s} resolved to %c%s |
66 | $a = ${time} |
67 | sub fred {} $a = ${fred} |
68 | |
69 | Misplaced _ in number |
70 | $a = 1_2; |
71 | $a = 1_2345_6; |
72 | |
73 | Bareword \"%s\" refers to nonexistent package |
74 | $a = FRED:: ; |
75 | |
76 | Ambiguous call resolved as CORE::%s(), qualify as such or use & |
77 | sub time {} |
78 | my $a = time() |
79 | |
767a6a26 |
80 | Unrecognized escape \\%c passed through |
81 | $a = "\m" ; |
82 | |
83 | %s number > %s non-portable |
84 | my $a = 0b011111111111111111111111111111110 ; |
85 | $a = 0b011111111111111111111111111111111 ; |
86 | $a = 0b111111111111111111111111111111111 ; |
87 | $a = 0x0fffffffe ; |
88 | $a = 0x0ffffffff ; |
89 | $a = 0x1ffffffff ; |
90 | $a = 0037777777776 ; |
91 | $a = 0037777777777 ; |
92 | $a = 0047777777777 ; |
93 | |
94 | Integer overflow in binary number |
95 | my $a = 0b011111111111111111111111111111110 ; |
96 | $a = 0b011111111111111111111111111111111 ; |
97 | $a = 0b111111111111111111111111111111111 ; |
98 | $a = 0x0fffffffe ; |
99 | $a = 0x0ffffffff ; |
100 | $a = 0x1ffffffff ; |
101 | $a = 0037777777776 ; |
102 | $a = 0037777777777 ; |
103 | $a = 0047777777777 ; |
ac206dc8 |
104 | |
105 | dump() better written as CORE::dump() |
4ac733c9 |
106 | |
107 | Use of /c modifier is meaningless without /g |
108 | |
64e578a2 |
109 | Use of /c modifier is meaningless in s/// |
110 | |
0453d815 |
111 | Mandatory Warnings |
112 | ------------------ |
113 | Use of "%s" without parentheses is ambiguous [check_uni] |
114 | rand + 4 |
115 | |
116 | Ambiguous use of -%s resolved as -&%s() [yylex] |
117 | sub fred {} ; - fred ; |
118 | |
119 | Precedence problem: open %.*s should be open(%.*s) [yylex] |
120 | open FOO || die; |
121 | |
122 | Operator or semicolon missing before %c%s [yylex] |
123 | Ambiguous use of %c resolved as operator %c |
124 | *foo *foo |
125 | |
599cee73 |
126 | __END__ |
127 | # toke.c |
599cee73 |
128 | format STDOUT = |
129 | @<<< @||| @>>> @>>> |
130 | $a $b "abc" 'def' |
131 | . |
4438c4b7 |
132 | no warnings 'deprecated' ; |
0453d815 |
133 | format STDOUT = |
134 | @<<< @||| @>>> @>>> |
135 | $a $b "abc" 'def' |
136 | . |
599cee73 |
137 | EXPECT |
d1d15184 |
138 | Use of comma-less variable list is deprecated at - line 4. |
139 | Use of comma-less variable list is deprecated at - line 4. |
140 | Use of comma-less variable list is deprecated at - line 4. |
599cee73 |
141 | ######## |
142 | # toke.c |
599cee73 |
143 | $a = <<; |
144 | |
4438c4b7 |
145 | no warnings 'deprecated' ; |
0453d815 |
146 | $a = <<; |
147 | |
599cee73 |
148 | EXPECT |
d1d15184 |
149 | Use of bare << to mean <<"" is deprecated at - line 2. |
599cee73 |
150 | ######## |
151 | # toke.c |
4438c4b7 |
152 | use warnings 'syntax' ; |
599cee73 |
153 | s/(abc)/\1/; |
4438c4b7 |
154 | no warnings 'syntax' ; |
0453d815 |
155 | s/(abc)/\1/; |
599cee73 |
156 | EXPECT |
157 | \1 better written as $1 at - line 3. |
158 | ######## |
159 | # toke.c |
4438c4b7 |
160 | use warnings 'semicolon' ; |
599cee73 |
161 | $a = 1 |
162 | &time ; |
4438c4b7 |
163 | no warnings 'semicolon' ; |
0453d815 |
164 | $a = 1 |
165 | &time ; |
599cee73 |
166 | EXPECT |
167 | Semicolon seems to be missing at - line 3. |
168 | ######## |
169 | # toke.c |
4438c4b7 |
170 | use warnings 'syntax' ; |
599cee73 |
171 | my $a =+ 2 ; |
172 | $a =- 2 ; |
173 | $a =* 2 ; |
174 | $a =% 2 ; |
175 | $a =& 2 ; |
176 | $a =. 2 ; |
177 | $a =^ 2 ; |
178 | $a =| 2 ; |
179 | $a =< 2 ; |
180 | $a =/ 2 ; |
181 | EXPECT |
7f01dc7a |
182 | Reversed += operator at - line 3. |
183 | Reversed -= operator at - line 4. |
184 | Reversed *= operator at - line 5. |
185 | Reversed %= operator at - line 6. |
186 | Reversed &= operator at - line 7. |
187 | Reversed .= operator at - line 8. |
188 | Reversed ^= operator at - line 9. |
189 | Reversed |= operator at - line 10. |
190 | Reversed <= operator at - line 11. |
191 | syntax error at - line 8, near "=." |
192 | syntax error at - line 9, near "=^" |
193 | syntax error at - line 10, near "=|" |
194 | Unterminated <> operator at - line 11. |
599cee73 |
195 | ######## |
196 | # toke.c |
4438c4b7 |
197 | no warnings 'syntax' ; |
0453d815 |
198 | my $a =+ 2 ; |
199 | $a =- 2 ; |
200 | $a =* 2 ; |
201 | $a =% 2 ; |
202 | $a =& 2 ; |
203 | $a =. 2 ; |
204 | $a =^ 2 ; |
205 | $a =| 2 ; |
206 | $a =< 2 ; |
207 | $a =/ 2 ; |
208 | EXPECT |
7f01dc7a |
209 | syntax error at - line 8, near "=." |
210 | syntax error at - line 9, near "=^" |
211 | syntax error at - line 10, near "=|" |
212 | Unterminated <> operator at - line 11. |
0453d815 |
213 | ######## |
214 | # toke.c |
4438c4b7 |
215 | use warnings 'syntax' ; |
599cee73 |
216 | my $a = $a[1,2] ; |
4438c4b7 |
217 | no warnings 'syntax' ; |
0453d815 |
218 | my $a = $a[1,2] ; |
599cee73 |
219 | EXPECT |
220 | Multidimensional syntax $a[1,2] not supported at - line 3. |
221 | ######## |
222 | # toke.c |
4438c4b7 |
223 | use warnings 'syntax' ; |
599cee73 |
224 | sub fred {} ; $SIG{TERM} = fred; |
4438c4b7 |
225 | no warnings 'syntax' ; |
0453d815 |
226 | $SIG{TERM} = fred; |
599cee73 |
227 | EXPECT |
228 | You need to quote "fred" at - line 3. |
229 | ######## |
230 | # toke.c |
4438c4b7 |
231 | use warnings 'syntax' ; |
599cee73 |
232 | @a[3] = 2; |
233 | @a{3} = 2; |
4438c4b7 |
234 | no warnings 'syntax' ; |
0453d815 |
235 | @a[3] = 2; |
236 | @a{3} = 2; |
599cee73 |
237 | EXPECT |
238 | Scalar value @a[3] better written as $a[3] at - line 3. |
239 | Scalar value @a{3} better written as $a{3} at - line 4. |
240 | ######## |
241 | # toke.c |
4438c4b7 |
242 | use warnings 'syntax' ; |
599cee73 |
243 | $_ = "ab" ; |
244 | s/(ab)/\1/e; |
4438c4b7 |
245 | no warnings 'syntax' ; |
0453d815 |
246 | $_ = "ab" ; |
247 | s/(ab)/\1/e; |
599cee73 |
248 | EXPECT |
249 | Can't use \1 to mean $1 in expression at - line 4. |
250 | ######## |
251 | # toke.c |
4438c4b7 |
252 | use warnings 'reserved' ; |
599cee73 |
253 | $a = abc; |
1c3923b3 |
254 | $a = { def |
255 | |
256 | => 1 }; |
4438c4b7 |
257 | no warnings 'reserved' ; |
0453d815 |
258 | $a = abc; |
599cee73 |
259 | EXPECT |
260 | Unquoted string "abc" may clash with future reserved word at - line 3. |
261 | ######## |
262 | # toke.c |
e476b1b5 |
263 | use warnings 'qw' ; |
599cee73 |
264 | @a = qw(a, b, c) ; |
e476b1b5 |
265 | no warnings 'qw' ; |
0453d815 |
266 | @a = qw(a, b, c) ; |
599cee73 |
267 | EXPECT |
268 | Possible attempt to separate words with commas at - line 3. |
269 | ######## |
270 | # toke.c |
e476b1b5 |
271 | use warnings 'qw' ; |
599cee73 |
272 | @a = qw(a b #) ; |
e476b1b5 |
273 | no warnings 'qw' ; |
0453d815 |
274 | @a = qw(a b #) ; |
599cee73 |
275 | EXPECT |
276 | Possible attempt to put comments in qw() list at - line 3. |
277 | ######## |
278 | # toke.c |
4438c4b7 |
279 | use warnings 'syntax' ; |
b1439985 |
280 | print (""); |
281 | print ("") and $x = 1; |
282 | print ("") or die; |
283 | print ("") // die; |
284 | print (1+2) * 3 if 0; # only this one should warn |
285 | print (1+2) if 0; |
599cee73 |
286 | EXPECT |
b1439985 |
287 | print (...) interpreted as function at - line 7. |
599cee73 |
288 | ######## |
289 | # toke.c |
4438c4b7 |
290 | no warnings 'syntax' ; |
0453d815 |
291 | print ("") |
292 | EXPECT |
293 | |
294 | ######## |
295 | # toke.c |
4438c4b7 |
296 | use warnings 'syntax' ; |
b1439985 |
297 | printf (""); |
298 | printf ("") . ''; |
599cee73 |
299 | EXPECT |
b1439985 |
300 | printf (...) interpreted as function at - line 4. |
599cee73 |
301 | ######## |
302 | # toke.c |
4438c4b7 |
303 | no warnings 'syntax' ; |
0453d815 |
304 | printf ("") |
305 | EXPECT |
306 | |
307 | ######## |
308 | # toke.c |
4438c4b7 |
309 | use warnings 'syntax' ; |
b1439985 |
310 | sort (""); |
311 | sort ("") . ''; |
599cee73 |
312 | EXPECT |
b1439985 |
313 | sort (...) interpreted as function at - line 4. |
599cee73 |
314 | ######## |
315 | # toke.c |
4438c4b7 |
316 | no warnings 'syntax' ; |
0453d815 |
317 | sort ("") |
318 | EXPECT |
319 | |
320 | ######## |
321 | # toke.c |
4438c4b7 |
322 | use warnings 'ambiguous' ; |
599cee73 |
323 | $a = ${time[2]}; |
4438c4b7 |
324 | no warnings 'ambiguous' ; |
0453d815 |
325 | $a = ${time[2]}; |
599cee73 |
326 | EXPECT |
327 | Ambiguous use of ${time[...]} resolved to $time[...] at - line 3. |
328 | ######## |
329 | # toke.c |
4438c4b7 |
330 | use warnings 'ambiguous' ; |
599cee73 |
331 | $a = ${time{2}}; |
332 | EXPECT |
333 | Ambiguous use of ${time{...}} resolved to $time{...} at - line 3. |
334 | ######## |
335 | # toke.c |
4438c4b7 |
336 | no warnings 'ambiguous' ; |
0453d815 |
337 | $a = ${time{2}}; |
338 | EXPECT |
339 | |
340 | ######## |
341 | # toke.c |
4438c4b7 |
342 | use warnings 'ambiguous' ; |
599cee73 |
343 | $a = ${time} ; |
4438c4b7 |
344 | no warnings 'ambiguous' ; |
0453d815 |
345 | $a = ${time} ; |
599cee73 |
346 | EXPECT |
347 | Ambiguous use of ${time} resolved to $time at - line 3. |
348 | ######## |
349 | # toke.c |
4438c4b7 |
350 | use warnings 'ambiguous' ; |
599cee73 |
351 | sub fred {} |
352 | $a = ${fred} ; |
4438c4b7 |
353 | no warnings 'ambiguous' ; |
0453d815 |
354 | $a = ${fred} ; |
599cee73 |
355 | EXPECT |
356 | Ambiguous use of ${fred} resolved to $fred at - line 4. |
357 | ######## |
358 | # toke.c |
4438c4b7 |
359 | use warnings 'syntax' ; |
7fd134d9 |
360 | $a = _123; print "$a\n"; #( 3 string) |
361 | $a = 1_23; print "$a\n"; |
362 | $a = 12_3; print "$a\n"; |
363 | $a = 123_; print "$a\n"; # 6 |
364 | $a = _+123; print "$a\n"; # 7 string) |
365 | $a = +_123; print "$a\n"; #( 8 string) |
366 | $a = +1_23; print "$a\n"; |
367 | $a = +12_3; print "$a\n"; |
368 | $a = +123_; print "$a\n"; # 11 |
369 | $a = _-123; print "$a\n"; #(12 string) |
370 | $a = -_123; print "$a\n"; #(13 string) |
371 | $a = -1_23; print "$a\n"; |
372 | $a = -12_3; print "$a\n"; |
373 | $a = -123_; print "$a\n"; # 16 |
374 | $a = 123._456; print "$a\n"; # 17 |
375 | $a = 123.4_56; print "$a\n"; |
376 | $a = 123.45_6; print "$a\n"; |
377 | $a = 123.456_; print "$a\n"; # 20 |
378 | $a = +123._456; print "$a\n"; # 21 |
379 | $a = +123.4_56; print "$a\n"; |
380 | $a = +123.45_6; print "$a\n"; |
381 | $a = +123.456_; print "$a\n"; # 24 |
382 | $a = -123._456; print "$a\n"; # 25 |
383 | $a = -123.4_56; print "$a\n"; |
384 | $a = -123.45_6; print "$a\n"; |
385 | $a = -123.456_; print "$a\n"; # 28 |
2bea9a37 |
386 | $a = 123.456E_12; printf("%.0f\n", $a); # 29 |
387 | $a = 123.456E1_2; printf("%.0f\n", $a); |
388 | $a = 123.456E12_; printf("%.0f\n", $a); # 31 |
389 | $a = 123.456E_+12; printf("%.0f\n", $a); # 32 |
390 | $a = 123.456E+_12; printf("%.0f\n", $a); # 33 |
391 | $a = 123.456E+1_2; printf("%.0f\n", $a); |
392 | $a = 123.456E+12_; printf("%.0f\n", $a); # 35 |
7fd134d9 |
393 | $a = 123.456E_-12; print "$a\n"; # 36 |
394 | $a = 123.456E-_12; print "$a\n"; # 37 |
395 | $a = 123.456E-1_2; print "$a\n"; |
396 | $a = 123.456E-12_; print "$a\n"; # 39 |
b3b48e3e |
397 | $a = 1__23; print "$a\n"; # 40 |
398 | $a = 12.3__4; print "$a\n"; # 41 |
2bea9a37 |
399 | $a = 12.34e1__2; printf("%.0f\n", $a); # 42 |
4438c4b7 |
400 | no warnings 'syntax' ; |
7fd134d9 |
401 | $a = _123; print "$a\n"; |
402 | $a = 1_23; print "$a\n"; |
403 | $a = 12_3; print "$a\n"; |
404 | $a = 123_; print "$a\n"; |
405 | $a = _+123; print "$a\n"; |
406 | $a = +_123; print "$a\n"; |
407 | $a = +1_23; print "$a\n"; |
408 | $a = +12_3; print "$a\n"; |
409 | $a = +123_; print "$a\n"; |
410 | $a = _-123; print "$a\n"; |
411 | $a = -_123; print "$a\n"; |
412 | $a = -1_23; print "$a\n"; |
413 | $a = -12_3; print "$a\n"; |
414 | $a = -123_; print "$a\n"; |
415 | $a = 123._456; print "$a\n"; |
416 | $a = 123.4_56; print "$a\n"; |
417 | $a = 123.45_6; print "$a\n"; |
418 | $a = 123.456_; print "$a\n"; |
419 | $a = +123._456; print "$a\n"; |
420 | $a = +123.4_56; print "$a\n"; |
421 | $a = +123.45_6; print "$a\n"; |
422 | $a = +123.456_; print "$a\n"; |
423 | $a = -123._456; print "$a\n"; |
424 | $a = -123.4_56; print "$a\n"; |
425 | $a = -123.45_6; print "$a\n"; |
426 | $a = -123.456_; print "$a\n"; |
2bea9a37 |
427 | $a = 123.456E_12; printf("%.0f\n", $a); |
428 | $a = 123.456E1_2; printf("%.0f\n", $a); |
429 | $a = 123.456E12_; printf("%.0f\n", $a); |
430 | $a = 123.456E_+12; printf("%.0f\n", $a); |
431 | $a = 123.456E+_12; printf("%.0f\n", $a); |
432 | $a = 123.456E+1_2; printf("%.0f\n", $a); |
433 | $a = 123.456E+12_; printf("%.0f\n", $a); |
7fd134d9 |
434 | $a = 123.456E_-12; print "$a\n"; |
435 | $a = 123.456E-_12; print "$a\n"; |
436 | $a = 123.456E-1_2; print "$a\n"; |
437 | $a = 123.456E-12_; print "$a\n"; |
b3b48e3e |
438 | $a = 1__23; print "$a\n"; |
439 | $a = 12.3__4; print "$a\n"; |
2bea9a37 |
440 | $a = 12.34e1__2; printf("%.0f\n", $a); |
599cee73 |
441 | EXPECT |
fbfa96bd |
442 | OPTIONS regex |
928753ea |
443 | Misplaced _ in number at - line 6. |
928753ea |
444 | Misplaced _ in number at - line 11. |
7fd134d9 |
445 | Misplaced _ in number at - line 16. |
928753ea |
446 | Misplaced _ in number at - line 17. |
7fd134d9 |
447 | Misplaced _ in number at - line 20. |
928753ea |
448 | Misplaced _ in number at - line 21. |
7fd134d9 |
449 | Misplaced _ in number at - line 24. |
450 | Misplaced _ in number at - line 25. |
451 | Misplaced _ in number at - line 28. |
452 | Misplaced _ in number at - line 29. |
453 | Misplaced _ in number at - line 31. |
454 | Misplaced _ in number at - line 32. |
455 | Misplaced _ in number at - line 33. |
456 | Misplaced _ in number at - line 35. |
457 | Misplaced _ in number at - line 36. |
458 | Misplaced _ in number at - line 37. |
459 | Misplaced _ in number at - line 39. |
b3b48e3e |
460 | Misplaced _ in number at - line 40. |
461 | Misplaced _ in number at - line 41. |
462 | Misplaced _ in number at - line 42. |
928753ea |
463 | _123 |
464 | 123 |
928753ea |
465 | 123 |
7fd134d9 |
466 | 123 |
467 | 123 |
468 | _123 |
469 | 123 |
470 | 123 |
471 | 123 |
472 | -123 |
473 | -_123 |
474 | -123 |
475 | -123 |
476 | -123 |
477 | 123.456 |
478 | 123.456 |
479 | 123.456 |
480 | 123.456 |
481 | 123.456 |
482 | 123.456 |
483 | 123.456 |
484 | 123.456 |
485 | -123.456 |
486 | -123.456 |
487 | -123.456 |
488 | -123.456 |
489 | 123456000000000 |
490 | 123456000000000 |
491 | 123456000000000 |
492 | 123456000000000 |
493 | 123456000000000 |
494 | 123456000000000 |
495 | 123456000000000 |
fbfa96bd |
496 | 1.23456e-0?10 |
497 | 1.23456e-0?10 |
498 | 1.23456e-0?10 |
499 | 1.23456e-0?10 |
b3b48e3e |
500 | 123 |
501 | 12.34 |
502 | 12340000000000 |
7fd134d9 |
503 | _123 |
504 | 123 |
505 | 123 |
506 | 123 |
507 | 123 |
508 | _123 |
509 | 123 |
510 | 123 |
511 | 123 |
512 | -123 |
513 | -_123 |
514 | -123 |
515 | -123 |
516 | -123 |
517 | 123.456 |
518 | 123.456 |
519 | 123.456 |
520 | 123.456 |
521 | 123.456 |
928753ea |
522 | 123.456 |
523 | 123.456 |
928753ea |
524 | 123.456 |
7fd134d9 |
525 | -123.456 |
526 | -123.456 |
527 | -123.456 |
528 | -123.456 |
529 | 123456000000000 |
530 | 123456000000000 |
531 | 123456000000000 |
532 | 123456000000000 |
533 | 123456000000000 |
534 | 123456000000000 |
535 | 123456000000000 |
fbfa96bd |
536 | 1.23456e-0?10 |
537 | 1.23456e-0?10 |
538 | 1.23456e-0?10 |
539 | 1.23456e-0?10 |
b3b48e3e |
540 | 123 |
541 | 12.34 |
542 | 12340000000000 |
599cee73 |
543 | ######## |
544 | # toke.c |
e476b1b5 |
545 | use warnings 'bareword' ; |
60e6418e |
546 | #line 25 "bar" |
599cee73 |
547 | $a = FRED:: ; |
e476b1b5 |
548 | no warnings 'bareword' ; |
0453d815 |
549 | #line 25 "bar" |
550 | $a = FRED:: ; |
599cee73 |
551 | EXPECT |
60e6418e |
552 | Bareword "FRED::" refers to nonexistent package at bar line 25. |
599cee73 |
553 | ######## |
554 | # toke.c |
4438c4b7 |
555 | use warnings 'ambiguous' ; |
599cee73 |
556 | sub time {} |
0453d815 |
557 | my $a = time() ; |
4438c4b7 |
558 | no warnings 'ambiguous' ; |
0453d815 |
559 | my $b = time() ; |
599cee73 |
560 | EXPECT |
561 | Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4. |
562 | ######## |
563 | # toke.c |
26d16222 |
564 | use warnings ; |
0453d815 |
565 | eval <<'EOE'; |
df0deb90 |
566 | # line 30 "foo" |
567 | warn "yelp"; |
0453d815 |
568 | { |
0453d815 |
569 | $_ = " \x{123} " ; |
570 | } |
571 | EOE |
572 | EXPECT |
df0deb90 |
573 | yelp at foo line 30. |
0453d815 |
574 | ######## |
575 | # toke.c |
0453d815 |
576 | my $a = rand + 4 ; |
577 | EXPECT |
2d5ccbba |
578 | Warning: Use of "rand" without parentheses is ambiguous at - line 2. |
0453d815 |
579 | ######## |
580 | # toke.c |
581 | $^W = 0 ; |
582 | my $a = rand + 4 ; |
583 | { |
4438c4b7 |
584 | no warnings 'ambiguous' ; |
0453d815 |
585 | $a = rand + 4 ; |
4438c4b7 |
586 | use warnings 'ambiguous' ; |
0453d815 |
587 | $a = rand + 4 ; |
588 | } |
589 | $a = rand + 4 ; |
590 | EXPECT |
2d5ccbba |
591 | Warning: Use of "rand" without parentheses is ambiguous at - line 3. |
592 | Warning: Use of "rand" without parentheses is ambiguous at - line 8. |
593 | Warning: Use of "rand" without parentheses is ambiguous at - line 10. |
0453d815 |
594 | ######## |
595 | # toke.c |
e8ae98db |
596 | use warnings "ambiguous"; |
597 | print for keys %+; # should not warn |
598 | EXPECT |
599 | ######## |
600 | # toke.c |
0453d815 |
601 | sub fred {}; |
602 | -fred ; |
603 | EXPECT |
604 | Ambiguous use of -fred resolved as -&fred() at - line 3. |
605 | ######## |
606 | # toke.c |
607 | $^W = 0 ; |
608 | sub fred {} ; |
609 | -fred ; |
610 | { |
4438c4b7 |
611 | no warnings 'ambiguous' ; |
0453d815 |
612 | -fred ; |
4438c4b7 |
613 | use warnings 'ambiguous' ; |
0453d815 |
614 | -fred ; |
615 | } |
616 | -fred ; |
617 | EXPECT |
618 | Ambiguous use of -fred resolved as -&fred() at - line 4. |
619 | Ambiguous use of -fred resolved as -&fred() at - line 9. |
620 | Ambiguous use of -fred resolved as -&fred() at - line 11. |
621 | ######## |
622 | # toke.c |
623 | open FOO || time; |
624 | EXPECT |
625 | Precedence problem: open FOO should be open(FOO) at - line 2. |
626 | ######## |
66fbe8fb |
627 | # toke.c (and [perl #16184]) |
628 | open FOO => "<&0"; close FOO; |
629 | EXPECT |
630 | ######## |
0453d815 |
631 | # toke.c |
632 | $^W = 0 ; |
633 | open FOO || time; |
634 | { |
e476b1b5 |
635 | no warnings 'precedence' ; |
0453d815 |
636 | open FOO || time; |
e476b1b5 |
637 | use warnings 'precedence' ; |
0453d815 |
638 | open FOO || time; |
639 | } |
640 | open FOO || time; |
641 | EXPECT |
642 | Precedence problem: open FOO should be open(FOO) at - line 3. |
643 | Precedence problem: open FOO should be open(FOO) at - line 8. |
644 | Precedence problem: open FOO should be open(FOO) at - line 10. |
645 | ######## |
646 | # toke.c |
647 | $^W = 0 ; |
648 | *foo *foo ; |
649 | { |
4438c4b7 |
650 | no warnings 'ambiguous' ; |
0453d815 |
651 | *foo *foo ; |
4438c4b7 |
652 | use warnings 'ambiguous' ; |
0453d815 |
653 | *foo *foo ; |
654 | } |
655 | *foo *foo ; |
656 | EXPECT |
657 | Operator or semicolon missing before *foo at - line 3. |
658 | Ambiguous use of * resolved as operator * at - line 3. |
659 | Operator or semicolon missing before *foo at - line 8. |
660 | Ambiguous use of * resolved as operator * at - line 8. |
661 | Operator or semicolon missing before *foo at - line 10. |
662 | Ambiguous use of * resolved as operator * at - line 10. |
767a6a26 |
663 | ######## |
664 | # toke.c |
e476b1b5 |
665 | use warnings 'misc' ; |
767a6a26 |
666 | my $a = "\m" ; |
e476b1b5 |
667 | no warnings 'misc' ; |
767a6a26 |
668 | $a = "\m" ; |
669 | EXPECT |
670 | Unrecognized escape \m passed through at - line 3. |
671 | ######## |
672 | # toke.c |
673 | use warnings 'portable' ; |
674 | my $a = 0b011111111111111111111111111111110 ; |
675 | $a = 0b011111111111111111111111111111111 ; |
676 | $a = 0b111111111111111111111111111111111 ; |
677 | $a = 0x0fffffffe ; |
678 | $a = 0x0ffffffff ; |
679 | $a = 0x1ffffffff ; |
680 | $a = 0037777777776 ; |
681 | $a = 0037777777777 ; |
682 | $a = 0047777777777 ; |
683 | no warnings 'portable' ; |
684 | $a = 0b011111111111111111111111111111110 ; |
685 | $a = 0b011111111111111111111111111111111 ; |
686 | $a = 0b111111111111111111111111111111111 ; |
687 | $a = 0x0fffffffe ; |
688 | $a = 0x0ffffffff ; |
689 | $a = 0x1ffffffff ; |
690 | $a = 0037777777776 ; |
691 | $a = 0037777777777 ; |
692 | $a = 0047777777777 ; |
693 | EXPECT |
694 | Binary number > 0b11111111111111111111111111111111 non-portable at - line 5. |
695 | Hexadecimal number > 0xffffffff non-portable at - line 8. |
696 | Octal number > 037777777777 non-portable at - line 11. |
697 | ######## |
698 | # toke.c |
699 | use warnings 'overflow' ; |
700 | my $a = 0b011111111111111111111111111111110 ; |
701 | $a = 0b011111111111111111111111111111111 ; |
15041a67 |
702 | $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; |
767a6a26 |
703 | $a = 0x0fffffffe ; |
704 | $a = 0x0ffffffff ; |
15041a67 |
705 | $a = 0x10000000000000000 ; |
767a6a26 |
706 | $a = 0037777777776 ; |
707 | $a = 0037777777777 ; |
15041a67 |
708 | $a = 002000000000000000000000; |
767a6a26 |
709 | no warnings 'overflow' ; |
710 | $a = 0b011111111111111111111111111111110 ; |
711 | $a = 0b011111111111111111111111111111111 ; |
15041a67 |
712 | $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; |
767a6a26 |
713 | $a = 0x0fffffffe ; |
714 | $a = 0x0ffffffff ; |
15041a67 |
715 | $a = 0x10000000000000000 ; |
767a6a26 |
716 | $a = 0037777777776 ; |
717 | $a = 0037777777777 ; |
15041a67 |
718 | $a = 002000000000000000000000; |
767a6a26 |
719 | EXPECT |
720 | Integer overflow in binary number at - line 5. |
721 | Integer overflow in hexadecimal number at - line 8. |
722 | Integer overflow in octal number at - line 11. |
8593bda5 |
723 | ######## |
724 | # toke.c |
ac206dc8 |
725 | BEGIN { $^C = 1; } |
726 | use warnings 'misc'; |
727 | dump; |
728 | CORE::dump; |
729 | EXPECT |
730 | dump() better written as CORE::dump() at - line 4. |
731 | - syntax OK |
732 | ######## |
733 | # toke.c |
734 | use warnings 'misc'; |
735 | use subs qw/dump/; |
736 | sub dump { print "no warning for overriden dump\n"; } |
737 | dump; |
738 | EXPECT |
739 | no warning for overriden dump |
740 | ######## |
741 | # toke.c |
8593bda5 |
742 | use warnings 'ambiguous'; |
743 | "@mjd_previously_unused_array"; |
744 | no warnings 'ambiguous'; |
745 | "@mjd_previously_unused_array"; |
746 | EXPECT |
747 | Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3. |
707afd92 |
748 | ######## |
749 | # toke.c |
d8c55666 |
750 | # 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com |
4ac733c9 |
751 | use warnings 'regexp'; |
752 | "foo" =~ /foo/c; |
64e578a2 |
753 | "foo" =~ /foo/cg; |
4ac733c9 |
754 | no warnings 'regexp'; |
755 | "foo" =~ /foo/c; |
64e578a2 |
756 | "foo" =~ /foo/cg; |
4ac733c9 |
757 | EXPECT |
758 | Use of /c modifier is meaningless without /g at - line 4. |
759 | ######## |
760 | # toke.c |
d8c55666 |
761 | # 20020328 mjd-perl-patch+@plover.com at behest of jfriedl@yahoo.com |
4ac733c9 |
762 | use warnings 'regexp'; |
763 | $_ = "ab" ; |
764 | s/ab/ab/c; |
64e578a2 |
765 | s/ab/ab/cg; |
4ac733c9 |
766 | no warnings 'regexp'; |
767 | s/ab/ab/c; |
64e578a2 |
768 | s/ab/ab/cg; |
4ac733c9 |
769 | EXPECT |
64e578a2 |
770 | Use of /c modifier is meaningless in s/// at - line 5. |
771 | Use of /c modifier is meaningless in s/// at - line 6. |
d8c55666 |
772 | ######## |
773 | -wa |
774 | # toke.c |
775 | # 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings |
776 | print "@F\n"; |
777 | EXPECT |
778 | |
779 | ######## |
780 | -w |
781 | # toke.c |
782 | # 20020414 mjd-perl-patch+@plover.com # -a flag should suppress these warnings |
783 | print "@F\n"; |
784 | EXPECT |
785 | Possible unintended interpolation of @F in string at - line 4. |
786 | Name "main::F" used only once: possible typo at - line 4. |
787 | ######## |
788 | -wa |
789 | # toke.c |
790 | # 20020414 mjd-perl-patch+@plover.com |
791 | EXPECT |
792 | |
2710853f |
793 | ######## |
794 | # toke.c |
795 | # 20020414 mjd-perl-patch+@plover.com |
796 | # In 5.7.3, this emitted "Possible unintended interpolation" warnings |
797 | use warnings 'ambiguous'; |
798 | $s = "(@-)(@+)"; |
799 | EXPECT |
800 | |
56da5a46 |
801 | ######## |
802 | # toke.c |
803 | # mandatory warning |
804 | eval q/if ($a) { } elseif ($b) { }/; |
805 | no warnings "syntax"; |
806 | eval q/if ($a) { } elseif ($b) { }/; |
807 | EXPECT |
808 | elseif should be elsif at (eval 1) line 1. |
809 | ######## |
810 | # toke.c |
811 | # mandatory warning |
812 | eval q/5 6/; |
813 | no warnings "syntax"; |
814 | eval q/5 6/; |
815 | EXPECT |
816 | Number found where operator expected at (eval 1) line 1, near "5 6" |
817 | (Missing operator before 6?) |
984200d0 |
818 | ######## |
819 | # toke.c |
820 | use warnings "syntax"; |
821 | $_ = $a = 1; |
822 | $a !=~ /1/; |
823 | $a !=~ m#1#; |
824 | $a !=~/1/; |
825 | $a !=~ ?/?; |
decca21c |
826 | $a !=~ y/1//; |
827 | $a !=~ tr/1//; |
828 | $a !=~ s/1//; |
984200d0 |
829 | $a != ~/1/; |
830 | no warnings "syntax"; |
831 | $a !=~ /1/; |
832 | $a !=~ m#1#; |
833 | $a !=~/1/; |
834 | $a !=~ ?/?; |
decca21c |
835 | $a !=~ y/1//; |
836 | $a !=~ tr/1//; |
837 | $a !=~ s/1//; |
984200d0 |
838 | EXPECT |
839 | !=~ should be !~ at - line 4. |
840 | !=~ should be !~ at - line 5. |
841 | !=~ should be !~ at - line 6. |
842 | !=~ should be !~ at - line 7. |
decca21c |
843 | !=~ should be !~ at - line 8. |
844 | !=~ should be !~ at - line 9. |
845 | !=~ should be !~ at - line 10. |
1108974d |
846 | ######## |
847 | # toke.c |
848 | our $foo :unique; |
8e5dadda |
849 | sub pam :locked; |
850 | sub glipp :locked { |
851 | } |
852 | sub whack_eth ($) : locked { |
853 | } |
d1d15184 |
854 | no warnings 'deprecated'; |
1108974d |
855 | our $bar :unique; |
8e5dadda |
856 | sub zapeth :locked; |
857 | sub ker_plop :locked { |
858 | } |
859 | sub swa_a_p ($) : locked { |
860 | } |
1108974d |
861 | EXPECT |
d1d15184 |
862 | Use of :unique is deprecated at - line 2. |
863 | Use of :locked is deprecated at - line 3. |
864 | Use of :locked is deprecated at - line 4. |
865 | Use of :locked is deprecated at - line 6. |
9e8d7757 |
866 | ######## |
867 | # toke.c |
868 | use warnings "syntax"; |
869 | sub proto_after_array(@$); |
870 | sub proto_after_arref(\@$); |
871 | sub proto_after_arref2(\[@$]); |
872 | sub proto_after_arref3(\[@$]_); |
873 | sub proto_after_hash(%$); |
874 | sub proto_after_hashref(\%$); |
875 | sub proto_after_hashref2(\[%$]); |
876 | sub underscore_last_pos($_); |
877 | sub underscore2($_;$); |
878 | sub underscore_fail($_$); |
879 | sub underscore_after_at(@_); |
880 | no warnings "syntax"; |
881 | sub proto_after_array(@$); |
882 | sub proto_after_hash(%$); |
883 | sub underscore_fail($_$); |
884 | EXPECT |
885 | Prototype after '@' for main::proto_after_array : @$ at - line 3. |
886 | Prototype after '%' for main::proto_after_hash : %$ at - line 7. |
aef2a98a |
887 | Illegal character after '_' in prototype for main::underscore_fail : $_$ at - line 12. |
9e8d7757 |
888 | Prototype after '@' for main::underscore_after_at : @_ at - line 13. |
77772344 |
889 | ######## |
890 | # toke.c |
891 | use warnings "ambiguous"; |
892 | "foo\nn" =~ /^foo$\n/; |
893 | "foo\nn" =~ /^foo${\}n/; |
894 | my $foo = qr/^foo$\n/; |
895 | my $bar = qr/^foo${\}n/; |
896 | no warnings "ambiguous"; |
897 | "foo\nn" =~ /^foo$\n/; |
898 | "foo\nn" =~ /^foo${\}n/; |
899 | my $foo = qr/^foo$\n/; |
900 | my $bar = qr/^foo${\}n/; |
901 | EXPECT |
902 | Possible unintended interpolation of $\ in regex at - line 3. |
903 | Possible unintended interpolation of $\ in regex at - line 5. |
d83f38d8 |
904 | ######## |
905 | # toke.c |
906 | use feature 'state'; |
907 | # This one is fine as an empty attribute list |
908 | my $holy_Einstein : = ''; |
909 | # This one is deprecated |
910 | my $krunch := 4; |
911 | our $FWISK_FWISK_FWIZZACH_FWACH_ZACHITTY_ZICH_SHAZZATZ_FWISK := ''; |
912 | state $thump := 'Trumpets'; |
913 | # Lather rinse repeat in my usual obsessive style |
914 | my @holy_perfect_pitch : = (); |
915 | my @zok := (); |
916 | our @GUKGUK := (); |
917 | # state @widget_mark := (); |
918 | my %holy_seditives : = (); |
919 | my %bang := (); |
920 | our %GIGAZING := (); |
921 | # state %hex := (); |
922 | no warnings 'deprecated'; |
923 | my $holy_giveaways : = ''; |
924 | my $eee_yow := []; |
925 | our $TWOYYOYYOING_THUK_UGH := 1 == 1; |
926 | state $octothorn := 'Tinky Winky'; |
927 | my @holy_Taj_Mahal : = (); |
928 | my @touche := (); |
929 | our @PLAK_DAK_THUK_FRIT := (); |
930 | # state @hash_mark := (); |
931 | my %holy_priceless_collection_of_Etruscan_snoods : = (); |
932 | my %wham_eth := (); |
933 | our %THWUK := (); |
934 | # state %octalthorpe := (); |
935 | use warnings; |
936 | my $holy_sewer_pipe : = ''; |
937 | my $thunk := undef; |
938 | our $BLIT := time; |
939 | state $crunch := 'Laa Laa'; |
940 | my @glurpp := (); |
941 | my @holy_harem : = (); |
942 | our @FABADAP := (); |
943 | # state @square := (); |
944 | my %holy_pin_cushions : = (); |
945 | my %swoosh := (); |
946 | our %RRRRR := (); |
947 | # state %scratchmark := (); |
948 | EXPECT |
949 | Use of := for an empty attribute list is deprecated at - line 6. |
950 | Use of := for an empty attribute list is deprecated at - line 7. |
951 | Use of := for an empty attribute list is deprecated at - line 8. |
952 | Use of := for an empty attribute list is deprecated at - line 11. |
953 | Use of := for an empty attribute list is deprecated at - line 12. |
954 | Use of := for an empty attribute list is deprecated at - line 15. |
955 | Use of := for an empty attribute list is deprecated at - line 16. |
956 | Use of := for an empty attribute list is deprecated at - line 33. |
957 | Use of := for an empty attribute list is deprecated at - line 34. |
958 | Use of := for an empty attribute list is deprecated at - line 35. |
959 | Use of := for an empty attribute list is deprecated at - line 36. |
960 | Use of := for an empty attribute list is deprecated at - line 38. |
961 | Use of := for an empty attribute list is deprecated at - line 41. |
962 | Use of := for an empty attribute list is deprecated at - line 42. |