Skip to content

Commit 5816247

Browse files
committed
merge revision(s) r44577,r45097,r45330,r45331,r45354,r45356: [Backport ruby#10033]
cptr.c: unused variable * ext/dl/cptr.c (rb_dlptr_inspect): remove no longer used variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 0ee5ad5 commit 5816247

File tree

12 files changed

+52
-167
lines changed

12 files changed

+52
-167
lines changed

bignum.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ end
218218
219219
*/
220220

221-
#ifdef HAVE_UINT16_T
221+
#if SIZEOF_BDIGIT_DBL == 2
222222
static const int maxpow16_exp[35] = {
223223
15, 10, 7, 6, 6, 5, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3,
224224
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
@@ -234,8 +234,7 @@ static const uint16_t maxpow16_num[35] = {
234234
U16(0x00006978), U16(0x0000745f), U16(0x00008000), U16(0x00008c61),
235235
U16(0x00009988), U16(0x0000a77b), U16(0x0000b640),
236236
};
237-
#endif
238-
#ifdef HAVE_UINT32_T
237+
#elif SIZEOF_BDIGIT_DBL == 4
239238
static const int maxpow32_exp[35] = {
240239
31, 20, 15, 13, 12, 11, 10, 10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7,
241240
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] = {
251250
U32(0x2b73a840), U32(0x34e63b41), U32(0x40000000), U32(0x4cfa3cc1),
252251
U32(0x5c13d840), U32(0x6d91b519), U32(0x81bf1000),
253252
};
254-
#endif
255-
#ifdef HAVE_UINT64_T
253+
#elif SIZEOF_BDIGIT_DBL == 8 && defined HAVE_UINT64_T
256254
static const int maxpow64_exp[35] = {
257255
63, 40, 31, 27, 24, 22, 21, 20, 19, 18, 17, 17, 16, 16, 15, 15, 15,
258256
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] = {
278276
U64(0x211e44f7,0xd02c1000), U64(0x2ee56725,0xf06e5c71),
279277
U64(0x41c21cb8,0xe1000000),
280278
};
281-
#endif
282-
#ifdef HAVE_UINT128_T
279+
#elif SIZEOF_BDIGIT_DBL == 16 && defined HAVE_UINT128_T
283280
static const int maxpow128_exp[35] = {
284281
127, 80, 63, 55, 49, 45, 42, 40, 38, 37, 35, 34, 33, 32, 31, 31, 30,
285282
30, 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 26, 25, 25, 25, 25, 24,

complex.c

Lines changed: 6 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818

1919
VALUE rb_cComplex;
2020

21-
static ID id_abs, id_abs2, id_arg, id_cmp, id_conj, id_convert,
22-
id_denominator, id_divmod, id_eqeq_p, id_expt, id_fdiv, id_floor,
23-
id_idiv, id_imag, id_inspect, id_negate, id_numerator, id_quo,
24-
id_real, id_real_p, id_to_f, id_to_i, id_to_r, id_to_s,
21+
static ID id_abs, id_arg, id_convert,
22+
id_denominator, id_eqeq_p, id_expt, id_fdiv,
23+
id_inspect, id_negate, id_numerator, id_quo,
24+
id_real_p, id_to_f, id_to_i, id_to_r, id_to_s,
2525
id_i_real, id_i_imag;
2626

2727
#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
@@ -75,20 +75,6 @@ f_add(VALUE x, VALUE y)
7575
return rb_funcall(x, '+', 1, y);
7676
}
7777

78-
inline static VALUE
79-
f_cmp(VALUE x, VALUE y)
80-
{
81-
if (FIXNUM_P(x) && FIXNUM_P(y)) {
82-
long c = FIX2LONG(x) - FIX2LONG(y);
83-
if (c > 0)
84-
c = 1;
85-
else if (c < 0)
86-
c = -1;
87-
return INT2FIX(c);
88-
}
89-
return rb_funcall(x, id_cmp, 1, y);
90-
}
91-
9278
inline static VALUE
9379
f_div(VALUE x, VALUE y)
9480
{
@@ -105,16 +91,6 @@ f_gt_p(VALUE x, VALUE y)
10591
return rb_funcall(x, '>', 1, y);
10692
}
10793

108-
inline static VALUE
109-
f_lt_p(VALUE x, VALUE y)
110-
{
111-
if (FIXNUM_P(x) && FIXNUM_P(y))
112-
return f_boolcast(FIX2LONG(x) < FIX2LONG(y));
113-
return rb_funcall(x, '<', 1, y);
114-
}
115-
116-
binop(mod, '%')
117-
11894
inline static VALUE
11995
f_mul(VALUE x, VALUE y)
12096
{
@@ -152,16 +128,11 @@ f_sub(VALUE x, VALUE y)
152128
}
153129

154130
fun1(abs)
155-
fun1(abs2)
156131
fun1(arg)
157-
fun1(conj)
158132
fun1(denominator)
159-
fun1(floor)
160-
fun1(imag)
161133
fun1(inspect)
162134
fun1(negate)
163135
fun1(numerator)
164-
fun1(real)
165136
fun1(real_p)
166137

167138
inline static VALUE
@@ -182,8 +153,6 @@ f_to_f(VALUE x)
182153
fun1(to_r)
183154
fun1(to_s)
184155

185-
fun2(divmod)
186-
187156
inline static VALUE
188157
f_eqeq_p(VALUE x, VALUE y)
189158
{
@@ -194,7 +163,6 @@ f_eqeq_p(VALUE x, VALUE y)
194163

195164
fun2(expt)
196165
fun2(fdiv)
197-
fun2(idiv)
198166
fun2(quo)
199167

200168
inline static VALUE
@@ -257,12 +225,6 @@ k_numeric_p(VALUE x)
257225
return f_kind_of_p(x, rb_cNumeric);
258226
}
259227

260-
inline static VALUE
261-
k_integer_p(VALUE x)
262-
{
263-
return f_kind_of_p(x, rb_cInteger);
264-
}
265-
266228
inline static VALUE
267229
k_fixnum_p(VALUE x)
268230
{
@@ -456,13 +418,6 @@ nucomp_s_new(int argc, VALUE *argv, VALUE klass)
456418
return nucomp_s_canonicalize_internal(klass, real, imag);
457419
}
458420

459-
inline static VALUE
460-
f_complex_new1(VALUE klass, VALUE x)
461-
{
462-
assert(!k_complex_p(x));
463-
return nucomp_s_canonicalize_internal(klass, x, ZERO);
464-
}
465-
466421
inline static VALUE
467422
f_complex_new2(VALUE klass, VALUE x, VALUE y)
468423
{
@@ -537,7 +492,6 @@ m_log_bang(VALUE x)
537492

538493
imp1(sin)
539494
imp1(sinh)
540-
imp1(sqrt)
541495

542496
static VALUE
543497
m_cos(VALUE x)
@@ -570,6 +524,8 @@ m_sin(VALUE x)
570524
}
571525

572526
#if 0
527+
imp1(sqrt)
528+
573529
static VALUE
574530
m_sqrt(VALUE x)
575531
{
@@ -2098,24 +2054,16 @@ Init_Complex(void)
20982054
assert(fprintf(stderr, "assert() is now active\n"));
20992055

21002056
id_abs = rb_intern("abs");
2101-
id_abs2 = rb_intern("abs2");
21022057
id_arg = rb_intern("arg");
2103-
id_cmp = rb_intern("<=>");
2104-
id_conj = rb_intern("conj");
21052058
id_convert = rb_intern("convert");
21062059
id_denominator = rb_intern("denominator");
2107-
id_divmod = rb_intern("divmod");
21082060
id_eqeq_p = rb_intern("==");
21092061
id_expt = rb_intern("**");
21102062
id_fdiv = rb_intern("fdiv");
2111-
id_floor = rb_intern("floor");
2112-
id_idiv = rb_intern("div");
2113-
id_imag = rb_intern("imag");
21142063
id_inspect = rb_intern("inspect");
21152064
id_negate = rb_intern("-@");
21162065
id_numerator = rb_intern("numerator");
21172066
id_quo = rb_intern("quo");
2118-
id_real = rb_intern("real");
21192067
id_real_p = rb_intern("real?");
21202068
id_to_f = rb_intern("to_f");
21212069
id_to_i = rb_intern("to_i");

enc/utf_16be.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#define UTF16_IS_SURROGATE_SECOND(c) (((c) & 0xfc) == 0xdc)
3434
#define UTF16_IS_SURROGATE(c) (((c) & 0xf8) == 0xd8)
3535

36+
#if 0
3637
static const int EncLen_UTF16[] = {
3738
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3839
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[] = {
5152
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
5253
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
5354
};
55+
#endif
5456

5557
static int
5658
utf16be_mbc_enc_len(const UChar* p, const OnigUChar* e ARG_UNUSED,

enc/utf_16le.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#define UTF16_IS_SURROGATE_SECOND(c) (((c) & 0xfc) == 0xdc)
3434
#define UTF16_IS_SURROGATE(c) (((c) & 0xf8) == 0xd8)
3535

36+
#if 0
3637
static const int EncLen_UTF16[] = {
3738
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3839
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[] = {
5152
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
5253
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
5354
};
55+
#endif
5456

5557
static int
5658
utf16le_mbc_enc_len(const UChar* p, const OnigUChar* e,

ext/date/date_core.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,23 +1723,6 @@ m_real_year(union DateData *x)
17231723
return ry;
17241724
}
17251725

1726-
1727-
#ifdef USE_PACK
1728-
inline static int
1729-
m_pc(union DateData *x)
1730-
{
1731-
if (simple_dat_p(x)) {
1732-
get_s_civil(x);
1733-
return x->s.pc;
1734-
}
1735-
else {
1736-
get_c_civil(x);
1737-
get_c_time(x);
1738-
return x->c.pc;
1739-
}
1740-
}
1741-
#endif
1742-
17431726
inline static int
17441727
m_mon(union DateData *x)
17451728
{
@@ -1979,12 +1962,6 @@ k_date_p(VALUE x)
19791962
return f_kind_of_p(x, cDate);
19801963
}
19811964

1982-
inline static VALUE
1983-
k_datetime_p(VALUE x)
1984-
{
1985-
return f_kind_of_p(x, cDateTime);
1986-
}
1987-
19881965
inline static VALUE
19891966
k_numeric_p(VALUE x)
19901967
{

ext/dl/cptr.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ static VALUE
389389
rb_dlptr_inspect(VALUE self)
390390
{
391391
struct ptr_data *data;
392-
char str[1024];
393392

394393
TypedData_Get_Struct(self, struct ptr_data, &dlptr_data_type, data);
395394
return rb_sprintf("#<%"PRIsVALUE":%p ptr=%p size=%ld free=%p>",

ext/json/parser/parser.c

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
8989

9090

9191
#line 92 "parser.c"
92-
static const int JSON_object_start = 1;
93-
static const int JSON_object_first_final = 27;
94-
static const int JSON_object_error = 0;
92+
enum {JSON_object_start = 1};
93+
enum {JSON_object_first_final = 27};
94+
enum {JSON_object_error = 0};
9595

96-
static const int JSON_object_en_main = 1;
96+
enum {JSON_object_en_main = 1};
9797

9898

9999
#line 151 "parser.rl"
@@ -467,11 +467,11 @@ case 26:
467467

468468

469469
#line 470 "parser.c"
470-
static const int JSON_value_start = 1;
471-
static const int JSON_value_first_final = 21;
472-
static const int JSON_value_error = 0;
470+
enum {JSON_value_start = 1};
471+
enum {JSON_value_first_final = 21};
472+
enum {JSON_value_error = 0};
473473

474-
static const int JSON_value_en_main = 1;
474+
enum {JSON_value_en_main = 1};
475475

476476

477477
#line 271 "parser.rl"
@@ -776,11 +776,11 @@ case 20:
776776

777777

778778
#line 779 "parser.c"
779-
static const int JSON_integer_start = 1;
780-
static const int JSON_integer_first_final = 3;
781-
static const int JSON_integer_error = 0;
779+
enum {JSON_integer_start = 1};
780+
enum {JSON_integer_first_final = 3};
781+
enum {JSON_integer_error = 0};
782782

783-
static const int JSON_integer_en_main = 1;
783+
enum {JSON_integer_en_main = 1};
784784

785785

786786
#line 295 "parser.rl"
@@ -875,11 +875,11 @@ case 5:
875875

876876

877877
#line 878 "parser.c"
878-
static const int JSON_float_start = 1;
879-
static const int JSON_float_first_final = 8;
880-
static const int JSON_float_error = 0;
878+
enum {JSON_float_start = 1};
879+
enum {JSON_float_first_final = 8};
880+
enum {JSON_float_error = 0};
881881

882-
static const int JSON_float_en_main = 1;
882+
enum {JSON_float_en_main = 1};
883883

884884

885885
#line 329 "parser.rl"
@@ -1041,11 +1041,11 @@ case 7:
10411041

10421042

10431043
#line 1044 "parser.c"
1044-
static const int JSON_array_start = 1;
1045-
static const int JSON_array_first_final = 17;
1046-
static const int JSON_array_error = 0;
1044+
enum {JSON_array_start = 1};
1045+
enum {JSON_array_first_final = 17};
1046+
enum {JSON_array_error = 0};
10471047

1048-
static const int JSON_array_en_main = 1;
1048+
enum {JSON_array_en_main = 1};
10491049

10501050

10511051
#line 381 "parser.rl"
@@ -1373,11 +1373,11 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
13731373

13741374

13751375
#line 1376 "parser.c"
1376-
static const int JSON_string_start = 1;
1377-
static const int JSON_string_first_final = 8;
1378-
static const int JSON_string_error = 0;
1376+
enum {JSON_string_start = 1};
1377+
enum {JSON_string_first_final = 8};
1378+
enum {JSON_string_error = 0};
13791379

1380-
static const int JSON_string_en_main = 1;
1380+
enum {JSON_string_en_main = 1};
13811381

13821382

13831383
#line 494 "parser.rl"
@@ -1730,11 +1730,11 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
17301730

17311731

17321732
#line 1733 "parser.c"
1733-
static const int JSON_start = 1;
1734-
static const int JSON_first_final = 10;
1735-
static const int JSON_error = 0;
1733+
enum {JSON_start = 1};
1734+
enum {JSON_first_final = 10};
1735+
enum {JSON_error = 0};
17361736

1737-
static const int JSON_en_main = 1;
1737+
enum {JSON_en_main = 1};
17381738

17391739

17401740
#line 740 "parser.rl"
@@ -1904,11 +1904,11 @@ case 9:
19041904

19051905

19061906
#line 1907 "parser.c"
1907-
static const int JSON_quirks_mode_start = 1;
1908-
static const int JSON_quirks_mode_first_final = 10;
1909-
static const int JSON_quirks_mode_error = 0;
1907+
enum {JSON_quirks_mode_start = 1};
1908+
enum {JSON_quirks_mode_first_final = 10};
1909+
enum {JSON_quirks_mode_error = 0};
19101910

1911-
static const int JSON_quirks_mode_en_main = 1;
1911+
enum {JSON_quirks_mode_en_main = 1};
19121912

19131913

19141914
#line 778 "parser.rl"

0 commit comments

Comments
 (0)