* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-12-05 09:57:00 +00:00
Родитель 8baffe6ef6
Коммит b526738c3b
14 изменённых файлов: 63 добавлений и 23 удалений

Просмотреть файл

@ -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;

2
cont.c
Просмотреть файл

@ -454,7 +454,7 @@ cont_capture(volatile int *stat)
}
else {
*stat = 0;
return cont->self;
return contval;
}
}

3
dir.c
Просмотреть файл

@ -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;
}

1
gc.c
Просмотреть файл

@ -2680,6 +2680,7 @@ objspace_each_objects(VALUE arg)
}
}
}
RB_GC_GUARD(v);
return Qnil;
}

11
io.c
Просмотреть файл

@ -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;
}

2
proc.c
Просмотреть файл

@ -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);

Просмотреть файл

@ -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;
}
}

6
vm.c
Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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