summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-06-19 06:43:08 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-06-19 10:26:25 -0400
commit148f39b7de6eae9ddd59e0b0aff691d6abea7aca (patch)
tree4234b72396b4e97e8fa5001078366a908af83e6a /regexec.c
parent8ce6f80a4321cf8eaae14a6a8401f8e597c25f25 (diff)
downloadperl-148f39b7de6eae9ddd59e0b0aff691d6abea7aca.tar.gz
/* NOTREACHED */ belongs *before* the unreachable.
Definitely not *after* it. It marks the start of the unreachable, not the first unrechable line. And if they are in that order, it looks better to linebreak after the lint hint.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c129
1 files changed, 86 insertions, 43 deletions
diff --git a/regexec.c b/regexec.c
index 1aafcc70b2..39a8a0619d 100644
--- a/regexec.c
+++ b/regexec.c
@@ -487,7 +487,8 @@ S_isFOO_lc(pTHX_ const U8 classnum, const U8 character)
Perl_croak(aTHX_ "panic: isFOO_lc() has an unexpected character class '%d'", classnum);
}
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
return FALSE;
}
@@ -542,7 +543,8 @@ S_isFOO_utf8_lc(pTHX_ const U8 classnum, const U8* character)
below 256 */
}
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
return FALSE;
}
@@ -2011,7 +2013,8 @@ S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s,
default:
Perl_croak(aTHX_ "panic: find_byclass() node %d='%s' has an unexpected character class '%d'", OP(c), PL_reg_name[OP(c)], classnum);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
}
break;
@@ -3811,7 +3814,8 @@ S_setup_EXACTISH_ST_c1_c2(pTHX_ const regnode * const text_node, int *c1p,
default:
Perl_croak(aTHX_ "panic: Unexpected op %u", OP(text_node));
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
}
}
@@ -4060,7 +4064,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
REPORT_CODE_OFF+depth*2, "", PL_colors[4], PL_colors[5])
);
sayNO_SILENT;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
/* FALLTHROUGH */
case TRIE: /* (ab|cd) */
@@ -4247,7 +4252,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
);
goto trie_first_try; /* jump into the fail handler */
}}
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case TRIE_next_fail: /* we failed - try next alternative */
{
@@ -4361,7 +4367,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
if (ST.accepted > 1 || has_cutgroup) {
PUSH_STATE_GOTO(TRIE_next, scan, (char*)uc);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
/* only one choice left - just continue */
DEBUG_EXECUTE_r({
@@ -4385,7 +4392,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
locinput = (char*)uc;
continue; /* execute rest of RE */
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
#undef ST
@@ -5194,7 +5202,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
/* and then jump to the code we share with EVAL */
goto eval_recurse_doit;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case EVAL: /* /(?{A})B/ /(??{A})B/ and /(?(?{A})X|Y)B/ */
if (cur_eval && cur_eval->locinput==locinput) {
@@ -5475,7 +5484,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
cur_eval = st;
/* now continue from first node in postoned RE */
PUSH_YES_STATE_GOTO(EVAL_AB, startpoint, locinput);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
case EVAL_AB: /* cleanup after a successful (??{A})B */
@@ -5734,19 +5744,22 @@ NULL
ST.lastloc = NULL; /* this will be updated by WHILEM */
PUSH_YES_STATE_GOTO(CURLYX_end, PREVOPER(next), locinput);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
case CURLYX_end: /* just finished matching all of A*B */
cur_curlyx = ST.prev_curlyx;
sayYES;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case CURLYX_end_fail: /* just failed to match all of A*B */
regcpblow(ST.cp);
cur_curlyx = ST.prev_curlyx;
sayNO;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
#undef ST
@@ -5781,7 +5794,8 @@ NULL
REGCP_SET(ST.lastcp);
PUSH_STATE_GOTO(WHILEM_A_pre, A, locinput);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
/* If degenerate A matches "", assume A done. */
@@ -5893,7 +5907,8 @@ NULL
REGCP_SET(ST.lastcp);
PUSH_YES_STATE_GOTO(WHILEM_B_min, ST.save_curlyx->u.curlyx.B,
locinput);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
/* Prefer A over B for maximal matching. */
@@ -5904,24 +5919,28 @@ NULL
cur_curlyx->u.curlyx.lastloc = locinput;
REGCP_SET(ST.lastcp);
PUSH_STATE_GOTO(WHILEM_A_max, A, locinput);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
goto do_whilem_B_max;
}
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case WHILEM_B_min: /* just matched B in a minimal match */
case WHILEM_B_max: /* just matched B in a maximal match */
cur_curlyx = ST.save_curlyx;
sayYES;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case WHILEM_B_max_fail: /* just failed to match B in a maximal match */
cur_curlyx = ST.save_curlyx;
cur_curlyx->u.curlyx.lastloc = ST.save_lastloc;
cur_curlyx->u.curlyx.count--;
CACHEsayNO;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case WHILEM_A_min_fail: /* just failed to match A in a minimal match */
/* FALLTHROUGH */
@@ -5931,7 +5950,8 @@ NULL
cur_curlyx->u.curlyx.lastloc = ST.save_lastloc;
cur_curlyx->u.curlyx.count--;
CACHEsayNO;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case WHILEM_A_max_fail: /* just failed to match A in a maximal match */
REGCP_UNWIND(ST.lastcp);
@@ -5957,7 +5977,8 @@ NULL
cur_curlyx = cur_curlyx->u.curlyx.prev_curlyx;
PUSH_YES_STATE_GOTO(WHILEM_B_max, ST.save_curlyx->u.curlyx.B,
locinput);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case WHILEM_B_min_fail: /* just failed to match B in a minimal match */
cur_curlyx = ST.save_curlyx;
@@ -5991,7 +6012,8 @@ NULL
PUSH_STATE_GOTO(WHILEM_A_min,
/*A*/ NEXTOPER(ST.save_curlyx->u.curlyx.me) + EXTRA_STEP_2ARGS,
locinput);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
#undef ST
#define ST st->u.branch
@@ -6016,13 +6038,15 @@ NULL
} else {
PUSH_STATE_GOTO(BRANCH_next, scan, locinput);
}
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case CUTGROUP: /* /(*THEN)/ */
sv_yes_mark = st->u.mark.mark_name = scan->flags ? NULL :
MUTABLE_SV(rexi->data->data[ ARG( scan ) ]);
PUSH_STATE_GOTO(CUTGROUP_next, next, locinput);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case CUTGROUP_next_fail:
do_cutgroup = 1;
@@ -6030,11 +6054,13 @@ NULL
if (st->u.mark.mark_name)
sv_commit = st->u.mark.mark_name;
sayNO;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case BRANCH_next:
sayYES;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case BRANCH_next_fail: /* that branch failed; try the next, if any */
if (do_cutgroup) {
@@ -6056,7 +6082,8 @@ NULL
sayNO_SILENT;
}
continue; /* execute next BRANCH[J] op */
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case MINMOD: /* next op will be non-greedy, e.g. A*? */
minmod = 1;
@@ -6100,7 +6127,8 @@ NULL
curlym_do_A: /* execute the A in /A{m,n}B/ */
PUSH_YES_STATE_GOTO(CURLYM_A, ST.A, locinput); /* match A */
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case CURLYM_A: /* we've just matched an A */
ST.count++;
@@ -6235,7 +6263,8 @@ NULL
}
PUSH_STATE_GOTO(CURLYM_B, ST.B, locinput); /* match B */
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case CURLYM_B_fail: /* just failed to match a B */
REGCP_UNWIND(ST.cp);
@@ -6413,7 +6442,8 @@ NULL
REGCP_SET(ST.cp);
goto curly_try_B_max;
}
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case CURLY_B_min_known_fail:
@@ -6489,7 +6519,8 @@ NULL
}
PUSH_STATE_GOTO(CURLY_B_min_known, ST.B, locinput);
}
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case CURLY_B_min_fail:
@@ -6522,7 +6553,8 @@ NULL
}
}
sayNO;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
curly_try_B_max:
@@ -6553,7 +6585,8 @@ NULL
if (ST.c1 == CHRTEST_VOID || could_match) {
CURLY_SETPAREN(ST.paren, ST.count);
PUSH_STATE_GOTO(CURLY_B_max, ST.B, locinput);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
}
/* FALLTHROUGH */
@@ -6672,7 +6705,8 @@ NULL
/* execute body of (?...A) */
PUSH_YES_STATE_GOTO(IFMATCH_A, NEXTOPER(NEXTOPER(scan)), newstart);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
case IFMATCH_A_fail: /* body of (?...A) failed */
@@ -6712,7 +6746,8 @@ NULL
if (!scan->flags)
sv_yes_mark = sv_commit = MUTABLE_SV(rexi->data->data[ ARG( scan ) ]);
PUSH_STATE_GOTO(COMMIT_next, next, locinput);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case COMMIT_next_fail:
no_final = 1;
@@ -6720,7 +6755,8 @@ NULL
case OPFAIL: /* (*FAIL) */
sayNO;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
#define ST st->u.mark
case MARKPOINT: /* (*MARK:foo) */
@@ -6730,12 +6766,14 @@ NULL
mark_state = st;
ST.mark_loc = locinput;
PUSH_YES_STATE_GOTO(MARKPOINT_next, next, locinput);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case MARKPOINT_next:
mark_state = ST.prev_mark;
sayYES;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case MARKPOINT_next_fail:
if (popmark && sv_eq(ST.mark_name,popmark))
@@ -6756,7 +6794,8 @@ NULL
sv_yes_mark = mark_state ?
mark_state->u.mark.mark_name : NULL;
sayNO;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
case SKIP: /* (*SKIP) */
if (scan->flags) {
@@ -6801,7 +6840,8 @@ NULL
}
no_final = 1;
sayNO;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
#undef ST
case LNBREAK: /* \R */
@@ -6835,7 +6875,8 @@ NULL
/* switch break jumps here */
scan = next; /* prepare to execute the next op and ... */
continue; /* ... jump back to the top, reusing st */
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
push_yes_state:
/* push a state that backtracks on success */
@@ -6878,7 +6919,8 @@ NULL
locinput = pushinput;
st = newst;
continue;
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}
}
@@ -7515,7 +7557,8 @@ S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p,
default:
Perl_croak(aTHX_ "panic: regrepeat() called with unrecognized node type %d='%s'", OP(p), PL_reg_name[OP(p)]);
- assert(0); /* NOTREACHED */
+ /* NOTREACHED */
+ assert(0);
}