Skip to content

Commit

Permalink
[PRISM] Remove false positive compile warnings for branch coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Apr 29, 2024
1 parent 90db9c8 commit d75bbba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions prism_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -5008,7 +5008,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
if (cast->predicate == NULL) {
// Establish branch coverage for the case node.
VALUE branches = Qfalse;
rb_code_location_t case_location;
rb_code_location_t case_location = { 0 };
int branch_id = 0;

if (PM_BRANCH_COVERAGE_P(iseq)) {
Expand Down Expand Up @@ -5229,7 +5229,9 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
PUSH_INSN(ret, location, pop);

// Establish branch coverage for the implicit else clause.
add_trace_branch_coverage(iseq, ret, &case_location, case_location.beg_pos.column, branch_id, "else", branches);
if (PM_BRANCH_COVERAGE_P(iseq)) {
add_trace_branch_coverage(iseq, ret, &case_location, case_location.beg_pos.column, branch_id, "else", branches);
}

if (!popped) PUSH_INSN(ret, location, putnil);
PUSH_INSNL(ret, location, jump, end_label);
Expand Down

0 comments on commit d75bbba

Please sign in to comment.