Skip to content

Commit

Permalink
Prefer enum ruby_tag_type over int
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Mar 17, 2024
1 parent a91800c commit 28a2105
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions eval.c
Expand Up @@ -463,7 +463,7 @@ rb_class_modify_check(VALUE klass)
}
}

NORETURN(static void rb_longjmp(rb_execution_context_t *, int, volatile VALUE, VALUE));
NORETURN(static void rb_longjmp(rb_execution_context_t *, enum ruby_tag_type, volatile VALUE, VALUE));
static VALUE get_errinfo(void);
#define get_ec_errinfo(ec) rb_ec_get_errinfo(ec)

Expand Down Expand Up @@ -541,7 +541,7 @@ exc_setup_message(const rb_execution_context_t *ec, VALUE mesg, VALUE *cause)
}

static void
setup_exception(rb_execution_context_t *ec, int tag, volatile VALUE mesg, VALUE cause)
setup_exception(rb_execution_context_t *ec, enum ruby_tag_type tag, volatile VALUE mesg, VALUE cause)
{
VALUE e;
int line;
Expand Down Expand Up @@ -645,7 +645,7 @@ rb_ec_setup_exception(const rb_execution_context_t *ec, VALUE mesg, VALUE cause)
}

static void
rb_longjmp(rb_execution_context_t *ec, int tag, volatile VALUE mesg, VALUE cause)
rb_longjmp(rb_execution_context_t *ec, enum ruby_tag_type tag, volatile VALUE mesg, VALUE cause)
{
mesg = exc_setup_message(ec, mesg, &cause);
setup_exception(ec, tag, mesg, cause);
Expand All @@ -655,10 +655,10 @@ rb_longjmp(rb_execution_context_t *ec, int tag, volatile VALUE mesg, VALUE cause

static VALUE make_exception(int argc, const VALUE *argv, int isstr);

NORETURN(static void rb_exc_exception(VALUE mesg, int tag, VALUE cause));
NORETURN(static void rb_exc_exception(VALUE mesg, enum ruby_tag_type tag, VALUE cause));

static void
rb_exc_exception(VALUE mesg, int tag, VALUE cause)
rb_exc_exception(VALUE mesg, enum ruby_tag_type tag, VALUE cause)
{
if (!NIL_P(mesg)) {
mesg = make_exception(1, &mesg, FALSE);
Expand Down Expand Up @@ -985,7 +985,7 @@ rb_protect(VALUE (* proc) (VALUE), VALUE data, int *pstate)
VALUE
rb_ensure(VALUE (*b_proc)(VALUE), VALUE data1, VALUE (*e_proc)(VALUE), VALUE data2)
{
int state;
enum ruby_tag_type state;
volatile VALUE result = Qnil;
VALUE errinfo;
rb_execution_context_t * volatile ec = GET_EC();
Expand Down
4 changes: 2 additions & 2 deletions eval_intern.h
Expand Up @@ -290,9 +290,9 @@ NORETURN(void rb_print_undef(VALUE, ID, rb_method_visibility_t));
NORETURN(void rb_print_undef_str(VALUE, VALUE));
NORETURN(void rb_print_inaccessible(VALUE, ID, rb_method_visibility_t));
NORETURN(void rb_vm_localjump_error(const char *,VALUE, int));
NORETURN(void rb_vm_jump_tag_but_local_jump(int));
NORETURN(void rb_vm_jump_tag_but_local_jump(enum ruby_tag_type));

VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
VALUE rb_vm_make_jump_tag_but_local_jump(enum ruby_tag_type state, VALUE val);
rb_cref_t *rb_vm_cref(void);
rb_cref_t *rb_vm_cref_replace_with_duplicated_cref(void);
VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, VALUE block_handler, VALUE filename);
Expand Down
4 changes: 2 additions & 2 deletions ractor.c
Expand Up @@ -590,7 +590,7 @@ ractor_check_ints(rb_execution_context_t *ec, rb_ractor_t *cr, ractor_sleep_clea
RACTOR_UNLOCK(cr);
{
if (cf_func) {
int state;
enum ruby_tag_type state;
EC_PUSH_TAG(ec);
if ((state = EC_EXEC_TAG()) == TAG_NONE) {
rb_thread_check_ints();
Expand Down Expand Up @@ -1319,7 +1319,7 @@ ractor_try_yield(rb_execution_context_t *ec, rb_ractor_t *cr, struct rb_ractor_q
type = basket_type_will;
}
else {
int state;
enum ruby_tag_type state;

// begin
EC_PUSH_TAG(ec);
Expand Down
2 changes: 1 addition & 1 deletion thread.c
Expand Up @@ -4364,7 +4364,7 @@ rb_thread_wait_for_single_fd(int fd, int events, struct timeval *timeout)
int result = 0;
nfds_t nfds;
struct waiting_fd wfd;
int state;
enum ruby_tag_type state;
volatile int lerrno;

rb_execution_context_t *ec = GET_EC();
Expand Down
4 changes: 2 additions & 2 deletions vm.c
Expand Up @@ -1981,7 +1981,7 @@ rb_vm_localjump_error(const char *mesg, VALUE value, int reason)
}

VALUE
rb_vm_make_jump_tag_but_local_jump(int state, VALUE val)
rb_vm_make_jump_tag_but_local_jump(enum ruby_tag_type state, VALUE val)
{
const char *mesg;

Expand Down Expand Up @@ -2013,7 +2013,7 @@ rb_vm_make_jump_tag_but_local_jump(int state, VALUE val)
}

void
rb_vm_jump_tag_but_local_jump(int state)
rb_vm_jump_tag_but_local_jump(enum ruby_tag_type state)
{
VALUE exc = rb_vm_make_jump_tag_but_local_jump(state, Qundef);
if (!NIL_P(exc)) rb_exc_raise(exc);
Expand Down
2 changes: 1 addition & 1 deletion vm_trace.c
Expand Up @@ -435,7 +435,7 @@ rb_exec_event_hooks(rb_trace_arg_t *trace_arg, rb_hook_list_t *hooks, int pop_p)
trace_arg->self != rb_mRubyVMFrozenCore /* skip special methods. TODO: remove it. */) {
const VALUE errinfo = ec->errinfo;
const VALUE old_recursive = ec->local_storage_recursive_hash;
int state = 0;
enum ruby_tag_type state = 0;

/* setup */
ec->local_storage_recursive_hash = ec->local_storage_recursive_hash_for_trace;
Expand Down

0 comments on commit 28a2105

Please sign in to comment.