ruby-changes:21902
From: nobu <ko1@a...>
Date: Mon, 5 Dec 2011 18:57:26 +0900 (JST)
Subject: [ruby-changes:21902] nobu:r33951 (trunk): * bignum.c (big_rshift), compile.c (validate_label,
nobu 2011-12-05 18:57:00 +0900 (Mon, 05 Dec 2011) New Revision: 33951 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33951 Log: * 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. Modified files: trunk/ChangeLog trunk/bignum.c trunk/compile.c trunk/cont.c trunk/dir.c trunk/gc.c trunk/io.c trunk/parse.y trunk/proc.c trunk/process.c trunk/regparse.c trunk/signal.c trunk/vm.c trunk/vm_insnhelper.c Index: regparse.c =================================================================== --- regparse.c (revision 33950) +++ regparse.c (revision 33951) @@ -258,7 +258,7 @@ /* 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 { \ Index: ChangeLog =================================================================== --- ChangeLog (revision 33950) +++ ChangeLog (revision 33951) @@ -1,5 +1,16 @@ -Mon Dec 5 18:50:08 2011 Nobuyoshi Nakada <nobu@r...> +Mon Dec 5 18:56:55 2011 Nobuyoshi Nakada <nobu@r...> + * 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), regcomp.c (is_not_included, update_string_node_case_fold), Index: io.c =================================================================== --- io.c (revision 33950) +++ io.c (revision 33951) @@ -5353,12 +5353,15 @@ 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 @@ argc = 0; argv = 0; } +#endif #if defined(HAVE_FORK) arg.execp = eargp; @@ -7859,7 +7863,7 @@ * 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 @@ 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 @@ #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 } Index: compile.c =================================================================== --- compile.c (revision 33950) +++ compile.c (revision 33951) @@ -426,6 +426,7 @@ 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 @@ 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; Index: proc.c =================================================================== --- proc.c (revision 33950) +++ proc.c (revision 33951) @@ -243,7 +243,7 @@ RUBY_FREE_ENTER("binding"); if (ptr) { bind = ptr; - ruby_xfree(ptr); + ruby_xfree(bind); } RUBY_FREE_LEAVE("binding"); } Index: dir.c =================================================================== --- dir.c (revision 33950) +++ dir.c (revision 33951) @@ -1832,9 +1832,8 @@ 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; } Index: gc.c =================================================================== --- gc.c (revision 33950) +++ gc.c (revision 33951) @@ -2680,6 +2680,7 @@ } } } + RB_GC_GUARD(v); return Qnil; } Index: parse.y =================================================================== --- parse.y (revision 33950) +++ parse.y (revision 33951) @@ -5300,7 +5300,6 @@ { 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 @@ 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 @@ 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 @@ 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; } Index: process.c =================================================================== --- process.c (revision 33950) +++ process.c (revision 33951) @@ -1130,7 +1130,7 @@ ret = proc_exec_v(args, prog); } ALLOCV_END(v); - return -1; + return ret; } int @@ -5110,11 +5110,15 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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); Index: cont.c =================================================================== --- cont.c (revision 33950) +++ cont.c (revision 33951) @@ -454,7 +454,7 @@ } else { *stat = 0; - return cont->self; + return contval; } } Index: vm.c =================================================================== --- vm.c (revision 33950) +++ vm.c (revision 33951) @@ -1440,12 +1440,11 @@ { 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_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; } Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 33950) +++ vm_insnhelper.c (revision 33951) @@ -1652,7 +1652,6 @@ 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 @@ cfp->sp += space_size; - tmp_ary = ary; ptr = RARRAY_PTR(ary); len = (rb_num_t)RARRAY_LEN(ary); @@ -1705,6 +1703,7 @@ } } } + RB_GC_GUARD(ary); } static inline int Index: bignum.c =================================================================== --- bignum.c (revision 33950) +++ bignum.c (revision 33951) @@ -3542,9 +3542,10 @@ 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 @@ if (!RBIGNUM_SIGN(x)) { get2comp(z); } + RB_GC_GUARD(save_x); return z; } Index: signal.c =================================================================== --- signal.c (revision 33950) +++ signal.c (revision 33951) @@ -785,6 +785,7 @@ else { rb_proc_t *proc; GetProcPtr(*cmd, proc); + (void)proc; } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/