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 | |
073ca4f1 |
49 | chmod() mode argument is missing initial 0 |
599cee73 |
50 | chmod 3; |
51 | |
52 | Possible attempt to separate words with commas |
53 | @a = qw(a, b, c) ; |
54 | |
55 | Possible attempt to put comments in qw() list |
56 | @a = qw(a b # c) ; |
57 | |
58 | umask: argument is missing initial 0 |
59 | umask 3; |
60 | |
61 | %s (...) interpreted as function |
62 | print ("") |
63 | printf ("") |
64 | sort ("") |
65 | |
66 | Ambiguous use of %c{%s%s} resolved to %c%s%s |
67 | $a = ${time[2]} |
68 | $a = ${time{2}} |
69 | |
70 | |
71 | Ambiguous use of %c{%s} resolved to %c%s |
72 | $a = ${time} |
73 | sub fred {} $a = ${fred} |
74 | |
75 | Misplaced _ in number |
76 | $a = 1_2; |
77 | $a = 1_2345_6; |
78 | |
79 | Bareword \"%s\" refers to nonexistent package |
80 | $a = FRED:: ; |
81 | |
82 | Ambiguous call resolved as CORE::%s(), qualify as such or use & |
83 | sub time {} |
84 | my $a = time() |
85 | |
767a6a26 |
86 | Unrecognized escape \\%c passed through |
87 | $a = "\m" ; |
88 | |
89 | %s number > %s non-portable |
90 | my $a = 0b011111111111111111111111111111110 ; |
91 | $a = 0b011111111111111111111111111111111 ; |
92 | $a = 0b111111111111111111111111111111111 ; |
93 | $a = 0x0fffffffe ; |
94 | $a = 0x0ffffffff ; |
95 | $a = 0x1ffffffff ; |
96 | $a = 0037777777776 ; |
97 | $a = 0037777777777 ; |
98 | $a = 0047777777777 ; |
99 | |
100 | Integer overflow in binary number |
101 | my $a = 0b011111111111111111111111111111110 ; |
102 | $a = 0b011111111111111111111111111111111 ; |
103 | $a = 0b111111111111111111111111111111111 ; |
104 | $a = 0x0fffffffe ; |
105 | $a = 0x0ffffffff ; |
106 | $a = 0x1ffffffff ; |
107 | $a = 0037777777776 ; |
108 | $a = 0037777777777 ; |
109 | $a = 0047777777777 ; |
599cee73 |
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 |
e4050d25 |
172 | BEGIN { |
173 | # Scalars leaked: due to syntax errors |
174 | $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3; |
175 | } |
4438c4b7 |
176 | use warnings 'syntax' ; |
599cee73 |
177 | my $a =+ 2 ; |
178 | $a =- 2 ; |
179 | $a =* 2 ; |
180 | $a =% 2 ; |
181 | $a =& 2 ; |
182 | $a =. 2 ; |
183 | $a =^ 2 ; |
184 | $a =| 2 ; |
185 | $a =< 2 ; |
186 | $a =/ 2 ; |
187 | EXPECT |
e4050d25 |
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 | Reversed .= operator at - line 12. |
e4050d25 |
194 | Reversed ^= operator at - line 13. |
e4050d25 |
195 | Reversed |= operator at - line 14. |
e4050d25 |
196 | Reversed <= operator at - line 15. |
24944567 |
197 | syntax error at - line 12, near "=." |
198 | syntax error at - line 13, near "=^" |
199 | syntax error at - line 14, near "=|" |
e4050d25 |
200 | Unterminated <> operator at - line 15. |
599cee73 |
201 | ######## |
202 | # toke.c |
0453d815 |
203 | BEGIN { |
204 | # Scalars leaked: due to syntax errors |
205 | $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3; |
206 | } |
4438c4b7 |
207 | no warnings 'syntax' ; |
0453d815 |
208 | my $a =+ 2 ; |
209 | $a =- 2 ; |
210 | $a =* 2 ; |
211 | $a =% 2 ; |
212 | $a =& 2 ; |
213 | $a =. 2 ; |
214 | $a =^ 2 ; |
215 | $a =| 2 ; |
216 | $a =< 2 ; |
217 | $a =/ 2 ; |
218 | EXPECT |
219 | syntax error at - line 12, near "=." |
220 | syntax error at - line 13, near "=^" |
221 | syntax error at - line 14, near "=|" |
222 | Unterminated <> operator at - line 15. |
223 | ######## |
224 | # toke.c |
4438c4b7 |
225 | use warnings 'syntax' ; |
599cee73 |
226 | my $a = $a[1,2] ; |
4438c4b7 |
227 | no warnings 'syntax' ; |
0453d815 |
228 | my $a = $a[1,2] ; |
599cee73 |
229 | EXPECT |
230 | Multidimensional syntax $a[1,2] not supported at - line 3. |
231 | ######## |
232 | # toke.c |
4438c4b7 |
233 | use warnings 'syntax' ; |
599cee73 |
234 | sub fred {} ; $SIG{TERM} = fred; |
4438c4b7 |
235 | no warnings 'syntax' ; |
0453d815 |
236 | $SIG{TERM} = fred; |
599cee73 |
237 | EXPECT |
238 | You need to quote "fred" at - line 3. |
239 | ######## |
240 | # toke.c |
4438c4b7 |
241 | use warnings 'syntax' ; |
599cee73 |
242 | @a[3] = 2; |
243 | @a{3} = 2; |
4438c4b7 |
244 | no warnings 'syntax' ; |
0453d815 |
245 | @a[3] = 2; |
246 | @a{3} = 2; |
599cee73 |
247 | EXPECT |
248 | Scalar value @a[3] better written as $a[3] at - line 3. |
249 | Scalar value @a{3} better written as $a{3} at - line 4. |
250 | ######## |
251 | # toke.c |
4438c4b7 |
252 | use warnings 'syntax' ; |
599cee73 |
253 | $_ = "ab" ; |
254 | s/(ab)/\1/e; |
4438c4b7 |
255 | no warnings 'syntax' ; |
0453d815 |
256 | $_ = "ab" ; |
257 | s/(ab)/\1/e; |
599cee73 |
258 | EXPECT |
259 | Can't use \1 to mean $1 in expression at - line 4. |
260 | ######## |
261 | # toke.c |
4438c4b7 |
262 | use warnings 'reserved' ; |
599cee73 |
263 | $a = abc; |
1c3923b3 |
264 | $a = { def |
265 | |
266 | => 1 }; |
4438c4b7 |
267 | no warnings 'reserved' ; |
0453d815 |
268 | $a = abc; |
599cee73 |
269 | EXPECT |
270 | Unquoted string "abc" may clash with future reserved word at - line 3. |
271 | ######## |
272 | # toke.c |
e476b1b5 |
273 | use warnings 'chmod' ; |
599cee73 |
274 | chmod 3; |
e476b1b5 |
275 | no warnings 'chmod' ; |
0453d815 |
276 | chmod 3; |
599cee73 |
277 | EXPECT |
073ca4f1 |
278 | chmod() mode argument is missing initial 0 at - line 3. |
599cee73 |
279 | ######## |
280 | # toke.c |
e476b1b5 |
281 | use warnings 'qw' ; |
599cee73 |
282 | @a = qw(a, b, c) ; |
e476b1b5 |
283 | no warnings 'qw' ; |
0453d815 |
284 | @a = qw(a, b, c) ; |
599cee73 |
285 | EXPECT |
286 | Possible attempt to separate words with commas at - line 3. |
287 | ######## |
288 | # toke.c |
e476b1b5 |
289 | use warnings 'qw' ; |
599cee73 |
290 | @a = qw(a b #) ; |
e476b1b5 |
291 | no warnings 'qw' ; |
0453d815 |
292 | @a = qw(a b #) ; |
599cee73 |
293 | EXPECT |
294 | Possible attempt to put comments in qw() list at - line 3. |
295 | ######## |
296 | # toke.c |
e476b1b5 |
297 | use warnings 'umask' ; |
599cee73 |
298 | umask 3; |
e476b1b5 |
299 | no warnings 'umask' ; |
0453d815 |
300 | umask 3; |
599cee73 |
301 | EXPECT |
4438c4b7 |
302 | umask: argument is missing initial 0 at - line 3. |
599cee73 |
303 | ######## |
304 | # toke.c |
4438c4b7 |
305 | use warnings 'syntax' ; |
599cee73 |
306 | print ("") |
307 | EXPECT |
308 | print (...) interpreted as function at - line 3. |
309 | ######## |
310 | # toke.c |
4438c4b7 |
311 | no warnings 'syntax' ; |
0453d815 |
312 | print ("") |
313 | EXPECT |
314 | |
315 | ######## |
316 | # toke.c |
4438c4b7 |
317 | use warnings 'syntax' ; |
599cee73 |
318 | printf ("") |
319 | EXPECT |
320 | printf (...) interpreted as function at - line 3. |
321 | ######## |
322 | # toke.c |
4438c4b7 |
323 | no warnings 'syntax' ; |
0453d815 |
324 | printf ("") |
325 | EXPECT |
326 | |
327 | ######## |
328 | # toke.c |
4438c4b7 |
329 | use warnings 'syntax' ; |
599cee73 |
330 | sort ("") |
331 | EXPECT |
332 | sort (...) interpreted as function at - line 3. |
333 | ######## |
334 | # toke.c |
4438c4b7 |
335 | no warnings 'syntax' ; |
0453d815 |
336 | sort ("") |
337 | EXPECT |
338 | |
339 | ######## |
340 | # toke.c |
4438c4b7 |
341 | use warnings 'ambiguous' ; |
599cee73 |
342 | $a = ${time[2]}; |
4438c4b7 |
343 | no warnings 'ambiguous' ; |
0453d815 |
344 | $a = ${time[2]}; |
599cee73 |
345 | EXPECT |
346 | Ambiguous use of ${time[...]} resolved to $time[...] at - line 3. |
347 | ######## |
348 | # toke.c |
4438c4b7 |
349 | use warnings 'ambiguous' ; |
599cee73 |
350 | $a = ${time{2}}; |
351 | EXPECT |
352 | Ambiguous use of ${time{...}} resolved to $time{...} at - line 3. |
353 | ######## |
354 | # toke.c |
4438c4b7 |
355 | no warnings 'ambiguous' ; |
0453d815 |
356 | $a = ${time{2}}; |
357 | EXPECT |
358 | |
359 | ######## |
360 | # toke.c |
4438c4b7 |
361 | use warnings 'ambiguous' ; |
599cee73 |
362 | $a = ${time} ; |
4438c4b7 |
363 | no warnings 'ambiguous' ; |
0453d815 |
364 | $a = ${time} ; |
599cee73 |
365 | EXPECT |
366 | Ambiguous use of ${time} resolved to $time at - line 3. |
367 | ######## |
368 | # toke.c |
4438c4b7 |
369 | use warnings 'ambiguous' ; |
599cee73 |
370 | sub fred {} |
371 | $a = ${fred} ; |
4438c4b7 |
372 | no warnings 'ambiguous' ; |
0453d815 |
373 | $a = ${fred} ; |
599cee73 |
374 | EXPECT |
375 | Ambiguous use of ${fred} resolved to $fred at - line 4. |
376 | ######## |
377 | # toke.c |
4438c4b7 |
378 | use warnings 'syntax' ; |
599cee73 |
379 | $a = 1_2; |
380 | $a = 1_2345_6; |
4438c4b7 |
381 | no warnings 'syntax' ; |
0453d815 |
382 | $a = 1_2; |
383 | $a = 1_2345_6; |
599cee73 |
384 | EXPECT |
385 | Misplaced _ in number at - line 3. |
386 | Misplaced _ in number at - line 4. |
387 | Misplaced _ in number at - line 4. |
388 | ######## |
389 | # toke.c |
e476b1b5 |
390 | use warnings 'bareword' ; |
60e6418e |
391 | #line 25 "bar" |
599cee73 |
392 | $a = FRED:: ; |
e476b1b5 |
393 | no warnings 'bareword' ; |
0453d815 |
394 | #line 25 "bar" |
395 | $a = FRED:: ; |
599cee73 |
396 | EXPECT |
60e6418e |
397 | Bareword "FRED::" refers to nonexistent package at bar line 25. |
599cee73 |
398 | ######## |
399 | # toke.c |
4438c4b7 |
400 | use warnings 'ambiguous' ; |
599cee73 |
401 | sub time {} |
0453d815 |
402 | my $a = time() ; |
4438c4b7 |
403 | no warnings 'ambiguous' ; |
0453d815 |
404 | my $b = time() ; |
599cee73 |
405 | EXPECT |
406 | Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4. |
407 | ######## |
408 | # toke.c |
26d16222 |
409 | use warnings ; |
0453d815 |
410 | eval <<'EOE'; |
df0deb90 |
411 | # line 30 "foo" |
412 | warn "yelp"; |
0453d815 |
413 | { |
0453d815 |
414 | $_ = " \x{123} " ; |
415 | } |
416 | EOE |
417 | EXPECT |
df0deb90 |
418 | yelp at foo line 30. |
0453d815 |
419 | ######## |
420 | # toke.c |
0453d815 |
421 | my $a = rand + 4 ; |
422 | EXPECT |
423 | Warning: Use of "rand" without parens is ambiguous at - line 2. |
424 | ######## |
425 | # toke.c |
426 | $^W = 0 ; |
427 | my $a = rand + 4 ; |
428 | { |
4438c4b7 |
429 | no warnings 'ambiguous' ; |
0453d815 |
430 | $a = rand + 4 ; |
4438c4b7 |
431 | use warnings 'ambiguous' ; |
0453d815 |
432 | $a = rand + 4 ; |
433 | } |
434 | $a = rand + 4 ; |
435 | EXPECT |
436 | Warning: Use of "rand" without parens is ambiguous at - line 3. |
437 | Warning: Use of "rand" without parens is ambiguous at - line 8. |
438 | Warning: Use of "rand" without parens is ambiguous at - line 10. |
439 | ######## |
440 | # toke.c |
441 | sub fred {}; |
442 | -fred ; |
443 | EXPECT |
444 | Ambiguous use of -fred resolved as -&fred() at - line 3. |
445 | ######## |
446 | # toke.c |
447 | $^W = 0 ; |
448 | sub fred {} ; |
449 | -fred ; |
450 | { |
4438c4b7 |
451 | no warnings 'ambiguous' ; |
0453d815 |
452 | -fred ; |
4438c4b7 |
453 | use warnings 'ambiguous' ; |
0453d815 |
454 | -fred ; |
455 | } |
456 | -fred ; |
457 | EXPECT |
458 | Ambiguous use of -fred resolved as -&fred() at - line 4. |
459 | Ambiguous use of -fred resolved as -&fred() at - line 9. |
460 | Ambiguous use of -fred resolved as -&fred() at - line 11. |
461 | ######## |
462 | # toke.c |
463 | open FOO || time; |
464 | EXPECT |
465 | Precedence problem: open FOO should be open(FOO) at - line 2. |
466 | ######## |
467 | # toke.c |
468 | $^W = 0 ; |
469 | open FOO || time; |
470 | { |
e476b1b5 |
471 | no warnings 'precedence' ; |
0453d815 |
472 | open FOO || time; |
e476b1b5 |
473 | use warnings 'precedence' ; |
0453d815 |
474 | open FOO || time; |
475 | } |
476 | open FOO || time; |
477 | EXPECT |
478 | Precedence problem: open FOO should be open(FOO) at - line 3. |
479 | Precedence problem: open FOO should be open(FOO) at - line 8. |
480 | Precedence problem: open FOO should be open(FOO) at - line 10. |
481 | ######## |
482 | # toke.c |
483 | $^W = 0 ; |
484 | *foo *foo ; |
485 | { |
4438c4b7 |
486 | no warnings 'ambiguous' ; |
0453d815 |
487 | *foo *foo ; |
4438c4b7 |
488 | use warnings 'ambiguous' ; |
0453d815 |
489 | *foo *foo ; |
490 | } |
491 | *foo *foo ; |
492 | EXPECT |
493 | Operator or semicolon missing before *foo at - line 3. |
494 | Ambiguous use of * resolved as operator * at - line 3. |
495 | Operator or semicolon missing before *foo at - line 8. |
496 | Ambiguous use of * resolved as operator * at - line 8. |
497 | Operator or semicolon missing before *foo at - line 10. |
498 | Ambiguous use of * resolved as operator * at - line 10. |
767a6a26 |
499 | ######## |
500 | # toke.c |
e476b1b5 |
501 | use warnings 'misc' ; |
767a6a26 |
502 | my $a = "\m" ; |
e476b1b5 |
503 | no warnings 'misc' ; |
767a6a26 |
504 | $a = "\m" ; |
505 | EXPECT |
506 | Unrecognized escape \m passed through at - line 3. |
507 | ######## |
508 | # toke.c |
509 | use warnings 'portable' ; |
510 | my $a = 0b011111111111111111111111111111110 ; |
511 | $a = 0b011111111111111111111111111111111 ; |
512 | $a = 0b111111111111111111111111111111111 ; |
513 | $a = 0x0fffffffe ; |
514 | $a = 0x0ffffffff ; |
515 | $a = 0x1ffffffff ; |
516 | $a = 0037777777776 ; |
517 | $a = 0037777777777 ; |
518 | $a = 0047777777777 ; |
519 | no warnings 'portable' ; |
520 | $a = 0b011111111111111111111111111111110 ; |
521 | $a = 0b011111111111111111111111111111111 ; |
522 | $a = 0b111111111111111111111111111111111 ; |
523 | $a = 0x0fffffffe ; |
524 | $a = 0x0ffffffff ; |
525 | $a = 0x1ffffffff ; |
526 | $a = 0037777777776 ; |
527 | $a = 0037777777777 ; |
528 | $a = 0047777777777 ; |
529 | EXPECT |
530 | Binary number > 0b11111111111111111111111111111111 non-portable at - line 5. |
531 | Hexadecimal number > 0xffffffff non-portable at - line 8. |
532 | Octal number > 037777777777 non-portable at - line 11. |
533 | ######## |
534 | # toke.c |
535 | use warnings 'overflow' ; |
536 | my $a = 0b011111111111111111111111111111110 ; |
537 | $a = 0b011111111111111111111111111111111 ; |
15041a67 |
538 | $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; |
767a6a26 |
539 | $a = 0x0fffffffe ; |
540 | $a = 0x0ffffffff ; |
15041a67 |
541 | $a = 0x10000000000000000 ; |
767a6a26 |
542 | $a = 0037777777776 ; |
543 | $a = 0037777777777 ; |
15041a67 |
544 | $a = 002000000000000000000000; |
767a6a26 |
545 | no warnings 'overflow' ; |
546 | $a = 0b011111111111111111111111111111110 ; |
547 | $a = 0b011111111111111111111111111111111 ; |
15041a67 |
548 | $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ; |
767a6a26 |
549 | $a = 0x0fffffffe ; |
550 | $a = 0x0ffffffff ; |
15041a67 |
551 | $a = 0x10000000000000000 ; |
767a6a26 |
552 | $a = 0037777777776 ; |
553 | $a = 0037777777777 ; |
15041a67 |
554 | $a = 002000000000000000000000; |
767a6a26 |
555 | EXPECT |
556 | Integer overflow in binary number at - line 5. |
557 | Integer overflow in hexadecimal number at - line 8. |
558 | Integer overflow in octal number at - line 11. |
8593bda5 |
559 | ######## |
560 | # toke.c |
561 | use warnings 'ambiguous'; |
562 | "@mjd_previously_unused_array"; |
563 | no warnings 'ambiguous'; |
564 | "@mjd_previously_unused_array"; |
565 | EXPECT |
566 | Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3. |