From: Gerard Goossen Date: Thu, 29 Oct 2009 11:27:49 +0000 (+0100) Subject: move JMPENV_JUMP to die_where and mark it as "noreturn" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bb4c52e023e0fcade469e46e9a1d5245ff44f3f2;p=p5sagit%2Fp5-mst-13.2.git move JMPENV_JUMP to die_where and mark it as "noreturn" --- diff --git a/embed.fnc b/embed.fnc index 204389e..493f9c9 100644 --- a/embed.fnc +++ b/embed.fnc @@ -218,7 +218,7 @@ Afp |OP* |die |NULLOK const char* pat|... s |OP* |vdie |NULLOK const char* pat|NULLOK va_list* args #endif : Used in util.c -p |OP* |die_where |NULLOK SV* msv +pr |void |die_where |NULLOK SV* msv Ap |void |dounwind |I32 cxix : FIXME pmb |bool |do_aexec |NULLOK SV* really|NN SV** mark|NN SV** sp diff --git a/mathoms.c b/mathoms.c index 108b762..626bbb3 100644 --- a/mathoms.c +++ b/mathoms.c @@ -684,11 +684,13 @@ Perl_init_i18nl14n(pTHX_ int printwarn) PP(pp_padany) { DIE(aTHX_ "NOT IMPL LINE %d",__LINE__); + return NORMAL; } PP(pp_mapstart) { DIE(aTHX_ "panic: mapstart"); /* uses grepstart */ + return NORMAL; } /* These ops all have the same body as pp_null. */ diff --git a/pp.c b/pp.c index f58c0c5..bb0e57d 100644 --- a/pp.c +++ b/pp.c @@ -5333,6 +5333,7 @@ PP(unimplemented_op) dVAR; DIE(aTHX_ "panic: unimplemented op %s (#%d) called", OP_NAME(PL_op), PL_op->op_type); + return NORMAL; } PP(pp_boolkeys) diff --git a/pp.h b/pp.h index f3da1a7..9d078af 100644 --- a/pp.h +++ b/pp.h @@ -86,7 +86,7 @@ Refetch the stack pointer. Used after a callback. See L. #define dTARG SV *targ #define NORMAL PL_op->op_next -#define DIE return Perl_die +#define DIE Perl_die /* =for apidoc Ams||PUTBACK diff --git a/pp_ctl.c b/pp_ctl.c index ce60ea0..06a0f73 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1543,7 +1543,7 @@ Perl_qerror(pTHX_ SV *err) ++PL_parser->error_count; } -OP * +void Perl_die_where(pTHX_ SV *msv) { dVAR; @@ -1632,14 +1632,15 @@ Perl_die_where(pTHX_ SV *msv) *msg ? msg : "Unknown error\n"); } assert(CxTYPE(cx) == CXt_EVAL); - return cx->blk_eval.retop; + PL_restartop = cx->blk_eval.retop; + JMPENV_JUMP(3); + /* NOTREACHED */ } } write_to_stderr( msv ? msv : ERRSV ); my_failure_exit(); /* NOTREACHED */ - return 0; } PP(pp_xor) diff --git a/pp_sys.c b/pp_sys.c index 015fcdf..8a82573 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -497,6 +497,7 @@ PP(pp_die) tmpsv = newSVpvs_flags("Died", SVs_TEMP); DIE(aTHX_ "%"SVf, SVfARG(tmpsv)); + RETURN; } /* I/O. */ diff --git a/proto.h b/proto.h index 92737e0..353f9c3 100644 --- a/proto.h +++ b/proto.h @@ -522,7 +522,9 @@ PERL_CALLCONV OP* Perl_die(pTHX_ const char* pat, ...) #if defined(PERL_IN_UTIL_C) || defined(PERL_DECL_PROT) STATIC OP* S_vdie(pTHX_ const char* pat, va_list* args); #endif -PERL_CALLCONV OP* Perl_die_where(pTHX_ SV* msv); +PERL_CALLCONV void Perl_die_where(pTHX_ SV* msv) + __attribute__noreturn__; + PERL_CALLCONV void Perl_dounwind(pTHX_ I32 cxix); /* PERL_CALLCONV bool Perl_do_aexec(pTHX_ SV* really, SV** mark, SV** sp) __attribute__nonnull__(pTHX_2) diff --git a/util.c b/util.c index f270212..5e5758d 100644 --- a/util.c +++ b/util.c @@ -1364,8 +1364,7 @@ S_vdie(pTHX_ const char* pat, va_list *args) message = vdie_croak_common(pat, args); - PL_restartop = die_where(message); - JMPENV_JUMP(3); + die_where(message); /* NOTREACHED */ return NULL; } @@ -1403,13 +1402,7 @@ Perl_vcroak(pTHX_ const char* pat, va_list *args) msv = S_vdie_croak_common(aTHX_ pat, args); - if (PL_in_eval) { - PL_restartop = die_where(msv); - JMPENV_JUMP(3); - } - - write_to_stderr( msv ? msv : ERRSV ); - my_failure_exit(); + die_where(msv); } #if defined(PERL_IMPLICIT_CONTEXT) @@ -1564,12 +1557,7 @@ Perl_vwarner(pTHX_ U32 err, const char* pat, va_list* args) assert(msv); S_vdie_common(aTHX_ msv, FALSE); } - if (PL_in_eval) { - PL_restartop = die_where(msv); - JMPENV_JUMP(3); - } - write_to_stderr(msv); - my_failure_exit(); + die_where(msv); } else { Perl_vwarn(aTHX_ pat, args);