ruby-changes:72653
From: Yusuke <ko1@a...>
Date: Fri, 22 Jul 2022 23:10:39 +0900 (JST)
Subject: [ruby-changes:72653] 8f7e188822 (master): Add "rb_" prefixes to toplevel enum definitions
https://git.ruby-lang.org/ruby.git/commit/?id=8f7e188822 From 8f7e18882269ef3747312a390b06f02f7e2c98eb Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Fri, 22 Jul 2022 16:57:25 +0900 Subject: Add "rb_" prefixes to toplevel enum definitions ... as per ko1's request. --- compile.c | 14 +++++++------- iseq.c | 20 ++++++++++---------- iseq.h | 4 ++-- ractor.c | 14 +++++++------- ractor_core.h | 8 ++++---- vm.c | 2 +- vm_core.h | 10 +++++----- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/compile.c b/compile.c index fc3aa8aaab..7aca48d8dc 100644 --- a/compile.c +++ b/compile.c @@ -1320,7 +1320,7 @@ new_insn_send(rb_iseq_t *iseq, const NODE *const line_node, ID id, VALUE argc, c https://github.com/ruby/ruby/blob/trunk/compile.c#L1320 static rb_iseq_t * new_child_iseq(rb_iseq_t *iseq, const NODE *const node, - VALUE name, const rb_iseq_t *parent, enum iseq_type type, int line_no) + VALUE name, const rb_iseq_t *parent, enum rb_iseq_type type, int line_no) { rb_iseq_t *ret_iseq; rb_ast_body_t ast; @@ -1342,7 +1342,7 @@ new_child_iseq(rb_iseq_t *iseq, const NODE *const node, https://github.com/ruby/ruby/blob/trunk/compile.c#L1342 static rb_iseq_t * new_child_iseq_with_callback(rb_iseq_t *iseq, const struct rb_iseq_new_with_callback_callback_func *ifunc, - VALUE name, const rb_iseq_t *parent, enum iseq_type type, int line_no) + VALUE name, const rb_iseq_t *parent, enum rb_iseq_type type, int line_no) { rb_iseq_t *ret_iseq; @@ -1418,7 +1418,7 @@ iseq_insert_nop_between_end_and_cont(rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/compile.c#L1418 LINK_ELEMENT *cont = (LINK_ELEMENT *)(ptr[4] & ~1); LINK_ELEMENT *e; - enum catch_type ct = (enum catch_type)(ptr[0] & 0xffff); + enum rb_catch_type ct = (enum rb_catch_type)(ptr[0] & 0xffff); if (ct != CATCH_TYPE_BREAK && ct != CATCH_TYPE_NEXT @@ -2607,7 +2607,7 @@ iseq_set_exception_table(rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/compile.c#L2607 for (i = 0; i < table->size; i++) { ptr = RARRAY_CONST_PTR_TRANSIENT(tptr[i]); entry = UNALIGNED_MEMBER_PTR(table, entries[i]); - entry->type = (enum catch_type)(ptr[0] & 0xffff); + entry->type = (enum rb_catch_type)(ptr[0] & 0xffff); entry->start = label_get_position((LABEL *)(ptr[1] & ~1)); entry->end = label_get_position((LABEL *)(ptr[2] & ~1)); entry->iseq = (rb_iseq_t *)ptr[3]; @@ -7692,9 +7692,9 @@ compile_return(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, https://github.com/ruby/ruby/blob/trunk/compile.c#L7692 const NODE *line_node = node; if (iseq) { - enum iseq_type type = ISEQ_BODY(iseq)->type; + enum rb_iseq_type type = ISEQ_BODY(iseq)->type; const rb_iseq_t *is = iseq; - enum iseq_type t = type; + enum rb_iseq_type t = type; const NODE *retval = node->nd_stts; LABEL *splabel = 0; @@ -11575,7 +11575,7 @@ ibf_load_catch_table(const struct ibf_load *load, ibf_offset_t catch_table_offse https://github.com/ruby/ruby/blob/trunk/compile.c#L11575 unsigned int i; for (i=0; i<table->size; i++) { int iseq_index = (int)ibf_load_small_value(load, &reading_pos); - table->entries[i].type = (enum catch_type)ibf_load_small_value(load, &reading_pos); + table->entries[i].type = (enum rb_catch_type)ibf_load_small_value(load, &reading_pos); table->entries[i].start = (unsigned int)ibf_load_small_value(load, &reading_pos); table->entries[i].end = (unsigned int)ibf_load_small_value(load, &reading_pos); table->entries[i].cont = (unsigned int)ibf_load_small_value(load, &reading_pos); diff --git a/iseq.c b/iseq.c index f49312156b..34c438e2a2 100644 --- a/iseq.c +++ b/iseq.c @@ -723,7 +723,7 @@ new_arena(void) https://github.com/ruby/ruby/blob/trunk/iseq.c#L723 static VALUE prepare_iseq_build(rb_iseq_t *iseq, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_code_location_t *code_location, const int node_id, - const rb_iseq_t *parent, int isolated_depth, enum iseq_type type, + const rb_iseq_t *parent, int isolated_depth, enum rb_iseq_type type, VALUE script_lines, const rb_compile_option_t *option) { VALUE coverage = Qfalse; @@ -947,7 +947,7 @@ make_compile_option_value(rb_compile_option_t *option) https://github.com/ruby/ruby/blob/trunk/iseq.c#L947 rb_iseq_t * rb_iseq_new(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, - const rb_iseq_t *parent, enum iseq_type type) + const rb_iseq_t *parent, enum rb_iseq_type type) { return rb_iseq_new_with_opt(ast, name, path, realpath, INT2FIX(0), parent, 0, type, &COMPILE_OPTION_DEFAULT); @@ -1015,7 +1015,7 @@ iseq_translate(rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/iseq.c#L1015 rb_iseq_t * rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth, - enum iseq_type type, const rb_compile_option_t *option) + enum rb_iseq_type type, const rb_compile_option_t *option) { const NODE *node = ast ? ast->root : 0; /* TODO: argument check */ @@ -1053,7 +1053,7 @@ rb_iseq_new_with_callback( https://github.com/ruby/ruby/blob/trunk/iseq.c#L1053 const struct rb_iseq_new_with_callback_callback_func * ifunc, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, - enum iseq_type type, const rb_compile_option_t *option) + enum rb_iseq_type type, const rb_compile_option_t *option) { /* TODO: argument check */ rb_iseq_t *iseq = iseq_alloc(); @@ -1085,7 +1085,7 @@ rb_iseq_load_iseq(VALUE fname) https://github.com/ruby/ruby/blob/trunk/iseq.c#L1085 #define CHECK_SYMBOL(v) rb_to_symbol_type(v) static inline VALUE CHECK_INTEGER(VALUE v) {(void)NUM2LONG(v); return v;} -static enum iseq_type +static enum rb_iseq_type iseq_type_from_sym(VALUE type) { const ID id_top = rb_intern("top"); @@ -1109,7 +1109,7 @@ iseq_type_from_sym(VALUE type) https://github.com/ruby/ruby/blob/trunk/iseq.c#L1109 if (typeid == id_eval) return ISEQ_TYPE_EVAL; if (typeid == id_main) return ISEQ_TYPE_MAIN; if (typeid == id_plain) return ISEQ_TYPE_PLAIN; - return (enum iseq_type)-1; + return (enum rb_iseq_type)-1; } static VALUE @@ -1155,7 +1155,7 @@ iseq_load(VALUE data, const rb_iseq_t *parent, VALUE opt) https://github.com/ruby/ruby/blob/trunk/iseq.c#L1155 ISEQ_BODY(iseq)->local_iseq = iseq; iseq_type = iseq_type_from_sym(type); - if (iseq_type == (enum iseq_type)-1) { + if (iseq_type == (enum rb_iseq_type)-1) { rb_raise(rb_eTypeError, "unsupported type: :%"PRIsVALUE, rb_sym2str(type)); } @@ -1172,7 +1172,7 @@ iseq_load(VALUE data, const rb_iseq_t *parent, VALUE opt) https://github.com/ruby/ruby/blob/trunk/iseq.c#L1172 make_compile_option(&option, opt); option.peephole_optimization = FALSE; /* because peephole optimization can modify original iseq */ prepare_iseq_build(iseq, name, path, realpath, first_lineno, &tmp_loc, NUM2INT(node_id), - parent, 0, (enum iseq_type)iseq_type, Qnil, &option); + parent, 0, (enum rb_iseq_type)iseq_type, Qnil, &option); rb_iseq_build_from_ary(iseq, misc, locals, params, exception, body); @@ -1311,7 +1311,7 @@ rb_iseq_code_location(const rb_iseq_t *iseq, int *beg_pos_lineno, int *beg_pos_c https://github.com/ruby/ruby/blob/trunk/iseq.c#L1311 if (end_pos_column) *end_pos_column = loc->end_pos.column; } -static ID iseq_type_id(enum iseq_type type); +static ID iseq_type_id(enum rb_iseq_type type); VALUE rb_iseq_type(const rb_iseq_t *iseq) @@ -2839,7 +2839,7 @@ static const rb_data_type_t label_wrapper = { https://github.com/ruby/ruby/blob/trunk/iseq.c#L2839 id_##name = rb_intern(#name) static VALUE -iseq_type_id(enum iseq_type type) +iseq_type_id(enum rb_iseq_type type) { DECL_ID(top); DECL_ID(method); diff --git a/iseq.h b/iseq.h index 062ed33d86..e7db9b951f 100644 --- a/iseq.h +++ b/iseq.h @@ -253,7 +253,7 @@ struct iseq_insn_info_entry { https://github.com/ruby/ruby/blob/trunk/iseq.h#L253 * CATCH_TYPE_REDO, CATCH_TYPE_NEXT: * NULL. */ -enum catch_type { +enum rb_catch_type { CATCH_TYPE_RESCUE = INT2FIX(1), CATCH_TYPE_ENSURE = INT2FIX(2), CATCH_TYPE_RETRY = INT2FIX(3), @@ -263,7 +263,7 @@ enum catch_type { https://github.com/ruby/ruby/blob/trunk/iseq.h#L263 }; struct iseq_catch_table_entry { - enum catch_type type; + enum rb_catch_type type; rb_iseq_t *iseq; unsigned int start; diff --git a/ractor.c b/ractor.c index c5df3cc6b0..0306736c18 100644 --- a/ractor.c +++ b/ractor.c @@ -493,13 +493,13 @@ ractor_try_receive(rb_execution_context_t *ec, rb_ractor_t *r) https://github.com/ruby/ruby/blob/trunk/ractor.c#L493 } static bool -ractor_sleeping_by(const rb_ractor_t *r, enum ractor_wait_status wait_status) +ractor_sleeping_by(const rb_ractor_t *r, enum rb_ractor_wait_status wait_status) { return (r->sync.wait.status & wait_status) && r->sync.wait.wakeup_status == wakeup_none; } static bool -ractor_wakeup(rb_ractor_t *r, enum ractor_wait_status wait_status, enum ractor_wakeup_status wakeup_status) +ractor_wakeup(rb_ractor_t *r, enum rb_ractor_wait_status wait_status, enum rb_ractor_wakeup_status wakeup_status) { ASSERT_ractor_locking(r); @@ -547,7 +547,7 @@ ractor_sleep_interrupt(void *ptr) https://github.com/ruby/ruby/blob/trunk/ractor.c#L547 #if USE_RUBY_DEBUG_LOG static const char * -wait_status_st (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/