| 1 |
|
| /* vi: set ft=c : */ |
| 2 |
|
| |
| 3 |
|
| static void S_croaksv_from_caller(pTHX_ SV *msg_sv) |
| 4 |
|
| __attribute__noreturn__; |
| 5 |
|
| |
| 6 |
0 |
| static void S_croaksv_from_caller(pTHX_ SV *msg_sv) |
| 7 |
|
| { |
| 8 |
0 |
| I32 count = 0; |
| 9 |
|
| const PERL_CONTEXT *cx; |
| 10 |
0 |
▶ | while((cx = caller_cx(count, NULL))) { |
Branch: 1 branch
| Branch | True | False | Total |
| while((cx = caller_cx(count, NULL))) { |
0 |
0 |
0 |
|
| 11 |
0 |
| count++; |
| 12 |
|
| |
| 13 |
|
| /* TODO: Skip internal call frames? */ |
| 14 |
|
| /* warn("TODO: maybe croak from caller where caller stash is %s\n", |
| 15 |
|
| * HvNAME(CopSTASH(cx->blk_oldcop))); |
| 16 |
|
| */ |
| 17 |
0 |
| PL_curcop = cx->blk_oldcop; |
| 18 |
0 |
| break; |
| 19 |
|
| } |
| 20 |
|
| |
| 21 |
0 |
| croak_sv(msg_sv); |
| 22 |
|
| } |
| 23 |
|
| |
| 24 |
|
| #define croak_from_caller(fmt, ...) S_croak_from_caller(aTHX_ fmt, __VA_ARGS__) |
| 25 |
|
| static void S_croak_from_caller(pTHX_ const char *fmt, ...) |
| 26 |
|
| __attribute__noreturn__; |
| 27 |
|
| |
| 28 |
0 |
| static void S_croak_from_caller(pTHX_ const char *fmt, ...) |
| 29 |
|
| { |
| 30 |
|
| va_list args; |
| 31 |
0 |
| va_start(args, fmt); |
| 32 |
0 |
| SV *msg_sv = sv_2mortal(vnewSVpvf(fmt, &args)); |
| 33 |
0 |
| va_end(args); |
| 34 |
|
| |
| 35 |
0 |
| S_croaksv_from_caller(aTHX_ msg_sv); |
| 36 |
|
| } |