1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-05-21 12:01:54 +02:00

51098: remove unreachable NOERREXIT_UNTIL_EXEC code and effects

This commit is contained in:
Philippe Altherr 2022-12-03 21:35:51 -08:00 committed by Bart Schaefer
parent f253ea6b9d
commit ab9c579ef9
4 changed files with 7 additions and 26 deletions

View file

@ -1,5 +1,8 @@
2022-12-03 Bart Schaefer <schaefer@zsh.org>
* Philippe Altherr: 51098: Src/exec.c, Src/loop.c, Src/zsh.h:
remove unreachable NOERREXIT_UNTIL_EXEC code and effects
* Philippe Altherr: 51076: Src/exec.c, Test/C03traps.ztst: fix
ERR_EXIT when used with "eval" or "source"; documentary comments

View file

@ -1559,14 +1559,7 @@ execlist(Estate state, int dont_change_job, int exiting)
state->pc--;
sublist_done:
/*
* See hairy code near the end of execif() for the
* following. "noerrexit " only applies until
* we hit execcmd on the way down. We're now
* on the way back up, so don't restore it.
*/
if (!(oldnoerrexit & NOERREXIT_UNTIL_EXEC))
noerrexit = oldnoerrexit;
noerrexit = oldnoerrexit;
if (sigtrapped[SIGDEBUG] && !isset(DEBUGBEFORECMD) && !donedebug) {
/*
@ -3246,10 +3239,6 @@ execcmd_exec(Estate state, Execcmd_params eparams,
} else
preargs = NULL;
/* if we get this far, it is OK to pay attention to lastval again */
if (noerrexit & NOERREXIT_UNTIL_EXEC)
noerrexit = 0;
/* Do prefork substitutions.
*
* Decide if we need "magic" handling of ~'s etc. in

View file

@ -569,23 +569,14 @@ execif(Estate state, int do_exec)
s = 1;
state->pc = next;
}
noerrexit = olderrexit;
if (run) {
/* we need to ignore lastval until we reach execcmd() */
if (olderrexit || run == 2)
noerrexit = olderrexit;
else if (lastval)
noerrexit |= NOERREXIT_EXIT | NOERREXIT_RETURN | NOERREXIT_UNTIL_EXEC;
else
noerrexit &= ~ (NOERREXIT_EXIT | NOERREXIT_RETURN);
cmdpush(run == 2 ? CS_ELSE : (s ? CS_ELIFTHEN : CS_IFTHEN));
execlist(state, 1, do_exec);
cmdpop();
} else {
noerrexit = olderrexit;
if (!retflag && !errflag)
lastval = 0;
}
} else if (!retflag && !errflag)
lastval = 0;
state->pc = end;
this_noerrexit = 1;

View file

@ -2220,8 +2220,6 @@ enum noerrexit_bits {
NOERREXIT_EXIT = 1,
/* Suppress ERR_RETURN: per function call */
NOERREXIT_RETURN = 2,
/* NOERREXIT only needed on way down */
NOERREXIT_UNTIL_EXEC = 4,
/* Force exit on SIGINT */
NOERREXIT_SIGNAL = 8
};