- Notifications
You must be signed in to change notification settings - Fork587
Commit73a4618
committed
Undefined subroutine &%s called, close to label '%s'
#17839 requested a compile-timewarning for the situation whereby a single colon is accdentally typedas a package separator when calling a function. For example:```package BOOP;sub beep;package main;BOOP:beep(); # Meant to be BOOP::beep();```However, because of both Perl's syntax and the potential to populate thestash at runtime, this falls somewhere between very difficult andimpossible. As an alternative, some enhanced fatal error wording wasrequested and these commits attempt to provide that.The above example would previously die with the message:```Undefined subroutine &main::beep called at ... line 4.```Now it dies with the message:```Undefined subroutine &main::beep called, close to label 'BOOP' at ... line 4.```For some of the same reasons mentioned, distinguishing this typo fromother errors at runtime - such as the target subroutine not beingpresent at all - is also nigh on impossible. The hope is that theerror message will give some additional clue when the error is theresult of a typo, without distracting the user in all other cases.As part of these commits, some common `DIE()` calls in `pp_entersub` wereextracted into a new helper function, `S_croak_undefined_subroutine`, toavoid adding (and slightly reduce) cold code bloating in `pp_entersub`.1 parentdf4d5e8 commit73a4618
4 files changed
+53
-9
lines changedLines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
260 | 260 |
| |
261 | 261 |
| |
262 | 262 |
| |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
263 | 271 |
| |
264 | 272 |
| |
265 | 273 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6820 | 6820 |
| |
6821 | 6821 |
| |
6822 | 6822 |
| |
| 6823 | + | |
| 6824 | + | |
| 6825 | + | |
| 6826 | + | |
| 6827 | + | |
| 6828 | + | |
6823 | 6829 |
| |
6824 | 6830 |
| |
6825 | 6831 |
| |
|
Lines changed: 31 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6212 | 6212 |
| |
6213 | 6213 |
| |
6214 | 6214 |
| |
| 6215 | + | |
| 6216 | + | |
| 6217 | + | |
| 6218 | + | |
| 6219 | + | |
| 6220 | + | |
| 6221 | + | |
| 6222 | + | |
| 6223 | + | |
| 6224 | + | |
| 6225 | + | |
| 6226 | + | |
| 6227 | + | |
| 6228 | + | |
| 6229 | + | |
| 6230 | + | |
| 6231 | + | |
| 6232 | + | |
| 6233 | + | |
| 6234 | + | |
| 6235 | + | |
| 6236 | + | |
| 6237 | + | |
| 6238 | + | |
| 6239 | + | |
| 6240 | + | |
| 6241 | + | |
6215 | 6242 |
| |
6216 | 6243 |
| |
6217 | 6244 |
| |
| |||
6306 | 6333 |
| |
6307 | 6334 |
| |
6308 | 6335 |
| |
6309 |
| - | |
6310 | 6336 |
| |
6311 | 6337 |
| |
6312 | 6338 |
| |
6313 |
| - | |
6314 |
| - | |
| 6339 | + | |
6315 | 6340 |
| |
6316 |
| - | |
| 6341 | + | |
6317 | 6342 |
| |
6318 | 6343 |
| |
6319 | 6344 |
| |
| |||
6330 | 6355 |
| |
6331 | 6356 |
| |
6332 | 6357 |
| |
6333 |
| - | |
6334 |
| - | |
6335 |
| - | |
6336 |
| - | |
6337 |
| - | |
| 6358 | + | |
| 6359 | + | |
6338 | 6360 |
| |
6339 | 6361 |
| |
6340 | 6362 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
46 | 46 |
| |
47 | 47 |
| |
48 | 48 |
| |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
49 | 57 |
| |
50 | 58 |
| |
51 | 59 |
| |
|
0 commit comments
Comments
(0)