Skip to content

Commit

Permalink
Reärrange code to avoid a goto past a variable initialisation, which …
Browse files Browse the repository at this point in the history
…upsets the g++ compiler
  • Loading branch information
leonerd committed Nov 22, 2024
1 parent 56de829 commit 7e7e80e
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions pp_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,18 @@ PP(pp_anywhile)
if(UNLIKELY(PL_stack_base + *PL_markstack_ptr > PL_stack_sp)) {
/* Ran out of items */
result = (op_type == OP_ANYSTART) ? false : true;
goto leave_with_result;

leave_with_result:
LEAVE_with_name("grep");
(void)POPMARK; /* pop src */
--*PL_markstack_ptr;
(void)POPMARK; /* pop dst */
SV **base = PL_stack_base + POPMARK; /* pop original mark */

rpp_popfree_to_NN(base);
rpp_push_IMM(result ? &PL_sv_yes : &PL_sv_no);

return NORMAL;
}

ENTER_with_name("grep_item");
Expand All @@ -1370,18 +1381,6 @@ PP(pp_anywhile)
DEFSV_set(src);

return cLOGOP->op_other;

leave_with_result:
LEAVE_with_name("grep");
(void)POPMARK; /* pop src */
--*PL_markstack_ptr;
(void)POPMARK; /* pop dst */
SV **base = PL_stack_base + POPMARK; /* pop original mark */

rpp_popfree_to_NN(base);
rpp_push_IMM(result ? &PL_sv_yes : &PL_sv_no);

return NORMAL;
}

/* Range stuff. */
Expand Down

0 comments on commit 7e7e80e

Please sign in to comment.