From 08133b13443ea261101a54215931b29fe8de7d1d Mon Sep 17 00:00:00 2001 From: ocean Date: Tue, 28 Jun 2005 13:08:32 +0000 Subject: [PATCH] * dir.c, eval.c, parse.y, process.c, ruby.c: avoid warning "unused variable" [ruby-dev:26387] * dir.c (glob_helper): avoid warning "enumeration value `RECURSIVE' not handled in switch" [ruby-dev:26392] (patch from Kazuhiro NISHIYAMA) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ bignum.c | 1 - dir.c | 6 ++---- eval.c | 15 +++++---------- parse.y | 2 -- process.c | 12 +++++++++--- ruby.c | 2 ++ 7 files changed, 26 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23f1a673a8..29f42ccd54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue Jun 28 21:59:29 2005 Kazuhiro NISHIYAMA + + * dir.c, eval.c, parse.y, process.c, ruby.c: avoid warning "unused + variable" [ruby-dev:26387] + + * dir.c (glob_helper): avoid warning "enumeration value `RECURSIVE' + not handled in switch" [ruby-dev:26392] + Tue Jun 28 01:52:00 2005 NARUSE, Yui * ext/nkf/lib/kconv.rb: add Kconv::VERSION diff --git a/bignum.c b/bignum.c index d15e42f083..ce382ce8a4 100644 --- a/bignum.c +++ b/bignum.c @@ -1057,7 +1057,6 @@ rb_big_neg(x) VALUE z = rb_big_clone(x); long i = RBIGNUM(x)->len; BDIGIT *ds = BDIGITS(z); - int nz = 0; if (!RBIGNUM(x)->sign) get2comp(z, Qtrue); while (i--) { diff --git a/dir.c b/dir.c index bd9ea02a50..432e0da2f0 100644 --- a/dir.c +++ b/dir.c @@ -1220,6 +1220,8 @@ glob_helper(path, dirsep, exist, isdir, beg, end, flags, func, arg) case MATCH_DIR: match_dir = 1; break; + case RECURSIVE: + rb_bug("continuous RECURSIVEs"); } } @@ -1234,7 +1236,6 @@ glob_helper(path, dirsep, exist, isdir, beg, end, flags, func, arg) isdir = NO; } } - if (match_dir && isdir == UNKNOWN) { if (do_stat(path, &st) == 0) { exist = YES; @@ -1245,12 +1246,10 @@ glob_helper(path, dirsep, exist, isdir, beg, end, flags, func, arg) isdir = NO; } } - if (match_all && exist == YES) { status = glob_call_func(func, path, arg); if (status) return status; } - if (match_dir && isdir == YES) { char *tmp = join_path(path, dirsep, ""); status = glob_call_func(func, tmp, arg); @@ -1612,7 +1611,6 @@ static VALUE dir_open_dir(path) VALUE path; { - struct dir_data *dp; VALUE dir = rb_funcall(rb_cDir, rb_intern("open"), 1, path); if (TYPE(dir) != T_DATA || diff --git a/eval.c b/eval.c index 27bcca2eaa..cf7a2be254 100644 --- a/eval.c +++ b/eval.c @@ -1569,8 +1569,6 @@ ruby_cleanup(ex) extern NODE *ruby_eval_tree; -static void cont_call _((VALUE)); - static int ruby_exec_internal() { @@ -1583,11 +1581,6 @@ ruby_exec_internal() if ((state = EXEC_TAG()) == 0) { eval_node(ruby_top_self, ruby_eval_tree); } -#if 0 - else if (state == TAG_CONTCALL) { - cont_call(prot_tag->retval); - } -#endif else if (state == TAG_THREAD) { rb_thread_start_1(); } @@ -6092,7 +6085,7 @@ rb_call_super(argc, argv) int argc; const VALUE *argv; { - VALUE result, self, klass, k; + VALUE result, self, klass; if (ruby_frame->this_class == 0) { rb_name_error(ruby_frame->callee, "calling `super' from `%s' is prohibited", @@ -8743,7 +8736,6 @@ rb_block_pass(func, arg, proc) VALUE proc; { VALUE b; - struct BLOCK * volatile old_block; struct BLOCK _block; struct BLOCK *data; volatile VALUE result = Qnil; @@ -11041,7 +11033,9 @@ rb_thread_select(max, read, write, except, timeout) fd_set *read, *write, *except; struct timeval *timeout; { +#ifndef linux double limit; +#endif int n; if (!read && !write && !except) { @@ -11053,10 +11047,12 @@ rb_thread_select(max, read, write, except, timeout) return 0; } +#ifndef linux if (timeout) { limit = timeofday()+ (double)timeout->tv_sec+(double)timeout->tv_usec*1e-6; } +#endif if (rb_thread_critical || curr_thread == curr_thread->next || @@ -13099,7 +13095,6 @@ thgroup_add(group, thread) /* variables for recursive traversals */ static ID recursive_key; -static VALUE recursive_tbl; /* diff --git a/parse.y b/parse.y index 0a193cbe57..ee0444d7da 100644 --- a/parse.y +++ b/parse.y @@ -48,8 +48,6 @@ ((id)&ID_SCOPE_MASK) == ID_INSTANCE || \ ((id)&ID_SCOPE_MASK) == ID_CLASS)) -static int is_valid_lvar _((ID id)); - #ifndef RIPPER char *ruby_sourcefile; /* current source file */ int ruby_sourceline; /* current line no. */ diff --git a/process.c b/process.c index faa39d7a22..12ae0902c3 100644 --- a/process.c +++ b/process.c @@ -1046,8 +1046,8 @@ rb_proc_exec(str) if (nl) s = nl; } if (*s != ' ' && !ISALPHA(*s) && strchr("*?{}[]<>()~&|\\$;'`\"\n",*s)) { - int status; #if defined(MSDOS) + int status; before_exec(); status = system(str); after_exec(); @@ -1055,7 +1055,7 @@ rb_proc_exec(str) exit(status); #elif defined(__human68k__) || defined(__CYGWIN32__) || defined(__EMX__) char *shell = dln_find_exe("sh", 0); - status = -1; + int status = -1; before_exec(); if (shell) execl(shell, "sh", "-c", str, (char *) NULL); @@ -1532,7 +1532,13 @@ rb_syswait(pid) int pid; { static int overriding; - RETSIGTYPE (*hfunc)_((int)), (*qfunc)_((int)), (*ifunc)_((int)); +#ifdef SIGHUP + RETSIGTYPE (*hfunc)_((int)); +#endif +#ifdef SIGQUIT + RETSIGTYPE (*qfunc)_((int)); +#endif + RETSIGTYPE (*ifunc)_((int)); int status; int i, hooked = Qfalse; diff --git a/ruby.c b/ruby.c index 81e4b20b63..2bf8e75f4d 100644 --- a/ruby.c +++ b/ruby.c @@ -1045,7 +1045,9 @@ set_arg0(val, id) { char *s; long i; +#if !defined(PSTAT_SETCMD) && !defined(HAVE_SETPROCTITLE) static int len; +#endif if (origargv == 0) rb_raise(rb_eRuntimeError, "$0 not initialized"); StringValue(val);