diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | bignum.c | 4 | ||||
-rw-r--r-- | compile.c | 3 | ||||
-rw-r--r-- | cont.c | 2 | ||||
-rw-r--r-- | dir.c | 3 | ||||
-rw-r--r-- | gc.c | 1 | ||||
-rw-r--r-- | io.c | 11 | ||||
-rw-r--r-- | parse.y | 6 | ||||
-rw-r--r-- | proc.c | 2 | ||||
-rw-r--r-- | process.c | 29 | ||||
-rw-r--r-- | regparse.c | 2 | ||||
-rw-r--r-- | signal.c | 1 | ||||
-rw-r--r-- | vm.c | 6 | ||||
-rw-r--r-- | vm_insnhelper.c | 3 |
14 files changed, 63 insertions, 23 deletions
@@ -1,4 +1,15 @@ -Mon Dec 5 18:50:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> +Mon Dec 5 18:56:55 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * bignum.c (big_rshift), compile.c (validate_label, + iseq_build_from_ary_exception), cont.c (cont_capture), dir.c + (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open) + (rb_io_advise), parse.y (parser_compile_string) + (rb_parser_compile_file), proc.c (binding_free), process.c + (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core) + (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null), + signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main), + vm_insnhelper.c (vm_expandarray): suppress + unused-but-set-variable warnings. * class.c (rb_obj_methods), compile.c (iseq_compile_each), iseq.c(iseq_load, rb_iseq_parameters), pack.c (pack_pack), @@ -3542,9 +3542,10 @@ big_rshift(VALUE x, unsigned long shift) return INT2FIX(-1); } if (!RBIGNUM_SIGN(x)) { - save_x = x = rb_big_clone(x); + x = rb_big_clone(x); get2comp(x); } + save_x = x; xds = BDIGITS(x); i = RBIGNUM_LEN(x); j = i - s1; if (j == 0) { @@ -3564,6 +3565,7 @@ big_rshift(VALUE x, unsigned long shift) if (!RBIGNUM_SIGN(x)) { get2comp(z); } + RB_GC_GUARD(save_x); return z; } @@ -426,6 +426,7 @@ validate_label(st_data_t name, st_data_t label, st_data_t arg) int ret; COMPILE_ERROR((ruby_sourcefile, lobj->position, "%s: undefined label", rb_id2name((ID)name))); + if (ret) break; } while (0); } return ST_CONTINUE; @@ -5264,6 +5265,8 @@ iseq_build_from_ary_exception(rb_iseq_t *iseq, struct st_table *labels_table, lcont = register_label(iseq, labels_table, ptr[4]); sp = NUM2INT(ptr[5]); + (void)sp; + ADD_CATCH_ENTRY(type, lstart, lend, eiseqval, lcont); } return COMPILE_OK; @@ -454,7 +454,7 @@ cont_capture(volatile int *stat) } else { *stat = 0; - return cont->self; + return contval; } } @@ -1832,9 +1832,8 @@ static VALUE dir_open_dir(int argc, VALUE *argv) { VALUE dir = rb_funcall2(rb_cDir, rb_intern("open"), argc, argv); - struct dir_data *dirp; - TypedData_Get_Struct(dir, struct dir_data, &dir_data_type, dirp); + rb_check_typeddata(dir, &dir_data_type); return dir; } @@ -2680,6 +2680,7 @@ objspace_each_objects(VALUE arg) } } } + RB_GC_GUARD(v); return Qnil; } @@ -5353,12 +5353,15 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode, int fd = -1; int write_fd = -1; const char *cmd = 0; +#if !defined(HAVE_FORK) int argc; VALUE *argv; +#endif if (prog) cmd = StringValueCStr(prog); +#if !defined(HAVE_FORK) if (!eargp) { /* fork : IO.popen("-") */ argc = 0; @@ -5374,6 +5377,7 @@ pipe_open(struct rb_exec_arg *eargp, VALUE prog, const char *modestr, int fmode, argc = 0; argv = 0; } +#endif #if defined(HAVE_FORK) arg.execp = eargp; @@ -7859,7 +7863,7 @@ do_io_advise(rb_io_t *fptr, VALUE advice, off_t offset, off_t len) * The platform doesn't support this hint. We don't raise exception, instead * silently ignore it. Because IO::advise is only hint. */ - if (num_adv == Qnil) + if (NIL_P(num_adv)) return Qnil; ias.fd = fptr->fd; @@ -7868,10 +7872,11 @@ do_io_advise(rb_io_t *fptr, VALUE advice, off_t offset, off_t len) ias.len = len; rv = (int)rb_thread_io_blocking_region(io_advise_internal, &ias, fptr->fd); - if (rv) + if (rv) { /* posix_fadvise(2) doesn't set errno. On success it returns 0; otherwise it returns the error code. */ rb_syserr_fail(rv, RSTRING_PTR(fptr->pathv)); + } return Qnil; } @@ -7956,7 +7961,7 @@ rb_io_advise(int argc, VALUE *argv, VALUE io) #ifdef HAVE_POSIX_FADVISE return do_io_advise(fptr, advice, off, l); #else - /* Ignore all hint */ + ((void)off, (void)l); /* Ignore all hint */ return Qnil; #endif } @@ -5300,7 +5300,6 @@ parser_compile_string(volatile VALUE vparser, const char *f, VALUE s, int line) { struct parser_params *parser; NODE *node; - volatile VALUE tmp; TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, parser); lex_gets = lex_get_str; @@ -5310,7 +5309,7 @@ parser_compile_string(volatile VALUE vparser, const char *f, VALUE s, int line) compile_for_eval = rb_parse_in_eval(); node = yycompile(parser, f, line); - tmp = vparser; /* prohibit tail call optimization */ + RB_GC_GUARD(vparser); /* prohibit tail call optimization */ return node; } @@ -5361,7 +5360,6 @@ NODE* rb_parser_compile_file(volatile VALUE vparser, const char *f, VALUE file, int start) { struct parser_params *parser; - volatile VALUE tmp; NODE *node; TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, parser); @@ -5371,7 +5369,7 @@ rb_parser_compile_file(volatile VALUE vparser, const char *f, VALUE file, int st compile_for_eval = rb_parse_in_eval(); node = yycompile(parser, f, start); - tmp = vparser; /* prohibit tail call optimization */ + RB_GC_GUARD(vparser); /* prohibit tail call optimization */ return node; } @@ -243,7 +243,7 @@ binding_free(void *ptr) RUBY_FREE_ENTER("binding"); if (ptr) { bind = ptr; - ruby_xfree(ptr); + ruby_xfree(bind); } RUBY_FREE_LEAVE("binding"); } @@ -1130,7 +1130,7 @@ rb_proc_exec_n(int argc, VALUE *argv, const char *prog) ret = proc_exec_v(args, prog); } ALLOCV_END(v); - return -1; + return ret; } int @@ -5110,11 +5110,15 @@ proc_seteuid_m(VALUE euid) static rb_uid_t rb_seteuid_core(rb_uid_t euid) { +#if defined(HAVE_SETRESUID) || (defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID)) rb_uid_t uid; +#endif check_uid_switch(); +#if defined(HAVE_SETRESUID) || (defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID)) uid = getuid(); +#endif #if defined(HAVE_SETRESUID) if (uid != euid) { @@ -5196,11 +5200,16 @@ proc_getegid(VALUE obj) static VALUE proc_setegid(VALUE obj, VALUE egid) { +#if defined(HAVE_SETRESGID) || defined(HAVE_SETREGID) || defined(HAVE_SETEGID) || defined(HAVE_SETGID) rb_gid_t gid; +#endif check_gid_switch(); +#if defined(HAVE_SETRESGID) || defined(HAVE_SETREGID) || defined(HAVE_SETEGID) || defined(HAVE_SETGID) gid = NUM2GIDT(egid); +#endif + #if defined(HAVE_SETRESGID) if (setresgid(-1, gid, -1) < 0) rb_sys_fail(0); #elif defined HAVE_SETREGID @@ -5230,11 +5239,15 @@ proc_setegid(VALUE obj, VALUE egid) static rb_gid_t rb_setegid_core(rb_gid_t egid) { +#if defined(HAVE_SETRESGID) || (defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID)) rb_gid_t gid; +#endif check_gid_switch(); +#if defined(HAVE_SETRESGID) || (defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID)) gid = getgid(); +#endif #if defined(HAVE_SETRESGID) if (gid != egid) { @@ -5321,12 +5334,17 @@ p_uid_exchangeable(void) static VALUE p_uid_exchange(VALUE obj) { - rb_uid_t uid, euid; + rb_uid_t uid; +#if defined(HAVE_SETRESUID) || (defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID)) + rb_uid_t euid; +#endif check_uid_switch(); uid = getuid(); +#if defined(HAVE_SETRESUID) || (defined(HAVE_SETREUID) && !defined(OBSOLETE_SETREUID)) euid = geteuid(); +#endif #if defined(HAVE_SETRESUID) if (setresuid(euid, uid, uid) < 0) rb_sys_fail(0); @@ -5378,12 +5396,17 @@ p_gid_exchangeable(void) static VALUE p_gid_exchange(VALUE obj) { - rb_gid_t gid, egid; + rb_gid_t gid; +#if defined(HAVE_SETRESGID) || (defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID)) + rb_gid_t egid; +#endif check_gid_switch(); gid = getgid(); +#if defined(HAVE_SETRESGID) || (defined(HAVE_SETREGID) && !defined(OBSOLETE_SETREGID)) egid = getegid(); +#endif #if defined(HAVE_SETRESGID) if (setresgid(egid, gid, gid) < 0) rb_sys_fail(0); diff --git a/regparse.c b/regparse.c index b3f34b03f2..770b641229 100644 --- a/regparse.c +++ b/regparse.c @@ -258,7 +258,7 @@ strdup_with_null(OnigEncoding enc, UChar* s, UChar* end) /* scan pattern methods */ #define PEND_VALUE 0 -#define PFETCH_READY UChar* pfetch_prev +#define PFETCH_READY UChar* pfetch_prev = pfetch_prev #define PEND (p < end ? 0 : 1) #define PUNFETCH p = pfetch_prev #define PINC do { \ @@ -785,6 +785,7 @@ sig_dfl: else { rb_proc_t *proc; GetProcPtr(*cmd, proc); + (void)proc; } } @@ -1440,12 +1440,11 @@ rb_iseq_eval(VALUE iseqval) { rb_thread_t *th = GET_THREAD(); VALUE val; - volatile VALUE tmp; vm_set_top_stack(th, iseqval); val = vm_exec(th); - tmp = iseqval; /* prohibit tail call optimization */ + RB_GC_GUARD(iseqval); /* prohibit tail call optimization */ return val; } @@ -1454,12 +1453,11 @@ rb_iseq_eval_main(VALUE iseqval) { rb_thread_t *th = GET_THREAD(); VALUE val; - volatile VALUE tmp; vm_set_main_stack(th, iseqval); val = vm_exec(th); - tmp = iseqval; /* prohibit tail call optimization */ + RB_GC_GUARD(iseqval); /* prohibit tail call optimization */ return val; } diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 798aaa69d1..29aee1d3d2 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1652,7 +1652,6 @@ vm_expandarray(rb_control_frame_t *cfp, VALUE ary, rb_num_t num, int flag) int is_splat = flag & 0x01; rb_num_t space_size = num + is_splat; VALUE *base = cfp->sp, *ptr; - volatile VALUE tmp_ary; rb_num_t len; if (!RB_TYPE_P(ary, T_ARRAY)) { @@ -1661,7 +1660,6 @@ vm_expandarray(rb_control_frame_t *cfp, VALUE ary, rb_num_t num, int flag) cfp->sp += space_size; - tmp_ary = ary; ptr = RARRAY_PTR(ary); len = (rb_num_t)RARRAY_LEN(ary); @@ -1705,6 +1703,7 @@ vm_expandarray(rb_control_frame_t *cfp, VALUE ary, rb_num_t num, int flag) } } } + RB_GC_GUARD(ary); } static inline int |