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