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