diff options
-rw-r--r-- | bignum.c | 11 | ||||
-rw-r--r-- | complex.c | 64 | ||||
-rw-r--r-- | enc/utf_16be.c | 2 | ||||
-rw-r--r-- | enc/utf_16le.c | 2 | ||||
-rw-r--r-- | ext/date/date_core.c | 23 | ||||
-rw-r--r-- | ext/dl/cptr.c | 1 | ||||
-rw-r--r-- | ext/json/parser/parser.c | 64 | ||||
-rw-r--r-- | ext/json/parser/prereq.mk | 3 | ||||
-rw-r--r-- | gc.c | 4 | ||||
-rw-r--r-- | range.c | 7 | ||||
-rw-r--r-- | rational.c | 36 | ||||
-rw-r--r-- | version.h | 2 |
12 files changed, 52 insertions, 167 deletions
@@ -218,7 +218,7 @@ end */ -#ifdef HAVE_UINT16_T +#if SIZEOF_BDIGIT_DBL == 2 static const int maxpow16_exp[35] = { 15, 10, 7, 6, 6, 5, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, @@ -234,8 +234,7 @@ static const uint16_t maxpow16_num[35] = { U16(0x00006978), U16(0x0000745f), U16(0x00008000), U16(0x00008c61), U16(0x00009988), U16(0x0000a77b), U16(0x0000b640), }; -#endif -#ifdef HAVE_UINT32_T +#elif SIZEOF_BDIGIT_DBL == 4 static const int maxpow32_exp[35] = { 31, 20, 15, 13, 12, 11, 10, 10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, @@ -251,8 +250,7 @@ static const uint32_t maxpow32_num[35] = { U32(0x2b73a840), U32(0x34e63b41), U32(0x40000000), U32(0x4cfa3cc1), U32(0x5c13d840), U32(0x6d91b519), U32(0x81bf1000), }; -#endif -#ifdef HAVE_UINT64_T +#elif SIZEOF_BDIGIT_DBL == 8 && defined HAVE_UINT64_T static const int maxpow64_exp[35] = { 63, 40, 31, 27, 24, 22, 21, 20, 19, 18, 17, 17, 16, 16, 15, 15, 15, 15, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, @@ -278,8 +276,7 @@ static const uint64_t maxpow64_num[35] = { U64(0x211e44f7,0xd02c1000), U64(0x2ee56725,0xf06e5c71), U64(0x41c21cb8,0xe1000000), }; -#endif -#ifdef HAVE_UINT128_T +#elif SIZEOF_BDIGIT_DBL == 16 && defined HAVE_UINT128_T static const int maxpow128_exp[35] = { 127, 80, 63, 55, 49, 45, 42, 40, 38, 37, 35, 34, 33, 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 26, 25, 25, 25, 25, 24, @@ -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) @@ -76,20 +76,6 @@ f_add(VALUE x, VALUE 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) { if (FIXNUM_P(y) && FIX2LONG(y) == 1) @@ -106,16 +92,6 @@ f_gt_p(VALUE x, VALUE 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) { #ifndef PRESERVE_SIGNEDZERO @@ -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 @@ -258,12 +226,6 @@ k_numeric_p(VALUE x) } inline static VALUE -k_integer_p(VALUE x) -{ - return f_kind_of_p(x, rb_cInteger); -} - -inline static VALUE k_fixnum_p(VALUE x) { return f_kind_of_p(x, rb_cFixnum); @@ -457,13 +419,6 @@ nucomp_s_new(int argc, VALUE *argv, VALUE klass) } 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) { assert(!k_complex_p(x)); @@ -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) { @@ -2098,24 +2054,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"); diff --git a/enc/utf_16be.c b/enc/utf_16be.c index 8b25d473a7..3af8359caf 100644 --- a/enc/utf_16be.c +++ b/enc/utf_16be.c @@ -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, diff --git a/enc/utf_16le.c b/enc/utf_16le.c index 8feb7ad769..453c771cc5 100644 --- a/enc/utf_16le.c +++ b/enc/utf_16le.c @@ -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, diff --git a/ext/date/date_core.c b/ext/date/date_core.c index 6e5c79a494..1685d15e61 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -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) { @@ -1980,12 +1963,6 @@ k_date_p(VALUE x) } inline static VALUE -k_datetime_p(VALUE x) -{ - return f_kind_of_p(x, cDateTime); -} - -inline static VALUE k_numeric_p(VALUE x) { return f_kind_of_p(x, rb_cNumeric); diff --git a/ext/dl/cptr.c b/ext/dl/cptr.c index d34309379b..7a82c7c3e0 100644 --- a/ext/dl/cptr.c +++ b/ext/dl/cptr.c @@ -389,7 +389,6 @@ static VALUE rb_dlptr_inspect(VALUE self) { struct ptr_data *data; - char str[1024]; TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data); return rb_sprintf("#<%"PRIsVALUE":%p ptr=%p size=%ld free=%p>", diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c index df89f2c58b..29335541d4 100644 --- a/ext/json/parser/parser.c +++ b/ext/json/parser/parser.c @@ -89,11 +89,11 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions, #line 92 "parser.c" -static const int JSON_object_start = 1; -static const int JSON_object_first_final = 27; -static const int JSON_object_error = 0; +enum {JSON_object_start = 1}; +enum {JSON_object_first_final = 27}; +enum {JSON_object_error = 0}; -static const int JSON_object_en_main = 1; +enum {JSON_object_en_main = 1}; #line 151 "parser.rl" @@ -467,11 +467,11 @@ case 26: #line 470 "parser.c" -static const int JSON_value_start = 1; -static const int JSON_value_first_final = 21; -static const int JSON_value_error = 0; +enum {JSON_value_start = 1}; +enum {JSON_value_first_final = 21}; +enum {JSON_value_error = 0}; -static const int JSON_value_en_main = 1; +enum {JSON_value_en_main = 1}; #line 271 "parser.rl" @@ -776,11 +776,11 @@ case 20: #line 779 "parser.c" -static const int JSON_integer_start = 1; -static const int JSON_integer_first_final = 3; -static const int JSON_integer_error = 0; +enum {JSON_integer_start = 1}; +enum {JSON_integer_first_final = 3}; +enum {JSON_integer_error = 0}; -static const int JSON_integer_en_main = 1; +enum {JSON_integer_en_main = 1}; #line 295 "parser.rl" @@ -875,11 +875,11 @@ case 5: #line 878 "parser.c" -static const int JSON_float_start = 1; -static const int JSON_float_first_final = 8; -static const int JSON_float_error = 0; +enum {JSON_float_start = 1}; +enum {JSON_float_first_final = 8}; +enum {JSON_float_error = 0}; -static const int JSON_float_en_main = 1; +enum {JSON_float_en_main = 1}; #line 329 "parser.rl" @@ -1041,11 +1041,11 @@ case 7: #line 1044 "parser.c" -static const int JSON_array_start = 1; -static const int JSON_array_first_final = 17; -static const int JSON_array_error = 0; +enum {JSON_array_start = 1}; +enum {JSON_array_first_final = 17}; +enum {JSON_array_error = 0}; -static const int JSON_array_en_main = 1; +enum {JSON_array_en_main = 1}; #line 381 "parser.rl" @@ -1373,11 +1373,11 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd) #line 1376 "parser.c" -static const int JSON_string_start = 1; -static const int JSON_string_first_final = 8; -static const int JSON_string_error = 0; +enum {JSON_string_start = 1}; +enum {JSON_string_first_final = 8}; +enum {JSON_string_error = 0}; -static const int JSON_string_en_main = 1; +enum {JSON_string_en_main = 1}; #line 494 "parser.rl" @@ -1730,11 +1730,11 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) #line 1733 "parser.c" -static const int JSON_start = 1; -static const int JSON_first_final = 10; -static const int JSON_error = 0; +enum {JSON_start = 1}; +enum {JSON_first_final = 10}; +enum {JSON_error = 0}; -static const int JSON_en_main = 1; +enum {JSON_en_main = 1}; #line 740 "parser.rl" @@ -1904,11 +1904,11 @@ case 9: #line 1907 "parser.c" -static const int JSON_quirks_mode_start = 1; -static const int JSON_quirks_mode_first_final = 10; -static const int JSON_quirks_mode_error = 0; +enum {JSON_quirks_mode_start = 1}; +enum {JSON_quirks_mode_first_final = 10}; +enum {JSON_quirks_mode_error = 0}; -static const int JSON_quirks_mode_en_main = 1; +enum {JSON_quirks_mode_en_main = 1}; #line 778 "parser.rl" diff --git a/ext/json/parser/prereq.mk b/ext/json/parser/prereq.mk index 440ef4017e..be7bcb4319 100644 --- a/ext/json/parser/prereq.mk +++ b/ext/json/parser/prereq.mk @@ -4,6 +4,7 @@ RAGEL = ragel .rl.c: $(RAGEL) -G2 $< - $(BASERUBY) -pli -e '$$_.sub!(/[ \t]+$$/, "")' $@ + $(BASERUBY) -pli -e '$$_.sub!(/[ \t]+$$/, "")' \ + -e '$$_.sub!(/^static const int (JSON_.*=.*);$$/, "enum {\\1};")' $@ parser.c: @@ -4505,8 +4505,8 @@ gc_marks(rb_objspace_t *objspace, int full_mark) { /* See the comment about RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR */ const double r = gc_params.oldobject_limit_factor; - objspace->rgengc.remembered_shady_object_limit = objspace->rgengc.remembered_shady_object_count * r; - objspace->rgengc.old_object_limit = objspace->rgengc.old_object_count * r; + objspace->rgengc.remembered_shady_object_limit = (size_t)(objspace->rgengc.remembered_shady_object_count * r); + objspace->rgengc.old_object_limit = (size_t)(objspace->rgengc.old_object_count * r); } } else { /* minor GC */ @@ -31,13 +31,6 @@ static ID id_cmp, id_succ, id_beg, id_end, id_excl, id_integer_p, id_div; #define RBOOL(v) ((v) ? Qtrue : Qfalse) #define EXCL(r) RTEST(RANGE_EXCL(r)) -static inline VALUE -SET_EXCL(VALUE r, VALUE v) -{ - v = RBOOL(RTEST(v)); - RANGE_SET_EXCL(r, v); - return v; -} static VALUE range_failed(void) diff --git a/rational.c b/rational.c index 33d2a2c2d6..7bc7206376 100644 --- a/rational.c +++ b/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) @@ -92,14 +92,6 @@ f_div(VALUE x, VALUE 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) { if (FIXNUM_P(x) && FIXNUM_P(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 @@ -580,13 +561,6 @@ nurat_s_new(int argc, VALUE *argv, VALUE klass) } 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) { assert(!k_rational_p(x)); @@ -595,13 +569,6 @@ f_rational_new2(VALUE klass, VALUE x, VALUE 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) { assert(!k_rational_p(x)); @@ -2532,7 +2499,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("-@"); @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.2" #define RUBY_RELEASE_DATE "2014-08-03" -#define RUBY_PATCHLEVEL 187 +#define RUBY_PATCHLEVEL 188 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 8 |