ruby-changes:46957
From: nobu <ko1@a...>
Date: Tue, 13 Jun 2017 10:05:02 +0900 (JST)
Subject: [ruby-changes:46957] nobu:r59071 (trunk): compile.c: refine error messages
nobu 2017-06-13 10:04:56 +0900 (Tue, 13 Jun 2017) New Revision: 59071 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59071 Log: compile.c: refine error messages Modified files: trunk/compile.c Index: compile.c =================================================================== --- compile.c (revision 59070) +++ compile.c (revision 59071) @@ -1562,6 +1562,12 @@ get_ivar_ic_value(rb_iseq_t *iseq,ID id) https://github.com/ruby/ruby/blob/trunk/compile.c#L1562 return val; } +#define BADINSN_ERROR \ + (xfree(generated_iseq), \ + xfree(line_info_table), \ + dump_disasm_list_with_cursor(&anchor->anchor, list), \ + COMPILE_ERROR) + /** ruby insn object list -> raw instruction sequence */ @@ -1610,9 +1616,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L1616 break; } default: - dump_disasm_list(FIRST_ELEMENT(anchor)); - dump_disasm_list(list); - COMPILE_ERROR(iseq, line, "error: set_sequence"); + BADINSN_ERROR(iseq, line, "unknown list type: %d", list->type); return COMPILE_NG; } list = list->next; @@ -1631,12 +1635,6 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L1635 list = FIRST_ELEMENT(anchor); line_info_index = code_index = sp = 0; -#define BADINSN_ERROR \ - (dump_disasm_list_with_cursor(&anchor->anchor, list), \ - xfree(generated_iseq), \ - xfree(line_info_table), \ - COMPILE_ERROR) - while (list) { switch (list->type) { case ISEQ_ELEMENT_INSN: @@ -1683,7 +1681,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L1681 LABEL *lobj = (LABEL *)operands[j]; if (!lobj->set) { BADINSN_ERROR(iseq, iobj->line_no, - "unknown label"); + "unknown label: "LABEL_FORMAT, lobj->label_no); return COMPILE_NG; } if (lobj->sp == -1) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/