summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-24 18:33:50 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-24 18:33:50 +0000
commit5dd2b7102c42cd31a0fec424addbdeaeefb235ac (patch)
treec04ed9798be30923eec668e9deed5f377e67b02d
parentc9aad4c098193cad0440228595c85aadc44bebe5 (diff)
* gcc -Wall clean-up.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--array.c2
-rw-r--r--bignum.c3
-rw-r--r--dln.c2
-rw-r--r--eval.c10
-rw-r--r--ext/etc/etc.c4
-rw-r--r--ext/tcltklib/tcltklib.c2
-rw-r--r--file.c2
-rw-r--r--gc.c9
-rw-r--r--hash.c3
-rw-r--r--io.c1
-rw-r--r--lib/debug.rb2
-rw-r--r--object.c1
-rw-r--r--process.c4
-rw-r--r--range.c23
-rw-r--r--regex.c1
-rw-r--r--time.c1
-rw-r--r--variable.c4
17 files changed, 15 insertions, 59 deletions
diff --git a/array.c b/array.c
index 3687772fc3..b05ae3377f 100644
--- a/array.c
+++ b/array.c
@@ -1458,7 +1458,7 @@ rb_ary_transpose(ary)
VALUE ary;
{
long elen = -1, alen, i, j;
- VALUE tmp, result;
+ VALUE tmp, result = 0;
alen = RARRAY(ary)->len;
if (alen == 0) return rb_ary_dup(ary);
diff --git a/bignum.c b/bignum.c
index a908a5c78a..550dcfcafe 100644
--- a/bignum.c
+++ b/bignum.c
@@ -314,7 +314,8 @@ rb_cstr_to_inum(str, base, badcheck)
{
const char *s = str;
char *end;
- char sign = 1, c, nondigit = 0;
+ char sign = 1, nondigit = 0;
+ int c;
BDIGIT_DBL num;
long len, blen = 1;
long i;
diff --git a/dln.c b/dln.c
index 267b9f64e8..08cdbdc191 100644
--- a/dln.c
+++ b/dln.c
@@ -31,7 +31,7 @@ char *dln_argv0;
#pragma alloca
#endif
-#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
+#if defined(HAVE_ALLOCA_H)
#include <alloca.h>
#endif
diff --git a/eval.c b/eval.c
index ed3815ba6f..8e757ea764 100644
--- a/eval.c
+++ b/eval.c
@@ -4538,7 +4538,7 @@ rb_rescue(b_proc, data1, r_proc, data2)
VALUE (*b_proc)(), (*r_proc)();
VALUE data1, data2;
{
- return rb_rescue2(b_proc, data1, r_proc, data2, rb_eStandardError, 0);
+ return rb_rescue2(b_proc, data1, r_proc, data2, rb_eStandardError, (VALUE)0);
}
VALUE
@@ -7376,13 +7376,6 @@ method_unbind(obj)
}
static VALUE
-umethod_unbind(obj)
- VALUE obj;
-{
- return obj;
-}
-
-static VALUE
rb_obj_method(obj, vid)
VALUE obj;
VALUE vid;
@@ -9937,7 +9930,6 @@ thgroup_enclose(group)
VALUE group;
{
struct thgroup *data;
- rb_thread_t th;
Data_Get_Struct(group, struct thgroup, data);
data->enclosed = 1;
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index ea8cb61802..3636b5480d 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -316,11 +316,11 @@ Init_etc()
#ifdef HAVE_ST_PW_EXPIRE
"expire",
#endif
- 0);
+ NULL);
rb_global_variable(&sPasswd);
#ifdef HAVE_GETGRENT
- sGroup = rb_struct_define("Group", "name", "passwd", "gid", "mem", 0);
+ sGroup = rb_struct_define("Group", "name", "passwd", "gid", "mem", NULL);
rb_global_variable(&sGroup);
#endif
}
diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c
index 8393bf0746..5331e1fd03 100644
--- a/ext/tcltklib/tcltklib.c
+++ b/ext/tcltklib/tcltklib.c
@@ -532,7 +532,7 @@ ip_ruby(clientData, interp, argc, argv)
rb_trap_immediate = 0;
res = rb_rescue2(rb_eval_string, (VALUE)arg,
ip_eval_rescue, (VALUE)&failed,
- rb_eStandardError, rb_eScriptError, 0);
+ rb_eStandardError, rb_eScriptError, (VALUE)0);
rb_trap_immediate = old_trapflg;
Tcl_ResetResult(interp);
diff --git a/file.c b/file.c
index f5fb2311d0..578f4d67c5 100644
--- a/file.c
+++ b/file.c
@@ -1234,7 +1234,7 @@ rb_file_s_utime(argc, argv)
#endif
-NORETURN(static void syserr2 _((VALUE,VALUE)));
+NORETURN(static void sys_fail2 _((VALUE,VALUE)));
static void
sys_fail2(s1, s2)
VALUE s1, s2;
diff --git a/gc.c b/gc.c
index deb7905b80..b4875c8c86 100644
--- a/gc.c
+++ b/gc.c
@@ -899,15 +899,6 @@ rb_gc_mark_children(ptr)
static void obj_free _((VALUE));
-static unsigned long
-size_of_table(tbl)
- struct st_table *tbl;
-{
- if (!tbl) return 0;
- return tbl->num_bins * sizeof(struct st_table_entry *) +
- tbl->num_entries * 4 * sizeof(VALUE);
-}
-
static void
gc_sweep()
{
diff --git a/hash.c b/hash.c
index bdb206ff56..2dc7b290d8 100644
--- a/hash.c
+++ b/hash.c
@@ -528,7 +528,6 @@ rb_hash_select(argc, argv, hash)
VALUE hash;
{
VALUE result;
- long i;
if (!rb_block_given_p()) {
#if RUBY_VERSION_CODE < 181
@@ -1424,7 +1423,6 @@ env_select(argc, argv)
VALUE *argv;
{
VALUE result;
- long i;
char **env;
if (!rb_block_given_p()) {
@@ -1853,6 +1851,7 @@ Init_Hash()
rb_define_singleton_method(envtbl,"inspect", env_inspect, 0);
rb_define_singleton_method(envtbl,"rehash", env_none, 0);
rb_define_singleton_method(envtbl,"to_a", env_to_a, 0);
+ rb_define_singleton_method(envtbl,"to_s", env_to_s, 0);
rb_define_singleton_method(envtbl,"index", env_index, 1);
rb_define_singleton_method(envtbl,"indexes", env_indexes, -1);
rb_define_singleton_method(envtbl,"indices", env_indexes, -1);
diff --git a/io.c b/io.c
index a3b7fa78af..681ba97ec3 100644
--- a/io.c
+++ b/io.c
@@ -96,7 +96,6 @@ VALUE rb_eIOError;
VALUE rb_stdin, rb_stdout, rb_stderr, rb_defout, rb_deferr;
static VALUE orig_stdin, orig_stdout, orig_stderr;
-static int saved_fd[3] = {0, 1, 2};
VALUE rb_output_fs;
VALUE rb_rs;
diff --git a/lib/debug.rb b/lib/debug.rb
index 17879e5145..74026233c7 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -703,7 +703,7 @@ EOHELP
frame_set_pos(file, line)
if !@no_step or @frames.size == @no_step
@stop_next -= 1
- @stop_next = 0 if @stop_next < 0
+ @stop_next = -1 if @stop_next < 0
elsif @frames.size < @no_step
@stop_next = 0 # break here before leaving...
else
diff --git a/object.c b/object.c
index ea79607170..712c8b7581 100644
--- a/object.c
+++ b/object.c
@@ -656,7 +656,6 @@ static VALUE
rb_mod_cmp(mod, arg)
VALUE mod, arg;
{
- VALUE start = mod;
VALUE cmp;
if (mod == arg) return INT2FIX(0);
diff --git a/process.c b/process.c
index 7e44e7a501..15ba3e3a1f 100644
--- a/process.c
+++ b/process.c
@@ -2227,7 +2227,7 @@ Init_process()
rb_define_module_function(rb_mProcess, "times", rb_proc_times, 0);
#if defined(HAVE_TIMES) || defined(_WIN32)
- S_Tms = rb_struct_define("Tms", "utime", "stime", "cutime", "cstime", 0);
+ S_Tms = rb_struct_define("Tms", "utime", "stime", "cutime", "cstime", NULL);
#endif
SAVED_USER_ID = geteuid();
@@ -2261,7 +2261,7 @@ Init_process()
rb_define_module_function(rb_mProcGID, "sid_available?",
p_gid_have_saved_id, 0);
rb_define_module_function(rb_mProcUID, "switch", p_uid_switch, 0);
- rb_define_module_function(rb_mProcGID, "switch", p_uid_switch, 0);
+ rb_define_module_function(rb_mProcGID, "switch", p_gid_switch, 0);
rb_mProcID_Syscall = rb_define_module_under(rb_mProcess, "Sys");
diff --git a/range.c b/range.c
index 9a73c867a1..a7f553be57 100644
--- a/range.c
+++ b/range.c
@@ -109,17 +109,6 @@ range_eq(range, obj)
}
static int
-r_eq(a, b)
- VALUE a, b;
-{
- if (a == b) return Qtrue;
-
- if (rb_funcall(a, id_cmp, 1, b) == INT2FIX(0))
- return Qtrue;
- return Qfalse;
-}
-
-static int
r_lt(a, b)
VALUE a, b;
{
@@ -142,17 +131,6 @@ r_le(a, b)
}
-static int
-r_gt(a,b)
- VALUE a, b;
-{
- VALUE r = rb_funcall(a, id_cmp, 1, b);
-
- if (NIL_P(r)) return Qfalse;
- if (rb_cmpint(r, a, b) > 0) return Qtrue;
- return Qfalse;
-}
-
static VALUE
range_eql(range, obj)
VALUE range, obj;
@@ -383,7 +361,6 @@ rb_range_beg_len(range, begp, lenp, len, err)
len = end - beg;
if (len < 0) goto out_of_range;
- length_set:
*begp = beg;
*lenp = len;
return Qtrue;
diff --git a/regex.c b/regex.c
index a70edbbbd0..6aff60cd9e 100644
--- a/regex.c
+++ b/regex.c
@@ -185,6 +185,7 @@ static int current_mbctype = MBCTYPE_ASCII;
#ifdef RUBY
#include "util.h"
+void rb_warn _((char*));
# define re_warning(x) rb_warn(x)
#endif
diff --git a/time.c b/time.c
index 34b909c16a..af4a37e0e4 100644
--- a/time.c
+++ b/time.c
@@ -702,7 +702,6 @@ time_cmp(time1, time2)
VALUE time1, time2;
{
struct time_object *tobj1, *tobj2;
- long i;
GetTimeval(time1, tobj1);
if (TYPE(time2) == T_DATA && RDATA(time2)->dfree == time_free) {
diff --git a/variable.c b/variable.c
index 76c0939c46..63a1461b62 100644
--- a/variable.c
+++ b/variable.c
@@ -1136,8 +1136,6 @@ static struct st_table *
check_autoload_table(av)
VALUE av;
{
- struct st_table *tbl;
-
Check_Type(av, T_DATA);
if (RDATA(av)->dmark != (RUBY_DATA_FUNC)rb_mark_tbl ||
RDATA(av)->dfree != (RUBY_DATA_FUNC)st_free_table) {
@@ -1210,7 +1208,7 @@ rb_autoload_load(klass, id)
VALUE klass;
ID id;
{
- VALUE file, value;
+ VALUE file;
file = autoload_delete(klass, id);
if (NIL_P(file)) {