Commit | Line | Data |
599cee73 |
1 | toke.c AOK |
2 | |
3 | we seem to have lost a few ambiguous warnings!! |
4 | |
5 | |
6 | 1 if $a EQ $b ; |
7 | 1 if $a NE $b ; |
8 | 1 if $a LT $b ; |
9 | 1 if $a GT $b ; |
10 | 1 if $a GE $b ; |
11 | 1 if $a LE $b ; |
12 | $a = <<; |
13 | Use of comma-less variable list is deprecated |
14 | (called 3 times via depcom) |
15 | |
16 | \1 better written as $1 |
17 | use warning 'syntax' ; |
18 | s/(abc)/\1/; |
19 | |
20 | warn(warn_nosemi) |
21 | Semicolon seems to be missing |
22 | $a = 1 |
23 | &time ; |
24 | |
25 | |
26 | Reversed %c= operator |
27 | my $a =+ 2 ; |
28 | $a =- 2 ; |
29 | $a =* 2 ; |
30 | $a =% 2 ; |
31 | $a =& 2 ; |
32 | $a =. 2 ; |
33 | $a =^ 2 ; |
34 | $a =| 2 ; |
35 | $a =< 2 ; |
36 | $a =/ 2 ; |
37 | |
38 | Multidimensional syntax %.*s not supported |
39 | my $a = $a[1,2] ; |
40 | |
41 | You need to quote \"%s\"" |
42 | sub fred {} ; $SIG{TERM} = fred; |
43 | |
44 | Scalar value %.*s better written as $%.*s" |
45 | @a[3] = 2; |
46 | @a{3} = 2; |
47 | |
48 | Can't use \\%c to mean $%c in expression |
49 | $_ = "ab" ; s/(ab)/\1/e; |
50 | |
51 | Unquoted string "abc" may clash with future reserved word at - line 3. |
52 | warn(warn_reserved |
53 | $a = abc; |
54 | |
55 | chmod: mode argument is missing initial 0 |
56 | chmod 3; |
57 | |
58 | Possible attempt to separate words with commas |
59 | @a = qw(a, b, c) ; |
60 | |
61 | Possible attempt to put comments in qw() list |
62 | @a = qw(a b # c) ; |
63 | |
64 | umask: argument is missing initial 0 |
65 | umask 3; |
66 | |
67 | %s (...) interpreted as function |
68 | print ("") |
69 | printf ("") |
70 | sort ("") |
71 | |
72 | Ambiguous use of %c{%s%s} resolved to %c%s%s |
73 | $a = ${time[2]} |
74 | $a = ${time{2}} |
75 | |
76 | |
77 | Ambiguous use of %c{%s} resolved to %c%s |
78 | $a = ${time} |
79 | sub fred {} $a = ${fred} |
80 | |
81 | Misplaced _ in number |
82 | $a = 1_2; |
83 | $a = 1_2345_6; |
84 | |
85 | Bareword \"%s\" refers to nonexistent package |
86 | $a = FRED:: ; |
87 | |
88 | Ambiguous call resolved as CORE::%s(), qualify as such or use & |
89 | sub time {} |
90 | my $a = time() |
91 | |
92 | Use of \\x{} without utf8 declaration |
93 | $_ = " \x{123} " ; |
94 | |
95 | |
96 | \x%.*s will produce malformed UTF-8 character; use \x{%.*s} for that |
97 | use utf8 ; |
98 | $_ = "\xffe" |
99 | |
0453d815 |
100 | Mandatory Warnings |
101 | ------------------ |
102 | Use of "%s" without parentheses is ambiguous [check_uni] |
103 | rand + 4 |
104 | |
105 | Ambiguous use of -%s resolved as -&%s() [yylex] |
106 | sub fred {} ; - fred ; |
107 | |
108 | Precedence problem: open %.*s should be open(%.*s) [yylex] |
109 | open FOO || die; |
110 | |
111 | Operator or semicolon missing before %c%s [yylex] |
112 | Ambiguous use of %c resolved as operator %c |
113 | *foo *foo |
114 | |
599cee73 |
115 | __END__ |
116 | # toke.c |
117 | use warning 'deprecated' ; |
118 | 1 if $a EQ $b ; |
119 | 1 if $a NE $b ; |
120 | 1 if $a GT $b ; |
121 | 1 if $a LT $b ; |
122 | 1 if $a GE $b ; |
123 | 1 if $a LE $b ; |
0453d815 |
124 | no warning 'deprecated' ; |
125 | 1 if $a EQ $b ; |
126 | 1 if $a NE $b ; |
127 | 1 if $a GT $b ; |
128 | 1 if $a LT $b ; |
129 | 1 if $a GE $b ; |
130 | 1 if $a LE $b ; |
599cee73 |
131 | EXPECT |
132 | Use of EQ is deprecated at - line 3. |
133 | Use of NE is deprecated at - line 4. |
134 | Use of GT is deprecated at - line 5. |
135 | Use of LT is deprecated at - line 6. |
136 | Use of GE is deprecated at - line 7. |
137 | Use of LE is deprecated at - line 8. |
138 | ######## |
139 | # toke.c |
140 | use warning 'deprecated' ; |
141 | format STDOUT = |
142 | @<<< @||| @>>> @>>> |
143 | $a $b "abc" 'def' |
144 | . |
0453d815 |
145 | no warning 'deprecated' ; |
146 | format STDOUT = |
147 | @<<< @||| @>>> @>>> |
148 | $a $b "abc" 'def' |
149 | . |
599cee73 |
150 | EXPECT |
151 | Use of comma-less variable list is deprecated at - line 5. |
152 | Use of comma-less variable list is deprecated at - line 5. |
153 | Use of comma-less variable list is deprecated at - line 5. |
599cee73 |
154 | ######## |
155 | # toke.c |
156 | use warning 'deprecated' ; |
157 | $a = <<; |
158 | |
0453d815 |
159 | no warning 'deprecated' ; |
160 | $a = <<; |
161 | |
599cee73 |
162 | EXPECT |
163 | Use of bare << to mean <<"" is deprecated at - line 3. |
164 | ######## |
165 | # toke.c |
166 | use warning 'syntax' ; |
167 | s/(abc)/\1/; |
0453d815 |
168 | no warning 'syntax' ; |
169 | s/(abc)/\1/; |
599cee73 |
170 | EXPECT |
171 | \1 better written as $1 at - line 3. |
172 | ######## |
173 | # toke.c |
174 | use warning 'semicolon' ; |
175 | $a = 1 |
176 | &time ; |
0453d815 |
177 | no warning 'semicolon' ; |
178 | $a = 1 |
179 | &time ; |
599cee73 |
180 | EXPECT |
181 | Semicolon seems to be missing at - line 3. |
182 | ######## |
183 | # toke.c |
e4050d25 |
184 | BEGIN { |
185 | # Scalars leaked: due to syntax errors |
186 | $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3; |
187 | } |
599cee73 |
188 | use warning 'syntax' ; |
189 | my $a =+ 2 ; |
190 | $a =- 2 ; |
191 | $a =* 2 ; |
192 | $a =% 2 ; |
193 | $a =& 2 ; |
194 | $a =. 2 ; |
195 | $a =^ 2 ; |
196 | $a =| 2 ; |
197 | $a =< 2 ; |
198 | $a =/ 2 ; |
199 | EXPECT |
e4050d25 |
200 | Reversed += operator at - line 7. |
201 | Reversed -= operator at - line 8. |
202 | Reversed *= operator at - line 9. |
203 | Reversed %= operator at - line 10. |
204 | Reversed &= operator at - line 11. |
205 | Reversed .= operator at - line 12. |
206 | syntax error at - line 12, near "=." |
207 | Reversed ^= operator at - line 13. |
208 | syntax error at - line 13, near "=^" |
209 | Reversed |= operator at - line 14. |
210 | syntax error at - line 14, near "=|" |
211 | Reversed <= operator at - line 15. |
212 | Unterminated <> operator at - line 15. |
599cee73 |
213 | ######## |
214 | # toke.c |
0453d815 |
215 | BEGIN { |
216 | # Scalars leaked: due to syntax errors |
217 | $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3; |
218 | } |
219 | no warning 'syntax' ; |
220 | my $a =+ 2 ; |
221 | $a =- 2 ; |
222 | $a =* 2 ; |
223 | $a =% 2 ; |
224 | $a =& 2 ; |
225 | $a =. 2 ; |
226 | $a =^ 2 ; |
227 | $a =| 2 ; |
228 | $a =< 2 ; |
229 | $a =/ 2 ; |
230 | EXPECT |
231 | syntax error at - line 12, near "=." |
232 | syntax error at - line 13, near "=^" |
233 | syntax error at - line 14, near "=|" |
234 | Unterminated <> operator at - line 15. |
235 | ######## |
236 | # toke.c |
599cee73 |
237 | use warning 'syntax' ; |
238 | my $a = $a[1,2] ; |
0453d815 |
239 | no warning 'syntax' ; |
240 | my $a = $a[1,2] ; |
599cee73 |
241 | EXPECT |
242 | Multidimensional syntax $a[1,2] not supported at - line 3. |
243 | ######## |
244 | # toke.c |
245 | use warning 'syntax' ; |
246 | sub fred {} ; $SIG{TERM} = fred; |
0453d815 |
247 | no warning 'syntax' ; |
248 | $SIG{TERM} = fred; |
599cee73 |
249 | EXPECT |
250 | You need to quote "fred" at - line 3. |
251 | ######## |
252 | # toke.c |
253 | use warning 'syntax' ; |
254 | @a[3] = 2; |
255 | @a{3} = 2; |
0453d815 |
256 | no warning 'syntax' ; |
257 | @a[3] = 2; |
258 | @a{3} = 2; |
599cee73 |
259 | EXPECT |
260 | Scalar value @a[3] better written as $a[3] at - line 3. |
261 | Scalar value @a{3} better written as $a{3} at - line 4. |
262 | ######## |
263 | # toke.c |
264 | use warning 'syntax' ; |
265 | $_ = "ab" ; |
266 | s/(ab)/\1/e; |
0453d815 |
267 | no warning 'syntax' ; |
268 | $_ = "ab" ; |
269 | s/(ab)/\1/e; |
599cee73 |
270 | EXPECT |
271 | Can't use \1 to mean $1 in expression at - line 4. |
272 | ######## |
273 | # toke.c |
274 | use warning 'reserved' ; |
275 | $a = abc; |
0453d815 |
276 | no warning 'reserved' ; |
277 | $a = abc; |
599cee73 |
278 | EXPECT |
279 | Unquoted string "abc" may clash with future reserved word at - line 3. |
280 | ######## |
281 | # toke.c |
282 | use warning 'octal' ; |
283 | chmod 3; |
0453d815 |
284 | no warning 'octal' ; |
285 | chmod 3; |
599cee73 |
286 | EXPECT |
287 | chmod: mode argument is missing initial 0 at - line 3, at end of line |
288 | ######## |
289 | # toke.c |
290 | use warning 'syntax' ; |
291 | @a = qw(a, b, c) ; |
0453d815 |
292 | no warning 'syntax' ; |
293 | @a = qw(a, b, c) ; |
599cee73 |
294 | EXPECT |
295 | Possible attempt to separate words with commas at - line 3. |
296 | ######## |
297 | # toke.c |
298 | use warning 'syntax' ; |
299 | @a = qw(a b #) ; |
0453d815 |
300 | no warning 'syntax' ; |
301 | @a = qw(a b #) ; |
599cee73 |
302 | EXPECT |
303 | Possible attempt to put comments in qw() list at - line 3. |
304 | ######## |
305 | # toke.c |
306 | use warning 'octal' ; |
307 | umask 3; |
0453d815 |
308 | no warning 'octal' ; |
309 | umask 3; |
599cee73 |
310 | EXPECT |
311 | umask: argument is missing initial 0 at - line 3, at end of line |
312 | ######## |
313 | # toke.c |
314 | use warning 'syntax' ; |
315 | print ("") |
316 | EXPECT |
317 | print (...) interpreted as function at - line 3. |
318 | ######## |
319 | # toke.c |
0453d815 |
320 | no warning 'syntax' ; |
321 | print ("") |
322 | EXPECT |
323 | |
324 | ######## |
325 | # toke.c |
599cee73 |
326 | use warning 'syntax' ; |
327 | printf ("") |
328 | EXPECT |
329 | printf (...) interpreted as function at - line 3. |
330 | ######## |
331 | # toke.c |
0453d815 |
332 | no warning 'syntax' ; |
333 | printf ("") |
334 | EXPECT |
335 | |
336 | ######## |
337 | # toke.c |
599cee73 |
338 | use warning 'syntax' ; |
339 | sort ("") |
340 | EXPECT |
341 | sort (...) interpreted as function at - line 3. |
342 | ######## |
343 | # toke.c |
0453d815 |
344 | no warning 'syntax' ; |
345 | sort ("") |
346 | EXPECT |
347 | |
348 | ######## |
349 | # toke.c |
599cee73 |
350 | use warning 'ambiguous' ; |
351 | $a = ${time[2]}; |
0453d815 |
352 | no warning 'ambiguous' ; |
353 | $a = ${time[2]}; |
599cee73 |
354 | EXPECT |
355 | Ambiguous use of ${time[...]} resolved to $time[...] at - line 3. |
356 | ######## |
357 | # toke.c |
358 | use warning 'ambiguous' ; |
359 | $a = ${time{2}}; |
360 | EXPECT |
361 | Ambiguous use of ${time{...}} resolved to $time{...} at - line 3. |
362 | ######## |
363 | # toke.c |
0453d815 |
364 | no warning 'ambiguous' ; |
365 | $a = ${time{2}}; |
366 | EXPECT |
367 | |
368 | ######## |
369 | # toke.c |
599cee73 |
370 | use warning 'ambiguous' ; |
371 | $a = ${time} ; |
0453d815 |
372 | no warning 'ambiguous' ; |
373 | $a = ${time} ; |
599cee73 |
374 | EXPECT |
375 | Ambiguous use of ${time} resolved to $time at - line 3. |
376 | ######## |
377 | # toke.c |
378 | use warning 'ambiguous' ; |
379 | sub fred {} |
380 | $a = ${fred} ; |
0453d815 |
381 | no warning 'ambiguous' ; |
382 | $a = ${fred} ; |
599cee73 |
383 | EXPECT |
384 | Ambiguous use of ${fred} resolved to $fred at - line 4. |
385 | ######## |
386 | # toke.c |
387 | use warning 'syntax' ; |
388 | $a = 1_2; |
389 | $a = 1_2345_6; |
0453d815 |
390 | no warning 'syntax' ; |
391 | $a = 1_2; |
392 | $a = 1_2345_6; |
599cee73 |
393 | EXPECT |
394 | Misplaced _ in number at - line 3. |
395 | Misplaced _ in number at - line 4. |
396 | Misplaced _ in number at - line 4. |
397 | ######## |
398 | # toke.c |
399 | use warning 'unsafe' ; |
60e6418e |
400 | #line 25 "bar" |
599cee73 |
401 | $a = FRED:: ; |
0453d815 |
402 | no warning 'unsafe' ; |
403 | #line 25 "bar" |
404 | $a = FRED:: ; |
599cee73 |
405 | EXPECT |
60e6418e |
406 | Bareword "FRED::" refers to nonexistent package at bar line 25. |
599cee73 |
407 | ######## |
408 | # toke.c |
409 | use warning 'ambiguous' ; |
410 | sub time {} |
0453d815 |
411 | my $a = time() ; |
412 | no warning 'ambiguous' ; |
413 | my $b = time() ; |
599cee73 |
414 | EXPECT |
415 | Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4. |
416 | ######## |
417 | # toke.c |
418 | use warning 'utf8' ; |
60e6418e |
419 | eval <<'EOE'; |
420 | { |
421 | #line 30 "foo" |
422 | $_ = " \x{123} " ; |
423 | } |
424 | EOE |
599cee73 |
425 | EXPECT |
60e6418e |
426 | Use of \x{} without utf8 declaration at foo line 30. |
599cee73 |
427 | ######## |
428 | # toke.c |
0453d815 |
429 | no warning 'utf8' ; |
430 | eval <<'EOE'; |
431 | { |
432 | #line 30 "foo" |
433 | $_ = " \x{123} " ; |
434 | } |
435 | EOE |
436 | EXPECT |
437 | |
438 | ######## |
439 | # toke.c |
599cee73 |
440 | use warning 'utf8' ; |
441 | use utf8 ; |
442 | $_ = " \xffe " ; |
0453d815 |
443 | no warning 'utf8' ; |
444 | $_ = " \xffe " ; |
599cee73 |
445 | EXPECT |
446 | \xff will produce malformed UTF-8 character; use \x{ff} for that at - line 4. |
0453d815 |
447 | ######## |
448 | # toke.c |
449 | my $a = rand + 4 ; |
450 | EXPECT |
451 | Warning: Use of "rand" without parens is ambiguous at - line 2. |
452 | ######## |
453 | # toke.c |
454 | $^W = 0 ; |
455 | my $a = rand + 4 ; |
456 | { |
457 | no warning 'ambiguous' ; |
458 | $a = rand + 4 ; |
459 | use warning 'ambiguous' ; |
460 | $a = rand + 4 ; |
461 | } |
462 | $a = rand + 4 ; |
463 | EXPECT |
464 | Warning: Use of "rand" without parens is ambiguous at - line 3. |
465 | Warning: Use of "rand" without parens is ambiguous at - line 8. |
466 | Warning: Use of "rand" without parens is ambiguous at - line 10. |
467 | ######## |
468 | # toke.c |
469 | sub fred {}; |
470 | -fred ; |
471 | EXPECT |
472 | Ambiguous use of -fred resolved as -&fred() at - line 3. |
473 | ######## |
474 | # toke.c |
475 | $^W = 0 ; |
476 | sub fred {} ; |
477 | -fred ; |
478 | { |
479 | no warning 'ambiguous' ; |
480 | -fred ; |
481 | use warning 'ambiguous' ; |
482 | -fred ; |
483 | } |
484 | -fred ; |
485 | EXPECT |
486 | Ambiguous use of -fred resolved as -&fred() at - line 4. |
487 | Ambiguous use of -fred resolved as -&fred() at - line 9. |
488 | Ambiguous use of -fred resolved as -&fred() at - line 11. |
489 | ######## |
490 | # toke.c |
491 | open FOO || time; |
492 | EXPECT |
493 | Precedence problem: open FOO should be open(FOO) at - line 2. |
494 | ######## |
495 | # toke.c |
496 | $^W = 0 ; |
497 | open FOO || time; |
498 | { |
499 | no warning 'ambiguous' ; |
500 | open FOO || time; |
501 | use warning 'ambiguous' ; |
502 | open FOO || time; |
503 | } |
504 | open FOO || time; |
505 | EXPECT |
506 | Precedence problem: open FOO should be open(FOO) at - line 3. |
507 | Precedence problem: open FOO should be open(FOO) at - line 8. |
508 | Precedence problem: open FOO should be open(FOO) at - line 10. |
509 | ######## |
510 | # toke.c |
511 | $^W = 0 ; |
512 | *foo *foo ; |
513 | { |
514 | no warning 'ambiguous' ; |
515 | *foo *foo ; |
516 | use warning 'ambiguous' ; |
517 | *foo *foo ; |
518 | } |
519 | *foo *foo ; |
520 | EXPECT |
521 | Operator or semicolon missing before *foo at - line 3. |
522 | Ambiguous use of * resolved as operator * at - line 3. |
523 | Operator or semicolon missing before *foo at - line 8. |
524 | Ambiguous use of * resolved as operator * at - line 8. |
525 | Operator or semicolon missing before *foo at - line 10. |
526 | Ambiguous use of * resolved as operator * at - line 10. |