| 1 | toke.c AOK
|
|---|
| 2 |
|
|---|
| 3 | we seem to have lost a few ambiguous warnings!!
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 | $a = <<;
|
|---|
| 7 | Use of comma-less variable list is deprecated
|
|---|
| 8 | (called 3 times via depcom)
|
|---|
| 9 |
|
|---|
| 10 | \1 better written as $1
|
|---|
| 11 | use warnings 'syntax' ;
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 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 ;
|
|---|
| 104 |
|
|---|
| 105 | dump() better written as CORE::dump()
|
|---|
| 106 |
|
|---|
| 107 | Use of /c modifier is meaningless without /g
|
|---|
| 108 |
|
|---|
| 109 | Use of /c modifier is meaningless in s///
|
|---|
| 110 |
|
|---|
| 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 |
|
|---|
| 126 | __END__
|
|---|
| 127 | # toke.c
|
|---|
| 128 | use warnings 'deprecated' ;
|
|---|
| 129 | format STDOUT =
|
|---|
| 130 | @<<< @||| @>>> @>>>
|
|---|
| 131 | $a $b "abc" 'def'
|
|---|
| 132 | .
|
|---|
| 133 | no warnings 'deprecated' ;
|
|---|
| 134 | format STDOUT =
|
|---|
| 135 | @<<< @||| @>>> @>>>
|
|---|
| 136 | $a $b "abc" 'def'
|
|---|
| 137 | .
|
|---|
| 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.
|
|---|
| 142 | ########
|
|---|
| 143 | # toke.c
|
|---|
| 144 | use warnings 'deprecated' ;
|
|---|
| 145 | $a = <<;
|
|---|
| 146 |
|
|---|
| 147 | no warnings 'deprecated' ;
|
|---|
| 148 | $a = <<;
|
|---|
| 149 |
|
|---|
| 150 | EXPECT
|
|---|
| 151 | Use of bare << to mean <<"" is deprecated at - line 3.
|
|---|
| 152 | ########
|
|---|
| 153 | # toke.c
|
|---|
| 154 | use warnings 'syntax' ;
|
|---|
| 155 | s/(abc)/\1/;
|
|---|
| 156 | no warnings 'syntax' ;
|
|---|
| 157 | s/(abc)/\1/;
|
|---|
| 158 | EXPECT
|
|---|
| 159 | \1 better written as $1 at - line 3.
|
|---|
| 160 | ########
|
|---|
| 161 | # toke.c
|
|---|
| 162 | use warnings 'semicolon' ;
|
|---|
| 163 | $a = 1
|
|---|
| 164 | &time ;
|
|---|
| 165 | no warnings 'semicolon' ;
|
|---|
| 166 | $a = 1
|
|---|
| 167 | &time ;
|
|---|
| 168 | EXPECT
|
|---|
| 169 | Semicolon seems to be missing at - line 3.
|
|---|
| 170 | ########
|
|---|
| 171 | # toke.c
|
|---|
| 172 | use warnings 'syntax' ;
|
|---|
| 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
|
|---|
| 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.
|
|---|
| 197 | ########
|
|---|
| 198 | # toke.c
|
|---|
| 199 | no warnings 'syntax' ;
|
|---|
| 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
|
|---|
| 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.
|
|---|
| 215 | ########
|
|---|
| 216 | # toke.c
|
|---|
| 217 | use warnings 'syntax' ;
|
|---|
| 218 | my $a = $a[1,2] ;
|
|---|
| 219 | no warnings 'syntax' ;
|
|---|
| 220 | my $a = $a[1,2] ;
|
|---|
| 221 | EXPECT
|
|---|
| 222 | Multidimensional syntax $a[1,2] not supported at - line 3.
|
|---|
| 223 | ########
|
|---|
| 224 | # toke.c
|
|---|
| 225 | use warnings 'syntax' ;
|
|---|
| 226 | sub fred {} ; $SIG{TERM} = fred;
|
|---|
| 227 | no warnings 'syntax' ;
|
|---|
| 228 | $SIG{TERM} = fred;
|
|---|
| 229 | EXPECT
|
|---|
| 230 | You need to quote "fred" at - line 3.
|
|---|
| 231 | ########
|
|---|
| 232 | # toke.c
|
|---|
| 233 | use warnings 'syntax' ;
|
|---|
| 234 | @a[3] = 2;
|
|---|
| 235 | @a{3} = 2;
|
|---|
| 236 | no warnings 'syntax' ;
|
|---|
| 237 | @a[3] = 2;
|
|---|
| 238 | @a{3} = 2;
|
|---|
| 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
|
|---|
| 244 | use warnings 'syntax' ;
|
|---|
| 245 | $_ = "ab" ;
|
|---|
| 246 | s/(ab)/\1/e;
|
|---|
| 247 | no warnings 'syntax' ;
|
|---|
| 248 | $_ = "ab" ;
|
|---|
| 249 | s/(ab)/\1/e;
|
|---|
| 250 | EXPECT
|
|---|
| 251 | Can't use \1 to mean $1 in expression at - line 4.
|
|---|
| 252 | ########
|
|---|
| 253 | # toke.c
|
|---|
| 254 | use warnings 'reserved' ;
|
|---|
| 255 | $a = abc;
|
|---|
| 256 | $a = { def
|
|---|
| 257 |
|
|---|
| 258 | => 1 };
|
|---|
| 259 | no warnings 'reserved' ;
|
|---|
| 260 | $a = abc;
|
|---|
| 261 | EXPECT
|
|---|
| 262 | Unquoted string "abc" may clash with future reserved word at - line 3.
|
|---|
| 263 | ########
|
|---|
| 264 | # toke.c
|
|---|
| 265 | use warnings 'qw' ;
|
|---|
| 266 | @a = qw(a, b, c) ;
|
|---|
| 267 | no warnings 'qw' ;
|
|---|
| 268 | @a = qw(a, b, c) ;
|
|---|
| 269 | EXPECT
|
|---|
| 270 | Possible attempt to separate words with commas at - line 3.
|
|---|
| 271 | ########
|
|---|
| 272 | # toke.c
|
|---|
| 273 | use warnings 'qw' ;
|
|---|
| 274 | @a = qw(a b #) ;
|
|---|
| 275 | no warnings 'qw' ;
|
|---|
| 276 | @a = qw(a b #) ;
|
|---|
| 277 | EXPECT
|
|---|
| 278 | Possible attempt to put comments in qw() list at - line 3.
|
|---|
| 279 | ########
|
|---|
| 280 | # toke.c
|
|---|
| 281 | use warnings 'syntax' ;
|
|---|
| 282 | print ("")
|
|---|
| 283 | EXPECT
|
|---|
| 284 | print (...) interpreted as function at - line 3.
|
|---|
| 285 | ########
|
|---|
| 286 | # toke.c
|
|---|
| 287 | no warnings 'syntax' ;
|
|---|
| 288 | print ("")
|
|---|
| 289 | EXPECT
|
|---|
| 290 |
|
|---|
| 291 | ########
|
|---|
| 292 | # toke.c
|
|---|
| 293 | use warnings 'syntax' ;
|
|---|
| 294 | printf ("")
|
|---|
| 295 | EXPECT
|
|---|
| 296 | printf (...) interpreted as function at - line 3.
|
|---|
| 297 | ########
|
|---|
| 298 | # toke.c
|
|---|
| 299 | no warnings 'syntax' ;
|
|---|
| 300 | printf ("")
|
|---|
| 301 | EXPECT
|
|---|
| 302 |
|
|---|
| 303 | ########
|
|---|
| 304 | # toke.c
|
|---|
| 305 | use warnings 'syntax' ;
|
|---|
| 306 | sort ("")
|
|---|
| 307 | EXPECT
|
|---|
| 308 | sort (...) interpreted as function at - line 3.
|
|---|
| 309 | ########
|
|---|
| 310 | # toke.c
|
|---|
| 311 | no warnings 'syntax' ;
|
|---|
| 312 | sort ("")
|
|---|
| 313 | EXPECT
|
|---|
| 314 |
|
|---|
| 315 | ########
|
|---|
| 316 | # toke.c
|
|---|
| 317 | use warnings 'ambiguous' ;
|
|---|
| 318 | $a = ${time[2]};
|
|---|
| 319 | no warnings 'ambiguous' ;
|
|---|
| 320 | $a = ${time[2]};
|
|---|
| 321 | EXPECT
|
|---|
| 322 | Ambiguous use of ${time[...]} resolved to $time[...] at - line 3.
|
|---|
| 323 | ########
|
|---|
| 324 | # toke.c
|
|---|
| 325 | use warnings 'ambiguous' ;
|
|---|
| 326 | $a = ${time{2}};
|
|---|
| 327 | EXPECT
|
|---|
| 328 | Ambiguous use of ${time{...}} resolved to $time{...} at - line 3.
|
|---|
| 329 | ########
|
|---|
| 330 | # toke.c
|
|---|
| 331 | no warnings 'ambiguous' ;
|
|---|
| 332 | $a = ${time{2}};
|
|---|
| 333 | EXPECT
|
|---|
| 334 |
|
|---|
| 335 | ########
|
|---|
| 336 | # toke.c
|
|---|
| 337 | use warnings 'ambiguous' ;
|
|---|
| 338 | $a = ${time} ;
|
|---|
| 339 | no warnings 'ambiguous' ;
|
|---|
| 340 | $a = ${time} ;
|
|---|
| 341 | EXPECT
|
|---|
| 342 | Ambiguous use of ${time} resolved to $time at - line 3.
|
|---|
| 343 | ########
|
|---|
| 344 | # toke.c
|
|---|
| 345 | use warnings 'ambiguous' ;
|
|---|
| 346 | sub fred {}
|
|---|
| 347 | $a = ${fred} ;
|
|---|
| 348 | no warnings 'ambiguous' ;
|
|---|
| 349 | $a = ${fred} ;
|
|---|
| 350 | EXPECT
|
|---|
| 351 | Ambiguous use of ${fred} resolved to $fred at - line 4.
|
|---|
| 352 | ########
|
|---|
| 353 | # toke.c
|
|---|
| 354 | use warnings 'syntax' ;
|
|---|
| 355 | $a = _123; print "$a\n"; #( 3 string)
|
|---|
| 356 | $a = 1_23; print "$a\n";
|
|---|
| 357 | $a = 12_3; print "$a\n";
|
|---|
| 358 | $a = 123_; print "$a\n"; # 6
|
|---|
| 359 | $a = _+123; print "$a\n"; # 7 string)
|
|---|
| 360 | $a = +_123; print "$a\n"; #( 8 string)
|
|---|
| 361 | $a = +1_23; print "$a\n";
|
|---|
| 362 | $a = +12_3; print "$a\n";
|
|---|
| 363 | $a = +123_; print "$a\n"; # 11
|
|---|
| 364 | $a = _-123; print "$a\n"; #(12 string)
|
|---|
| 365 | $a = -_123; print "$a\n"; #(13 string)
|
|---|
| 366 | $a = -1_23; print "$a\n";
|
|---|
| 367 | $a = -12_3; print "$a\n";
|
|---|
| 368 | $a = -123_; print "$a\n"; # 16
|
|---|
| 369 | $a = 123._456; print "$a\n"; # 17
|
|---|
| 370 | $a = 123.4_56; print "$a\n";
|
|---|
| 371 | $a = 123.45_6; print "$a\n";
|
|---|
| 372 | $a = 123.456_; print "$a\n"; # 20
|
|---|
| 373 | $a = +123._456; print "$a\n"; # 21
|
|---|
| 374 | $a = +123.4_56; print "$a\n";
|
|---|
| 375 | $a = +123.45_6; print "$a\n";
|
|---|
| 376 | $a = +123.456_; print "$a\n"; # 24
|
|---|
| 377 | $a = -123._456; print "$a\n"; # 25
|
|---|
| 378 | $a = -123.4_56; print "$a\n";
|
|---|
| 379 | $a = -123.45_6; print "$a\n";
|
|---|
| 380 | $a = -123.456_; print "$a\n"; # 28
|
|---|
| 381 | $a = 123.456E_12; printf("%.0f\n", $a); # 29
|
|---|
| 382 | $a = 123.456E1_2; printf("%.0f\n", $a);
|
|---|
| 383 | $a = 123.456E12_; printf("%.0f\n", $a); # 31
|
|---|
| 384 | $a = 123.456E_+12; printf("%.0f\n", $a); # 32
|
|---|
| 385 | $a = 123.456E+_12; printf("%.0f\n", $a); # 33
|
|---|
| 386 | $a = 123.456E+1_2; printf("%.0f\n", $a);
|
|---|
| 387 | $a = 123.456E+12_; printf("%.0f\n", $a); # 35
|
|---|
| 388 | $a = 123.456E_-12; print "$a\n"; # 36
|
|---|
| 389 | $a = 123.456E-_12; print "$a\n"; # 37
|
|---|
| 390 | $a = 123.456E-1_2; print "$a\n";
|
|---|
| 391 | $a = 123.456E-12_; print "$a\n"; # 39
|
|---|
| 392 | $a = 1__23; print "$a\n"; # 40
|
|---|
| 393 | $a = 12.3__4; print "$a\n"; # 41
|
|---|
| 394 | $a = 12.34e1__2; printf("%.0f\n", $a); # 42
|
|---|
| 395 | no warnings 'syntax' ;
|
|---|
| 396 | $a = _123; print "$a\n";
|
|---|
| 397 | $a = 1_23; print "$a\n";
|
|---|
| 398 | $a = 12_3; print "$a\n";
|
|---|
| 399 | $a = 123_; print "$a\n";
|
|---|
| 400 | $a = _+123; print "$a\n";
|
|---|
| 401 | $a = +_123; print "$a\n";
|
|---|
| 402 | $a = +1_23; print "$a\n";
|
|---|
| 403 | $a = +12_3; print "$a\n";
|
|---|
| 404 | $a = +123_; print "$a\n";
|
|---|
| 405 | $a = _-123; print "$a\n";
|
|---|
| 406 | $a = -_123; print "$a\n";
|
|---|
| 407 | $a = -1_23; print "$a\n";
|
|---|
| 408 | $a = -12_3; print "$a\n";
|
|---|
| 409 | $a = -123_; print "$a\n";
|
|---|
| 410 | $a = 123._456; print "$a\n";
|
|---|
| 411 | $a = 123.4_56; print "$a\n";
|
|---|
| 412 | $a = 123.45_6; print "$a\n";
|
|---|
| 413 | $a = 123.456_; print "$a\n";
|
|---|
| 414 | $a = +123._456; print "$a\n";
|
|---|
| 415 | $a = +123.4_56; print "$a\n";
|
|---|
| 416 | $a = +123.45_6; print "$a\n";
|
|---|
| 417 | $a = +123.456_; print "$a\n";
|
|---|
| 418 | $a = -123._456; print "$a\n";
|
|---|
| 419 | $a = -123.4_56; print "$a\n";
|
|---|
| 420 | $a = -123.45_6; print "$a\n";
|
|---|
| 421 | $a = -123.456_; print "$a\n";
|
|---|
| 422 | $a = 123.456E_12; printf("%.0f\n", $a);
|
|---|
| 423 | $a = 123.456E1_2; printf("%.0f\n", $a);
|
|---|
| 424 | $a = 123.456E12_; printf("%.0f\n", $a);
|
|---|
| 425 | $a = 123.456E_+12; printf("%.0f\n", $a);
|
|---|
| 426 | $a = 123.456E+_12; printf("%.0f\n", $a);
|
|---|
| 427 | $a = 123.456E+1_2; printf("%.0f\n", $a);
|
|---|
| 428 | $a = 123.456E+12_; printf("%.0f\n", $a);
|
|---|
| 429 | $a = 123.456E_-12; print "$a\n";
|
|---|
| 430 | $a = 123.456E-_12; print "$a\n";
|
|---|
| 431 | $a = 123.456E-1_2; print "$a\n";
|
|---|
| 432 | $a = 123.456E-12_; print "$a\n";
|
|---|
| 433 | $a = 1__23; print "$a\n";
|
|---|
| 434 | $a = 12.3__4; print "$a\n";
|
|---|
| 435 | $a = 12.34e1__2; printf("%.0f\n", $a);
|
|---|
| 436 | EXPECT
|
|---|
| 437 | OPTIONS regex
|
|---|
| 438 | Misplaced _ in number at - line 6.
|
|---|
| 439 | Misplaced _ in number at - line 11.
|
|---|
| 440 | Misplaced _ in number at - line 16.
|
|---|
| 441 | Misplaced _ in number at - line 17.
|
|---|
| 442 | Misplaced _ in number at - line 20.
|
|---|
| 443 | Misplaced _ in number at - line 21.
|
|---|
| 444 | Misplaced _ in number at - line 24.
|
|---|
| 445 | Misplaced _ in number at - line 25.
|
|---|
| 446 | Misplaced _ in number at - line 28.
|
|---|
| 447 | Misplaced _ in number at - line 29.
|
|---|
| 448 | Misplaced _ in number at - line 31.
|
|---|
| 449 | Misplaced _ in number at - line 32.
|
|---|
| 450 | Misplaced _ in number at - line 33.
|
|---|
| 451 | Misplaced _ in number at - line 35.
|
|---|
| 452 | Misplaced _ in number at - line 36.
|
|---|
| 453 | Misplaced _ in number at - line 37.
|
|---|
| 454 | Misplaced _ in number at - line 39.
|
|---|
| 455 | Misplaced _ in number at - line 40.
|
|---|
| 456 | Misplaced _ in number at - line 41.
|
|---|
| 457 | Misplaced _ in number at - line 42.
|
|---|
| 458 | _123
|
|---|
| 459 | 123
|
|---|
| 460 | 123
|
|---|
| 461 | 123
|
|---|
| 462 | 123
|
|---|
| 463 | _123
|
|---|
| 464 | 123
|
|---|
| 465 | 123
|
|---|
| 466 | 123
|
|---|
| 467 | -123
|
|---|
| 468 | -_123
|
|---|
| 469 | -123
|
|---|
| 470 | -123
|
|---|
| 471 | -123
|
|---|
| 472 | 123.456
|
|---|
| 473 | 123.456
|
|---|
| 474 | 123.456
|
|---|
| 475 | 123.456
|
|---|
| 476 | 123.456
|
|---|
| 477 | 123.456
|
|---|
| 478 | 123.456
|
|---|
| 479 | 123.456
|
|---|
| 480 | -123.456
|
|---|
| 481 | -123.456
|
|---|
| 482 | -123.456
|
|---|
| 483 | -123.456
|
|---|
| 484 | 123456000000000
|
|---|
| 485 | 123456000000000
|
|---|
| 486 | 123456000000000
|
|---|
| 487 | 123456000000000
|
|---|
| 488 | 123456000000000
|
|---|
| 489 | 123456000000000
|
|---|
| 490 | 123456000000000
|
|---|
| 491 | 1.23456e-0?10
|
|---|
| 492 | 1.23456e-0?10
|
|---|
| 493 | 1.23456e-0?10
|
|---|
| 494 | 1.23456e-0?10
|
|---|
| 495 | 123
|
|---|
| 496 | 12.34
|
|---|
| 497 | 12340000000000
|
|---|
| 498 | _123
|
|---|
| 499 | 123
|
|---|
| 500 | 123
|
|---|
| 501 | 123
|
|---|
| 502 | 123
|
|---|
| 503 | _123
|
|---|
| 504 | 123
|
|---|
| 505 | 123
|
|---|
| 506 | 123
|
|---|
| 507 | -123
|
|---|
| 508 | -_123
|
|---|
| 509 | -123
|
|---|
| 510 | -123
|
|---|
| 511 | -123
|
|---|
| 512 | 123.456
|
|---|
| 513 | 123.456
|
|---|
| 514 | 123.456
|
|---|
| 515 | 123.456
|
|---|
| 516 | 123.456
|
|---|
| 517 | 123.456
|
|---|
| 518 | 123.456
|
|---|
| 519 | 123.456
|
|---|
| 520 | -123.456
|
|---|
| 521 | -123.456
|
|---|
| 522 | -123.456
|
|---|
| 523 | -123.456
|
|---|
| 524 | 123456000000000
|
|---|
| 525 | 123456000000000
|
|---|
| 526 | 123456000000000
|
|---|
| 527 | 123456000000000
|
|---|
| 528 | 123456000000000
|
|---|
| 529 | 123456000000000
|
|---|
| 530 | 123456000000000
|
|---|
| 531 | 1.23456e-0?10
|
|---|
| 532 | 1.23456e-0?10
|
|---|
| 533 | 1.23456e-0?10
|
|---|
| 534 | 1.23456e-0?10
|
|---|
| 535 | 123
|
|---|
| 536 | 12.34
|
|---|
| 537 | 12340000000000
|
|---|
| 538 | ########
|
|---|
| 539 | # toke.c
|
|---|
| 540 | use warnings 'bareword' ;
|
|---|
| 541 | #line 25 "bar"
|
|---|
| 542 | $a = FRED:: ;
|
|---|
| 543 | no warnings 'bareword' ;
|
|---|
| 544 | #line 25 "bar"
|
|---|
| 545 | $a = FRED:: ;
|
|---|
| 546 | EXPECT
|
|---|
| 547 | Bareword "FRED::" refers to nonexistent package at bar line 25.
|
|---|
| 548 | ########
|
|---|
| 549 | # toke.c
|
|---|
| 550 | use warnings 'ambiguous' ;
|
|---|
| 551 | sub time {}
|
|---|
| 552 | my $a = time() ;
|
|---|
| 553 | no warnings 'ambiguous' ;
|
|---|
| 554 | my $b = time() ;
|
|---|
| 555 | EXPECT
|
|---|
| 556 | Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4.
|
|---|
| 557 | ########
|
|---|
| 558 | # toke.c
|
|---|
| 559 | use warnings ;
|
|---|
| 560 | eval <<'EOE';
|
|---|
| 561 | # line 30 "foo"
|
|---|
| 562 | warn "yelp";
|
|---|
| 563 | {
|
|---|
| 564 | $_ = " \x{123} " ;
|
|---|
| 565 | }
|
|---|
| 566 | EOE
|
|---|
| 567 | EXPECT
|
|---|
| 568 | yelp at foo line 30.
|
|---|
| 569 | ########
|
|---|
| 570 | # toke.c
|
|---|
| 571 | my $a = rand + 4 ;
|
|---|
| 572 | EXPECT
|
|---|
| 573 | Warning: Use of "rand" without parentheses is ambiguous at - line 2.
|
|---|
| 574 | ########
|
|---|
| 575 | # toke.c
|
|---|
| 576 | $^W = 0 ;
|
|---|
| 577 | my $a = rand + 4 ;
|
|---|
| 578 | {
|
|---|
| 579 | no warnings 'ambiguous' ;
|
|---|
| 580 | $a = rand + 4 ;
|
|---|
| 581 | use warnings 'ambiguous' ;
|
|---|
| 582 | $a = rand + 4 ;
|
|---|
| 583 | }
|
|---|
| 584 | $a = rand + 4 ;
|
|---|
| 585 | EXPECT
|
|---|
| 586 | Warning: Use of "rand" without parentheses is ambiguous at - line 3.
|
|---|
| 587 | Warning: Use of "rand" without parentheses is ambiguous at - line 8.
|
|---|
| 588 | Warning: Use of "rand" without parentheses is ambiguous at - line 10.
|
|---|
| 589 | ########
|
|---|
| 590 | # toke.c
|
|---|
| 591 | sub fred {};
|
|---|
| 592 | -fred ;
|
|---|
| 593 | EXPECT
|
|---|
| 594 | Ambiguous use of -fred resolved as -&fred() at - line 3.
|
|---|
| 595 | ########
|
|---|
| 596 | # toke.c
|
|---|
| 597 | $^W = 0 ;
|
|---|
| 598 | sub fred {} ;
|
|---|
| 599 | -fred ;
|
|---|
| 600 | {
|
|---|
| 601 | no warnings 'ambiguous' ;
|
|---|
| 602 | -fred ;
|
|---|
| 603 | use warnings 'ambiguous' ;
|
|---|
| 604 | -fred ;
|
|---|
| 605 | }
|
|---|
| 606 | -fred ;
|
|---|
| 607 | EXPECT
|
|---|
| 608 | Ambiguous use of -fred resolved as -&fred() at - line 4.
|
|---|
| 609 | Ambiguous use of -fred resolved as -&fred() at - line 9.
|
|---|
| 610 | Ambiguous use of -fred resolved as -&fred() at - line 11.
|
|---|
| 611 | ########
|
|---|
| 612 | # toke.c
|
|---|
| 613 | open FOO || time;
|
|---|
| 614 | EXPECT
|
|---|
| 615 | Precedence problem: open FOO should be open(FOO) at - line 2.
|
|---|
| 616 | ########
|
|---|
| 617 | # toke.c (and [perl #16184])
|
|---|
| 618 | open FOO => "<&0"; close FOO;
|
|---|
| 619 | EXPECT
|
|---|
| 620 | ########
|
|---|
| 621 | # toke.c
|
|---|
| 622 | $^W = 0 ;
|
|---|
| 623 | open FOO || time;
|
|---|
| 624 | {
|
|---|
| 625 | no warnings 'precedence' ;
|
|---|
| 626 | open FOO || time;
|
|---|
| 627 | use warnings 'precedence' ;
|
|---|
| 628 | open FOO || time;
|
|---|
| 629 | }
|
|---|
| 630 | open FOO || time;
|
|---|
| 631 | EXPECT
|
|---|
| 632 | Precedence problem: open FOO should be open(FOO) at - line 3.
|
|---|
| 633 | Precedence problem: open FOO should be open(FOO) at - line 8.
|
|---|
| 634 | Precedence problem: open FOO should be open(FOO) at - line 10.
|
|---|
| 635 | ########
|
|---|
| 636 | # toke.c
|
|---|
| 637 | $^W = 0 ;
|
|---|
| 638 | *foo *foo ;
|
|---|
| 639 | {
|
|---|
| 640 | no warnings 'ambiguous' ;
|
|---|
| 641 | *foo *foo ;
|
|---|
| 642 | use warnings 'ambiguous' ;
|
|---|
| 643 | *foo *foo ;
|
|---|
| 644 | }
|
|---|
| 645 | *foo *foo ;
|
|---|
| 646 | EXPECT
|
|---|
| 647 | Operator or semicolon missing before *foo at - line 3.
|
|---|
| 648 | Ambiguous use of * resolved as operator * at - line 3.
|
|---|
| 649 | Operator or semicolon missing before *foo at - line 8.
|
|---|
| 650 | Ambiguous use of * resolved as operator * at - line 8.
|
|---|
| 651 | Operator or semicolon missing before *foo at - line 10.
|
|---|
| 652 | Ambiguous use of * resolved as operator * at - line 10.
|
|---|
| 653 | ########
|
|---|
| 654 | # toke.c
|
|---|
| 655 | use warnings 'misc' ;
|
|---|
| 656 | my $a = "\m" ;
|
|---|
| 657 | no warnings 'misc' ;
|
|---|
| 658 | $a = "\m" ;
|
|---|
| 659 | EXPECT
|
|---|
| 660 | Unrecognized escape \m passed through at - line 3.
|
|---|
| 661 | ########
|
|---|
| 662 | # toke.c
|
|---|
| 663 | use warnings 'portable' ;
|
|---|
| 664 | my $a = 0b011111111111111111111111111111110 ;
|
|---|
| 665 | $a = 0b011111111111111111111111111111111 ;
|
|---|
| 666 | $a = 0b111111111111111111111111111111111 ;
|
|---|
| 667 | $a = 0x0fffffffe ;
|
|---|
| 668 | $a = 0x0ffffffff ;
|
|---|
| 669 | $a = 0x1ffffffff ;
|
|---|
| 670 | $a = 0037777777776 ;
|
|---|
| 671 | $a = 0037777777777 ;
|
|---|
| 672 | $a = 0047777777777 ;
|
|---|
| 673 | no warnings 'portable' ;
|
|---|
| 674 | $a = 0b011111111111111111111111111111110 ;
|
|---|
| 675 | $a = 0b011111111111111111111111111111111 ;
|
|---|
| 676 | $a = 0b111111111111111111111111111111111 ;
|
|---|
| 677 | $a = 0x0fffffffe ;
|
|---|
| 678 | $a = 0x0ffffffff ;
|
|---|
| 679 | $a = 0x1ffffffff ;
|
|---|
| 680 | $a = 0037777777776 ;
|
|---|
| 681 | $a = 0037777777777 ;
|
|---|
| 682 | $a = 0047777777777 ;
|
|---|
| 683 | EXPECT
|
|---|
| 684 | Binary number > 0b11111111111111111111111111111111 non-portable at - line 5.
|
|---|
| 685 | Hexadecimal number > 0xffffffff non-portable at - line 8.
|
|---|
| 686 | Octal number > 037777777777 non-portable at - line 11.
|
|---|
| 687 | ########
|
|---|
| 688 | # toke.c
|
|---|
| 689 | use warnings 'overflow' ;
|
|---|
| 690 | my $a = 0b011111111111111111111111111111110 ;
|
|---|
| 691 | $a = 0b011111111111111111111111111111111 ;
|
|---|
| 692 | $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ;
|
|---|
| 693 | $a = 0x0fffffffe ;
|
|---|
| 694 | $a = 0x0ffffffff ;
|
|---|
| 695 | $a = 0x10000000000000000 ;
|
|---|
| 696 | $a = 0037777777776 ;
|
|---|
| 697 | $a = 0037777777777 ;
|
|---|
| 698 | $a = 002000000000000000000000;
|
|---|
| 699 | no warnings 'overflow' ;
|
|---|
| 700 | $a = 0b011111111111111111111111111111110 ;
|
|---|
| 701 | $a = 0b011111111111111111111111111111111 ;
|
|---|
| 702 | $a = 0b10000000000000000000000000000000000000000000000000000000000000000 ;
|
|---|
| 703 | $a = 0x0fffffffe ;
|
|---|
| 704 | $a = 0x0ffffffff ;
|
|---|
| 705 | $a = 0x10000000000000000 ;
|
|---|
| 706 | $a = 0037777777776 ;
|
|---|
| 707 | $a = 0037777777777 ;
|
|---|
| 708 | $a = 002000000000000000000000;
|
|---|
| 709 | EXPECT
|
|---|
| 710 | Integer overflow in binary number at - line 5.
|
|---|
| 711 | Integer overflow in hexadecimal number at - line 8.
|
|---|
| 712 | Integer overflow in octal number at - line 11.
|
|---|
| 713 | ########
|
|---|
| 714 | # toke.c
|
|---|
| 715 | BEGIN { $^C = 1; }
|
|---|
| 716 | use warnings 'misc';
|
|---|
| 717 | dump;
|
|---|
| 718 | CORE::dump;
|
|---|
| 719 | EXPECT
|
|---|
| 720 | dump() better written as CORE::dump() at - line 4.
|
|---|
| 721 | - syntax OK
|
|---|
| 722 | ########
|
|---|
| 723 | # toke.c
|
|---|
| 724 | use warnings 'misc';
|
|---|
| 725 | use subs qw/dump/;
|
|---|
| 726 | sub dump { print "no warning for overriden dump\n"; }
|
|---|
| 727 | dump;
|
|---|
| 728 | EXPECT
|
|---|
| 729 | no warning for overriden dump
|
|---|
| 730 | ########
|
|---|
| 731 | # toke.c
|
|---|
| 732 | use warnings 'ambiguous';
|
|---|
| 733 | "@mjd_previously_unused_array";
|
|---|
| 734 | no warnings 'ambiguous';
|
|---|
| 735 | "@mjd_previously_unused_array";
|
|---|
| 736 | EXPECT
|
|---|
| 737 | Possible unintended interpolation of @mjd_previously_unused_array in string at - line 3.
|
|---|
| 738 | ########
|
|---|
| 739 | # toke.c
|
|---|
| 740 | # The \q should warn, the \_ should NOT warn.
|
|---|
| 741 | use warnings 'misc';
|
|---|
| 742 | "foo" =~ /\q/;
|
|---|
| 743 | "bar" =~ /\_/;
|
|---|
| 744 | no warnings 'misc';
|
|---|
| 745 | "foo" =~ /\q/;
|
|---|
| 746 | "bar" =~ /\_/;
|
|---|
| 747 | EXPECT
|
|---|
| 748 | Unrecognized escape \q passed through at - line 4.
|
|---|
| 749 | ########
|
|---|
| 750 | # toke.c
|
|---|
| 751 | # 20020328 [email protected] at behest of [email protected]
|
|---|
| 752 | use warnings 'regexp';
|
|---|
| 753 | "foo" =~ /foo/c;
|
|---|
| 754 | "foo" =~ /foo/cg;
|
|---|
| 755 | no warnings 'regexp';
|
|---|
| 756 | "foo" =~ /foo/c;
|
|---|
| 757 | "foo" =~ /foo/cg;
|
|---|
| 758 | EXPECT
|
|---|
| 759 | Use of /c modifier is meaningless without /g at - line 4.
|
|---|
| 760 | ########
|
|---|
| 761 | # toke.c
|
|---|
| 762 | # 20020328 [email protected] at behest of [email protected]
|
|---|
| 763 | use warnings 'regexp';
|
|---|
| 764 | $_ = "ab" ;
|
|---|
| 765 | s/ab/ab/c;
|
|---|
| 766 | s/ab/ab/cg;
|
|---|
| 767 | no warnings 'regexp';
|
|---|
| 768 | s/ab/ab/c;
|
|---|
| 769 | s/ab/ab/cg;
|
|---|
| 770 | EXPECT
|
|---|
| 771 | Use of /c modifier is meaningless in s/// at - line 5.
|
|---|
| 772 | Use of /c modifier is meaningless in s/// at - line 6.
|
|---|
| 773 | ########
|
|---|
| 774 | -wa
|
|---|
| 775 | # toke.c
|
|---|
| 776 | # 20020414 [email protected] # -a flag should suppress these warnings
|
|---|
| 777 | print "@F\n";
|
|---|
| 778 | EXPECT
|
|---|
| 779 |
|
|---|
| 780 | ########
|
|---|
| 781 | -w
|
|---|
| 782 | # toke.c
|
|---|
| 783 | # 20020414 [email protected] # -a flag should suppress these warnings
|
|---|
| 784 | print "@F\n";
|
|---|
| 785 | EXPECT
|
|---|
| 786 | Possible unintended interpolation of @F in string at - line 4.
|
|---|
| 787 | Name "main::F" used only once: possible typo at - line 4.
|
|---|
| 788 | ########
|
|---|
| 789 | -wa
|
|---|
| 790 | # toke.c
|
|---|
| 791 | # 20020414 [email protected]
|
|---|
| 792 | EXPECT
|
|---|
| 793 |
|
|---|
| 794 | ########
|
|---|
| 795 | # toke.c
|
|---|
| 796 | # 20020414 [email protected]
|
|---|
| 797 | # In 5.7.3, this emitted "Possible unintended interpolation" warnings
|
|---|
| 798 | use warnings 'ambiguous';
|
|---|
| 799 | $s = "(@-)(@+)";
|
|---|
| 800 | EXPECT
|
|---|
| 801 |
|
|---|
| 802 | ########
|
|---|
| 803 | # toke.c
|
|---|
| 804 | # mandatory warning
|
|---|
| 805 | eval q/if ($a) { } elseif ($b) { }/;
|
|---|
| 806 | no warnings "syntax";
|
|---|
| 807 | eval q/if ($a) { } elseif ($b) { }/;
|
|---|
| 808 | EXPECT
|
|---|
| 809 | elseif should be elsif at (eval 1) line 1.
|
|---|
| 810 | ########
|
|---|
| 811 | # toke.c
|
|---|
| 812 | # mandatory warning
|
|---|
| 813 | eval q/5 6/;
|
|---|
| 814 | no warnings "syntax";
|
|---|
| 815 | eval q/5 6/;
|
|---|
| 816 | EXPECT
|
|---|
| 817 | Number found where operator expected at (eval 1) line 1, near "5 6"
|
|---|
| 818 | (Missing operator before 6?)
|
|---|
| 819 |
|
|---|