mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	UNREACHABLE_RETURN
* include/ruby/ruby.h (UNREACHABLE_RETURN): UNREACHABLE at the end of non-void functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									c78945751f
								
							
						
					
					
						commit
						97e05dad7f
					
				
					 23 changed files with 40 additions and 33 deletions
				
			
		
							
								
								
									
										2
									
								
								bignum.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								bignum.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -7097,7 +7097,7 @@ rb_int_powm(int const argc, VALUE * const argv, VALUE const num)
 | 
			
		|||
            return int_pow_tmp3(rb_int_modulo(a, m), b, m, nega_flg);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								dmydln.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								dmydln.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -6,5 +6,5 @@ dln_load(const char *file)
 | 
			
		|||
{
 | 
			
		||||
    rb_loaderror("this executable file can't load extension libraries");
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(NULL);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								enum.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								enum.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -938,7 +938,7 @@ first_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, params))
 | 
			
		|||
    MEMO_V1_SET(memo, i);
 | 
			
		||||
    rb_iter_break();
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE enum_take(VALUE obj, VALUE n);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								eval.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								eval.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -728,7 +728,7 @@ rb_f_raise(int argc, VALUE *argv)
 | 
			
		|||
    }
 | 
			
		||||
    rb_raise_jump(rb_make_exception(argc, argv), *cause);
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ static VALUE
 | 
			
		|||
enc_raise(VALUE exc, VALUE encoding, VALUE mesg)
 | 
			
		||||
{
 | 
			
		||||
    rb_enc_raise(rb_to_encoding(encoding), exc, "%s", StringValueCStr(mesg));
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ iter_break(VALUE self)
 | 
			
		|||
{
 | 
			
		||||
    rb_iter_break();
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ iter_break_value(VALUE self, VALUE val)
 | 
			
		|||
{
 | 
			
		||||
    rb_iter_break_value(val);
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ coderange_int2sym(int coderange)
 | 
			
		|||
	return sym_broken;
 | 
			
		||||
    }
 | 
			
		||||
    rb_bug("wrong condition of coderange");
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* return coderange without scan */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -665,7 +665,7 @@ pty_check(int argc, VALUE *argv, VALUE self)
 | 
			
		|||
    if (!RTEST(exc)) return rb_last_status_get();
 | 
			
		||||
    raise_from_check(cpid, status);
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE cPTY;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1756,7 +1756,7 @@ rb_remove_history(int index)
 | 
			
		|||
#else
 | 
			
		||||
    rb_notimplement();
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -303,5 +303,5 @@ ripper_token2eventid(int tok)
 | 
			
		|||
    }
 | 
			
		||||
    rb_raise(rb_eRuntimeError, "[Ripper FATAL] unknown token %d", tok);
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(0);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -424,7 +424,7 @@ sockopt_ipv4_multicast_loop(VALUE self)
 | 
			
		|||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    rb_raise(rb_eTypeError, "ipv4_multicast_loop socket option expected");
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define inspect_ipv4_multicast_loop(a,b,c,d) \
 | 
			
		||||
| 
						 | 
				
			
			@ -475,7 +475,7 @@ sockopt_ipv4_multicast_ttl(VALUE self)
 | 
			
		|||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    rb_raise(rb_eTypeError, "ipv4_multicast_ttl socket option expected");
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define inspect_ipv4_multicast_ttl(a,b,c,d) \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2550,7 +2550,7 @@ rsock_io_socket_addrinfo(VALUE io, struct sockaddr *addr, socklen_t len)
 | 
			
		|||
        rb_raise(rb_eTypeError, "neither IO nor file descriptor");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1381,7 +1381,7 @@ sock_s_getnameinfo(int argc, VALUE *argv)
 | 
			
		|||
    errno = saved_errno;
 | 
			
		||||
    rsock_raise_socket_error("getnameinfo", error);
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,6 +44,13 @@ extern "C" {
 | 
			
		|||
#   define ASSUME(x) ((void)(x))
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef UNREACHABLE_RETURN
 | 
			
		||||
# ifdef UNREACHABLE
 | 
			
		||||
#  define UNREACHABLE_RETURN(val) UNREACHABLE
 | 
			
		||||
# else
 | 
			
		||||
#  define UNREACHABLE_RETURN(val) return (val)
 | 
			
		||||
# endif
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef UNREACHABLE
 | 
			
		||||
# define UNREACHABLE ((void)0)	/* unreachable */
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -487,7 +487,7 @@ num_sadded(VALUE x, VALUE name)
 | 
			
		|||
	     rb_id2str(mid),
 | 
			
		||||
	     rb_obj_class(x));
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								pack.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								pack.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1936,7 +1936,7 @@ rb_uv_to_utf8(char buf[6], unsigned long uv)
 | 
			
		|||
    }
 | 
			
		||||
    rb_raise(rb_eRangeError, "pack(U): value out of range");
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const unsigned long utf8_limits[] = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								proc.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								proc.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2336,7 +2336,7 @@ rb_method_entry_min_max_arity(const rb_method_entry_t *me, int *max)
 | 
			
		|||
	return 0;
 | 
			
		||||
    }
 | 
			
		||||
    rb_bug("rb_method_entry_min_max_arity: invalid method entry type (%d)", def->type);
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										16
									
								
								process.c
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								process.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2896,7 +2896,7 @@ rb_f_exec(int argc, const VALUE *argv)
 | 
			
		|||
    rb_exec_fail(eargp, err, errmsg);
 | 
			
		||||
    RB_GC_GUARD(execarg_obj);
 | 
			
		||||
    rb_syserr_fail_str(err, fail_str);
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define ERRMSG(str) do { if (errmsg && 0 < errmsg_buflen) strlcpy(errmsg, (str), errmsg_buflen); } while (0)
 | 
			
		||||
