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