1
0
Fork 0
forked from fte/fteqw

-Ocj must take OP_GOTO into account

this removes the unreachable-code warning when using 'break' at the end of an
if block within a loop


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3366 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Blub 2009-09-02 13:22:32 +00:00
parent e31fa29044
commit e197253558

View file

@ -5877,7 +5877,8 @@ void QCC_PR_ParseStatement (void)
if (QCC_PR_CheckKeyword (keyword_else, "else")) if (QCC_PR_CheckKeyword (keyword_else, "else"))
{ {
int lastwasreturn; int lastwasreturn;
lastwasreturn = statements[numstatements-1].op == OP_RETURN || statements[numstatements-1].op == OP_DONE; lastwasreturn = statements[numstatements-1].op == OP_RETURN || statements[numstatements-1].op == OP_DONE ||
statements[numstatements-1].op == OP_GOTO;
//the last statement of the if was a return, so we don't need the goto at the end //the last statement of the if was a return, so we don't need the goto at the end
if (lastwasreturn && opt_compound_jumps && !QCC_AStatementJumpsTo(numstatements, patch1-statements, numstatements)) if (lastwasreturn && opt_compound_jumps && !QCC_AStatementJumpsTo(numstatements, patch1-statements, numstatements))