| 
						 | 
				
			
			@ -4058,7 +4058,7 @@ rb_f_exit_bang(int argc, VALUE *argv, VALUE obj)
 | 
			
		|||
    }
 | 
			
		||||
    _exit(istatus);
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
| 
						 | 
				
			
			@ -4129,7 +4129,7 @@ rb_f_exit(int argc, const VALUE *argv)
 | 
			
		|||
    }
 | 
			
		||||
    rb_exit(istatus);
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -4166,7 +4166,7 @@ rb_f_abort(int argc, const VALUE *argv)
 | 
			
		|||
	rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
| 
						 | 
				
			
			@ -5154,7 +5154,7 @@ rlimit_resource_type(VALUE rtype)
 | 
			
		|||
 | 
			
		||||
    rb_raise(rb_eArgError, "invalid resource name: % "PRIsVALUE, rtype);
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(-1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static rlim_t
 | 
			
		||||
| 
						 | 
				
			
			@ -5195,7 +5195,7 @@ rlimit_resource_value(VALUE rval)
 | 
			
		|||
#endif
 | 
			
		||||
    rb_raise(rb_eArgError, "invalid resource value: %"PRIsVALUE, rval);
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN((rlim_t)-1);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -7034,7 +7034,7 @@ p_uid_switch(VALUE obj)
 | 
			
		|||
	rb_syserr_fail(EPERM, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
static VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -7147,7 +7147,7 @@ p_gid_switch(VALUE obj)
 | 
			
		|||
	rb_syserr_fail(EPERM, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
static VALUE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								struct.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								struct.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -217,7 +217,7 @@ rb_struct_getmember(VALUE obj, ID id)
 | 
			
		|||
    }
 | 
			
		||||
    rb_name_err_raise("`%1$s' is not a struct member", obj, ID2SYM(id));
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE rb_struct_ref0(VALUE obj) {return RSTRUCT_GET(obj, 0);}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1423,7 +1423,7 @@ static VALUE
 | 
			
		|||
undumpable(VALUE obj)
 | 
			
		||||
{
 | 
			
		||||
    rb_raise(rb_eTypeError, "can't dump %"PRIsVALUE, rb_obj_class(obj));
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1734,7 +1734,7 @@ rb_obj_remove_instance_variable(VALUE obj, VALUE name)
 | 
			
		|||
  not_defined:
 | 
			
		||||
    rb_name_err_raise("instance variable %1$s not defined",
 | 
			
		||||
		      obj, name);
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
NORETURN(static void uninitialized_constant(VALUE, VALUE));
 | 
			
		||||
| 
						 | 
				
			
			@ -1805,7 +1805,7 @@ rb_mod_const_missing(VALUE klass, VALUE name)
 | 
			
		|||
    }
 | 
			
		||||
    uninitialized_constant(klass, name);
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -636,7 +636,7 @@ rb_method_missing(int argc, const VALUE *argv, VALUE obj)
 | 
			
		|||
{
 | 
			
		||||
    rb_execution_context_t *ec = GET_EC();
 | 
			
		||||
    raise_method_missing(ec, argc, argv, obj, ec->method_missing_reason);
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MJIT_FUNC_EXPORTED VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -1851,7 +1851,7 @@ rb_f_throw(int argc, VALUE *argv)
 | 
			
		|||
 | 
			
		||||
    rb_scan_args(argc, argv, "11", &tag, &value);
 | 
			
		||||
    rb_throw_obj(tag, value);
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -118,7 +118,7 @@ rb_f_notimplement(int argc, const VALUE *argv, VALUE obj)
 | 
			
		|||
{
 | 
			
		||||
    rb_notimplement();
 | 
			
		||||
 | 
			
		||||
    UNREACHABLE;
 | 
			
		||||
    UNREACHABLE_RETURN(Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue