mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	unused functions and variables
* complex.c, rational.c: remove unused functions, which are warned by clang 5.1, and also variables only used by removed functions. * ext/date/date_core.c: ditto. * enc/utf_16be.c, enc/utf_16le.c: comment out constants only used by commented out functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									57e557908a
								
							
						
					
					
						commit
						6224216294
					
				
					 5 changed files with 11 additions and 116 deletions
				
			
		
							
								
								
									
										64
									
								
								complex.c
									
										
									
									
									
								
							
							
						
						
									
										64
									
								
								complex.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -18,10 +18,10 @@
 | 
			
		|||
 | 
			
		||||
VALUE rb_cComplex;
 | 
			
		||||
 | 
			
		||||
static ID id_abs, id_abs2, id_arg, id_cmp, id_conj, id_convert,
 | 
			
		||||
    id_denominator, id_divmod, id_eqeq_p, id_expt, id_fdiv,  id_floor,
 | 
			
		||||
    id_idiv, id_imag, id_inspect, id_negate, id_numerator, id_quo,
 | 
			
		||||
    id_real, id_real_p, id_to_f, id_to_i, id_to_r, id_to_s,
 | 
			
		||||
static ID id_abs, id_arg, id_convert,
 | 
			
		||||
    id_denominator, id_eqeq_p, id_expt, id_fdiv,
 | 
			
		||||
    id_inspect, id_negate, id_numerator, id_quo,
 | 
			
		||||
    id_real_p, id_to_f, id_to_i, id_to_r, id_to_s,
 | 
			
		||||
    id_i_real, id_i_imag;
 | 
			
		||||
 | 
			
		||||
#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
 | 
			
		||||
| 
						 | 
				
			
			@ -75,20 +75,6 @@ f_add(VALUE x, VALUE y)
 | 
			
		|||
    return rb_funcall(x, '+', 1, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_cmp(VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
    if (FIXNUM_P(x) && FIXNUM_P(y)) {
 | 
			
		||||
	long c = FIX2LONG(x) - FIX2LONG(y);
 | 
			
		||||
	if (c > 0)
 | 
			
		||||
	    c = 1;
 | 
			
		||||
	else if (c < 0)
 | 
			
		||||
	    c = -1;
 | 
			
		||||
	return INT2FIX(c);
 | 
			
		||||
    }
 | 
			
		||||
    return rb_funcall(x, id_cmp, 1, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_div(VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -105,16 +91,6 @@ f_gt_p(VALUE x, VALUE y)
 | 
			
		|||
    return rb_funcall(x, '>', 1, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_lt_p(VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
    if (FIXNUM_P(x) && FIXNUM_P(y))
 | 
			
		||||
	return f_boolcast(FIX2LONG(x) < FIX2LONG(y));
 | 
			
		||||
    return rb_funcall(x, '<', 1, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
binop(mod, '%')
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_mul(VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -152,16 +128,11 @@ f_sub(VALUE x, VALUE y)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
fun1(abs)
 | 
			
		||||
fun1(abs2)
 | 
			
		||||
fun1(arg)
 | 
			
		||||
fun1(conj)
 | 
			
		||||
fun1(denominator)
 | 
			
		||||
fun1(floor)
 | 
			
		||||
fun1(imag)
 | 
			
		||||
fun1(inspect)
 | 
			
		||||
fun1(negate)
 | 
			
		||||
fun1(numerator)
 | 
			
		||||
fun1(real)
 | 
			
		||||
fun1(real_p)
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -182,8 +153,6 @@ f_to_f(VALUE x)
 | 
			
		|||
fun1(to_r)
 | 
			
		||||
fun1(to_s)
 | 
			
		||||
 | 
			
		||||
fun2(divmod)
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_eqeq_p(VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -194,7 +163,6 @@ f_eqeq_p(VALUE x, VALUE y)
 | 
			
		|||
 | 
			
		||||
fun2(expt)
 | 
			
		||||
fun2(fdiv)
 | 
			
		||||
fun2(idiv)
 | 
			
		||||
fun2(quo)
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -257,12 +225,6 @@ k_numeric_p(VALUE x)
 | 
			
		|||
    return f_kind_of_p(x, rb_cNumeric);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
k_integer_p(VALUE x)
 | 
			
		||||
{
 | 
			
		||||
    return f_kind_of_p(x, rb_cInteger);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
k_fixnum_p(VALUE x)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -456,13 +418,6 @@ nucomp_s_new(int argc, VALUE *argv, VALUE klass)
 | 
			
		|||
    return nucomp_s_canonicalize_internal(klass, real, imag);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_complex_new1(VALUE klass, VALUE x)
 | 
			
		||||
{
 | 
			
		||||
    assert(!k_complex_p(x));
 | 
			
		||||
    return nucomp_s_canonicalize_internal(klass, x, ZERO);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_complex_new2(VALUE klass, VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -537,7 +492,6 @@ m_log_bang(VALUE x)
 | 
			
		|||
 | 
			
		||||
imp1(sin)
 | 
			
		||||
imp1(sinh)
 | 
			
		||||
imp1(sqrt)
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
m_cos(VALUE x)
 | 
			
		||||
| 
						 | 
				
			
			@ -570,6 +524,8 @@ m_sin(VALUE x)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
imp1(sqrt)
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
m_sqrt(VALUE x)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -2091,24 +2047,16 @@ Init_Complex(void)
 | 
			
		|||
    assert(fprintf(stderr, "assert() is now active\n"));
 | 
			
		||||
 | 
			
		||||
    id_abs = rb_intern("abs");
 | 
			
		||||
    id_abs2 = rb_intern("abs2");
 | 
			
		||||
    id_arg = rb_intern("arg");
 | 
			
		||||
    id_cmp = rb_intern("<=>");
 | 
			
		||||
    id_conj = rb_intern("conj");
 | 
			
		||||
    id_convert = rb_intern("convert");
 | 
			
		||||
    id_denominator = rb_intern("denominator");
 | 
			
		||||
    id_divmod = rb_intern("divmod");
 | 
			
		||||
    id_eqeq_p = rb_intern("==");
 | 
			
		||||
    id_expt = rb_intern("**");
 | 
			
		||||
    id_fdiv = rb_intern("fdiv");
 | 
			
		||||
    id_floor = rb_intern("floor");
 | 
			
		||||
    id_idiv = rb_intern("div");
 | 
			
		||||
    id_imag = rb_intern("imag");
 | 
			
		||||
    id_inspect = rb_intern("inspect");
 | 
			
		||||
    id_negate = rb_intern("-@");
 | 
			
		||||
    id_numerator = rb_intern("numerator");
 | 
			
		||||
    id_quo = rb_intern("quo");
 | 
			
		||||
    id_real = rb_intern("real");
 | 
			
		||||
    id_real_p = rb_intern("real?");
 | 
			
		||||
    id_to_f = rb_intern("to_f");
 | 
			
		||||
    id_to_i = rb_intern("to_i");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,6 +33,7 @@
 | 
			
		|||
#define UTF16_IS_SURROGATE_SECOND(c)   (((c) & 0xfc) == 0xdc)
 | 
			
		||||
#define UTF16_IS_SURROGATE(c)          (((c) & 0xf8) == 0xd8)
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
static const int EncLen_UTF16[] = {
 | 
			
		||||
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 | 
			
		||||
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 | 
			
		||||
| 
						 | 
				
			
			@ -51,6 +52,7 @@ static const int EncLen_UTF16[] = {
 | 
			
		|||
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 | 
			
		||||
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
utf16be_mbc_enc_len(const UChar* p, const OnigUChar* e ARG_UNUSED,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,6 +33,7 @@
 | 
			
		|||
#define UTF16_IS_SURROGATE_SECOND(c)   (((c) & 0xfc) == 0xdc)
 | 
			
		||||
#define UTF16_IS_SURROGATE(c)          (((c) & 0xf8) == 0xd8)
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
static const int EncLen_UTF16[] = {
 | 
			
		||||
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 | 
			
		||||
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 | 
			
		||||
| 
						 | 
				
			
			@ -51,6 +52,7 @@ static const int EncLen_UTF16[] = {
 | 
			
		|||
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 | 
			
		||||
  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
utf16le_mbc_enc_len(const UChar* p, const OnigUChar* e,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1723,23 +1723,6 @@ m_real_year(union DateData *x)
 | 
			
		|||
    return ry;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef USE_PACK
 | 
			
		||||
inline static int
 | 
			
		||||
m_pc(union DateData *x)
 | 
			
		||||
{
 | 
			
		||||
    if (simple_dat_p(x)) {
 | 
			
		||||
	get_s_civil(x);
 | 
			
		||||
	return x->s.pc;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
	get_c_civil(x);
 | 
			
		||||
	get_c_time(x);
 | 
			
		||||
	return x->c.pc;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
inline static int
 | 
			
		||||
m_mon(union DateData *x)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -1979,12 +1962,6 @@ k_date_p(VALUE x)
 | 
			
		|||
    return f_kind_of_p(x, cDate);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
k_datetime_p(VALUE x)
 | 
			
		||||
{
 | 
			
		||||
    return f_kind_of_p(x, cDateTime);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
k_numeric_p(VALUE x)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										36
									
								
								rational.c
									
										
									
									
									
								
							
							
						
						
									
										36
									
								
								rational.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -31,7 +31,7 @@
 | 
			
		|||
VALUE rb_cRational;
 | 
			
		||||
 | 
			
		||||
static ID id_abs, id_cmp, id_convert, id_eqeq_p, id_expt, id_fdiv,
 | 
			
		||||
    id_floor, id_idiv, id_integer_p, id_negate, id_to_f,
 | 
			
		||||
    id_idiv, id_integer_p, id_negate, id_to_f,
 | 
			
		||||
    id_to_i, id_truncate, id_i_num, id_i_den;
 | 
			
		||||
 | 
			
		||||
#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
 | 
			
		||||
| 
						 | 
				
			
			@ -91,14 +91,6 @@ f_div(VALUE x, VALUE y)
 | 
			
		|||
    return rb_funcall(x, '/', 1, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_gt_p(VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
    if (FIXNUM_P(x) && FIXNUM_P(y))
 | 
			
		||||
	return f_boolcast(FIX2LONG(x) > FIX2LONG(y));
 | 
			
		||||
    return rb_funcall(x, '>', 1, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_lt_p(VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -142,7 +134,6 @@ f_sub(VALUE x, VALUE y)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
fun1(abs)
 | 
			
		||||
fun1(floor)
 | 
			
		||||
fun1(integer_p)
 | 
			
		||||
fun1(negate)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -161,8 +152,6 @@ f_to_f(VALUE x)
 | 
			
		|||
    return rb_funcall(x, id_to_f, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fun1(truncate)
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_eqeq_p(VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -474,14 +463,6 @@ f_rational_new_bang1(VALUE klass, VALUE x)
 | 
			
		|||
    return nurat_s_new_internal(klass, x, ONE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_rational_new_bang2(VALUE klass, VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
    assert(f_positive_p(y));
 | 
			
		||||
    assert(f_nonzero_p(y));
 | 
			
		||||
    return nurat_s_new_internal(klass, x, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef CANONICALIZATION_FOR_MATHN
 | 
			
		||||
#define CANON
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -579,13 +560,6 @@ nurat_s_new(int argc, VALUE *argv, VALUE klass)
 | 
			
		|||
    return nurat_s_canonicalize_internal(klass, num, den);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_rational_new1(VALUE klass, VALUE x)
 | 
			
		||||
{
 | 
			
		||||
    assert(!k_rational_p(x));
 | 
			
		||||
    return nurat_s_canonicalize_internal(klass, x, ONE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_rational_new2(VALUE klass, VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -594,13 +568,6 @@ f_rational_new2(VALUE klass, VALUE x, VALUE y)
 | 
			
		|||
    return nurat_s_canonicalize_internal(klass, x, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_rational_new_no_reduce1(VALUE klass, VALUE x)
 | 
			
		||||
{
 | 
			
		||||
    assert(!k_rational_p(x));
 | 
			
		||||
    return nurat_s_canonicalize_internal_no_reduce(klass, x, ONE);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline static VALUE
 | 
			
		||||
f_rational_new_no_reduce2(VALUE klass, VALUE x, VALUE y)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -2530,7 +2497,6 @@ Init_Rational(void)
 | 
			
		|||
    id_eqeq_p = rb_intern("==");
 | 
			
		||||
    id_expt = rb_intern("**");
 | 
			
		||||
    id_fdiv = rb_intern("fdiv");
 | 
			
		||||
    id_floor = rb_intern("floor");
 | 
			
		||||
    id_idiv = rb_intern("div");
 | 
			
		||||
    id_integer_p = rb_intern("integer?");
 | 
			
		||||
    id_negate = rb_intern("-@");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue