[ruby-dev:26389] Re: warningを減らす
From:
Kazuhiro NISHIYAMA <zn@...>
Date:
2005-06-27 11:25:30 UTC
List:
ruby-dev #26389
西山和広です。
幹の方もやってみました。
time.cのgmtの未初期化は古いrubyの挙動(Marshalでutcフラグが
保存されなくてMarshal.loadするとlocaltimeになる)にあわせて
0にするようにしてみました。
Index: bignum.c
===================================================================
RCS file: /src/ruby/bignum.c,v
retrieving revision 1.113
diff -u -p -r1.113 bignum.c
--- bignum.c 8 Jun 2005 03:30:56 -0000 1.113
+++ bignum.c 27 Jun 2005 11:21:59 -0000
@@ -456,7 +456,7 @@ rb_cstr_to_inum(str, base, badcheck)
z = bignew(len, sign);
zds = BDIGITS(z);
for (i=len;i--;) zds[i]=0;
- while (c = *str++) {
+ while ((c = *str++)) {
if (c == '_') {
if (badcheck) {
if (nondigit) goto bad;
@@ -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--) {
Index: dir.c
===================================================================
RCS file: /src/ruby/dir.c,v
retrieving revision 1.140
diff -u -p -r1.140 dir.c
--- dir.c 18 May 2005 08:41:50 -0000 1.140
+++ dir.c 27 Jun 2005 11:21:59 -0000
@@ -259,7 +259,7 @@ fnmatch_helper(pcur, scur, flags)
const char *t;
if (ISEND(s))
RETURN(FNM_NOMATCH);
- if (t = bracket(p + 1, s, flags)) {
+ if ((t = bracket(p + 1, s, flags))) {
p = t;
Inc(s);
continue;
@@ -966,7 +966,7 @@ has_magic(s, flags)
register const char *p = s;
register char c;
- while (c = *p++) {
+ while ((c = *p++)) {
switch (c) {
case '*':
case '?':
@@ -997,7 +997,7 @@ find_dirsep(s, flags)
register char c;
int open = 0;
- while (c = *p++) {
+ while ((c = *p++)) {
switch (c) {
case '[':
open = 1;
@@ -1220,6 +1220,8 @@ glob_helper(path, dirsep, exist, isdir,
case MATCH_DIR:
match_dir = 1;
break;
+ case RECURSIVE:
+ /* FIXME: ignore? bug? */;
}
}
@@ -1612,7 +1614,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 ||
Index: eval.c
===================================================================
RCS file: /src/ruby/eval.c,v
retrieving revision 1.791
diff -u -p -r1.791 eval.c
--- eval.c 20 Jun 2005 09:59:58 -0000 1.791
+++ eval.c 27 Jun 2005 11:21:59 -0000
@@ -1254,7 +1254,7 @@ error_print()
long len = elen;
if (RSTRING(epath)->ptr[0] == '#') epath = 0;
- if (tail = memchr(einfo, '\n', elen)) {
+ if ((tail = memchr(einfo, '\n', elen))) {
len = tail - einfo;
tail++; /* skip newline */
}
@@ -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();
}
@@ -5338,7 +5331,7 @@ rb_rescue2(b_proc, data1, r_proc, data2,
VALUE eclass;
va_init_list(args, data2);
- while (eclass = va_arg(args, VALUE)) {
+ while ((eclass = va_arg(args, VALUE))) {
if (rb_obj_is_kind_of(ruby_errinfo, eclass)) {
handle = Qtrue;
break;
@@ -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",
@@ -6955,7 +6948,7 @@ search_required(fname, path)
if (ext && !strchr(ext, '/')) {
if (strcmp(".rb", ext) == 0) {
if (rb_feature_p(ftptr, ext, Qtrue)) return 'r';
- if (tmp = rb_find_file(fname)) {
+ if ((tmp = rb_find_file(fname))) {
tmp = rb_file_expand_path(tmp, Qnil);
ext = strrchr(ftptr = RSTRING(tmp)->ptr, '.');
if (!rb_feature_p(ftptr, ext, Qtrue))
@@ -6979,7 +6972,7 @@ search_required(fname, path)
#else
rb_str_cat2(tmp, DLEXT);
OBJ_FREEZE(tmp);
- if (tmp = rb_find_file(tmp)) {
+ if ((tmp = rb_find_file(tmp))) {
tmp = rb_file_expand_path(tmp, Qnil);
ext = strrchr(ftptr = RSTRING(tmp)->ptr, '.');
if (!rb_feature_p(ftptr, ext, Qfalse))
@@ -6990,7 +6983,7 @@ search_required(fname, path)
}
else if (IS_DLEXT(ext)) {
if (rb_feature_p(ftptr, ext, Qfalse)) return 's';
- if (tmp = rb_find_file(fname)) {
+ if ((tmp = rb_find_file(fname))) {
tmp = rb_file_expand_path(tmp, Qnil);
ext = strrchr(ftptr = RSTRING(tmp)->ptr, '.');
if (!rb_feature_p(ftptr, ext, Qfalse))
@@ -6999,7 +6992,7 @@ search_required(fname, path)
}
}
}
- else if (ext = rb_feature_p(ftptr, 0, Qfalse)) {
+ else if ((ext = rb_feature_p(ftptr, 0, Qfalse))) {
return (*ext && (IS_SOEXT(ext) || IS_DLEXT(ext))) ? 's' : 'r';
}
tmp = fname;
@@ -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, excep
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, excep
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;
/*
Index: marshal.c
===================================================================
RCS file: /src/ruby/marshal.c,v
retrieving revision 1.120
diff -u -p -r1.120 marshal.c
--- marshal.c 4 Mar 2005 06:47:42 -0000 1.120
+++ marshal.c 27 Jun 2005 11:21:59 -0000
@@ -374,7 +374,7 @@ w_extended(klass, arg, check)
char *path;
if (FL_TEST(klass, FL_SINGLETON)) {
- if (check && RCLASS(klass)->m_tbl->num_entries ||
+ if ((check && RCLASS(klass)->m_tbl->num_entries) ||
(RCLASS(klass)->iv_tbl && RCLASS(klass)->iv_tbl->num_entries > 1)) {
rb_raise(rb_eTypeError, "singleton can't be dumped");
}
@@ -468,7 +468,7 @@ w_object(obj, arg, limit)
return;
}
- if (ivtbl = rb_generic_ivar_table(obj)) {
+ if ((ivtbl = rb_generic_ivar_table(obj))) {
w_byte(TYPE_IVAR, arg);
}
if (obj == Qnil) {
Index: numeric.c
===================================================================
RCS file: /src/ruby/numeric.c,v
retrieving revision 1.120
diff -u -p -r1.120 numeric.c
--- numeric.c 24 May 2005 15:24:23 -0000 1.120
+++ numeric.c 27 Jun 2005 11:21:59 -0000
@@ -1517,7 +1517,7 @@ rb_num2long(val)
char *s;
sprintf(buf, "%-.10g", RFLOAT(val)->value);
- if (s = strchr(buf, ' ')) *s = '\0';
+ if ((s = strchr(buf, ' '))) *s = '\0';
rb_raise(rb_eRangeError, "float %s out of range of integer", buf);
}
@@ -1668,7 +1668,7 @@ rb_num2ll(val)
char *s;
sprintf(buf, "%-.10g", RFLOAT(val)->value);
- if (s = strchr(buf, ' ')) *s = '\0';
+ if ((s = strchr(buf, ' '))) *s = '\0';
rb_raise(rb_eRangeError, "float %s out of range of long long", buf);
}
Index: parse.y
===================================================================
RCS file: /src/ruby/parse.y,v
retrieving revision 1.387
diff -u -p -r1.387 parse.y
--- parse.y 12 Jun 2005 16:56:05 -0000 1.387
+++ parse.y 27 Jun 2005 11:21:59 -0000
@@ -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. */
Index: process.c
===================================================================
RCS file: /src/ruby/process.c,v
retrieving revision 1.131
diff -u -p -r1.131 process.c
--- process.c 16 May 2005 13:42:59 -0000 1.131
+++ process.c 27 Jun 2005 11:21:59 -0000
@@ -1046,14 +1046,15 @@ 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();
if (status != -1)
exit(status);
#elif defined(__human68k__) || defined(__CYGWIN32__) || defined(__EMX__)
+ int status;
char *shell = dln_find_exe("sh", 0);
status = -1;
before_exec();
@@ -1076,8 +1077,8 @@ rb_proc_exec(str)
ss = ALLOCA_N(char, s-str+1);
memcpy(ss, str, s-str);
ss[s-str] = '\0';
- if (*a++ = strtok(ss, " \t")) {
- while (t = strtok(NULL, " \t")) {
+ if ((*a++ = strtok(ss, " \t"))) {
+ while ((t = strtok(NULL, " \t"))) {
*a++ = t;
}
*a = NULL;
@@ -1532,7 +1533,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;
Index: re.c
===================================================================
RCS file: /src/ruby/re.c,v
retrieving revision 1.141
diff -u -p -r1.141 re.c
--- re.c 23 May 2005 03:23:25 -0000 1.141
+++ re.c 27 Jun 2005 11:21:59 -0000
@@ -83,7 +83,7 @@ rb_memcicmp(p1, p2, len)
int tmp;
while (len--) {
- if (tmp = casetable[(unsigned)*p1++] - casetable[(unsigned)*p2++])
+ if ((tmp = casetable[(unsigned)*p1++] - casetable[(unsigned)*p2++]))
return tmp;
}
return 0;
Index: regparse.c
===================================================================
RCS file: /src/ruby/regparse.c,v
retrieving revision 1.17
diff -u -p -r1.17 regparse.c
--- regparse.c 24 Apr 2005 16:23:15 -0000 1.17
+++ regparse.c 27 Jun 2005 11:21:59 -0000
@@ -3254,13 +3254,17 @@ fetch_token(OnigToken* tok, UChar** src,
switch (c) {
case '.':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_DOT_ANYCHAR)) break;
+#ifdef USE_VARIABLE_META_CHARS
any_char:
+#endif
tok->type = TK_ANYCHAR;
break;
case '*':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ASTERISK_ZERO_INF)) break;
+#ifdef USE_VARIABLE_META_CHARS
anytime:
+#endif
tok->type = TK_OP_REPEAT;
tok->u.repeat.lower = 0;
tok->u.repeat.upper = REPEAT_INFINITE;
@@ -3269,7 +3273,9 @@ fetch_token(OnigToken* tok, UChar** src,
case '+':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_PLUS_ONE_INF)) break;
+#ifdef USE_VARIABLE_META_CHARS
one_or_more_time:
+#endif
tok->type = TK_OP_REPEAT;
tok->u.repeat.lower = 1;
tok->u.repeat.upper = REPEAT_INFINITE;
@@ -3278,7 +3284,9 @@ fetch_token(OnigToken* tok, UChar** src,
case '?':
if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_QMARK_ZERO_ONE)) break;
+#ifdef USE_VARIABLE_META_CHARS
zero_or_one_time:
+#endif
tok->type = TK_OP_REPEAT;
tok->u.repeat.lower = 0;
tok->u.repeat.upper = 1;
@@ -3381,7 +3389,9 @@ fetch_token(OnigToken* tok, UChar** src,
}
}
+#ifdef USE_VARIABLE_META_CHARS
out:
+#endif
*src = p;
return tok->type;
}
Index: ruby.c
===================================================================
RCS file: /src/ruby/ruby.c,v
retrieving revision 1.103
diff -u -p -r1.103 ruby.c
--- ruby.c 16 Jun 2005 06:43:00 -0000 1.103
+++ ruby.c 27 Jun 2005 11:21:59 -0000
@@ -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);
Index: struct.c
===================================================================
RCS file: /src/ruby/struct.c,v
retrieving revision 1.64
diff -u -p -r1.64 struct.c
--- struct.c 1 Jun 2005 15:03:08 -0000 1.64
+++ struct.c 27 Jun 2005 11:22:00 -0000
@@ -252,7 +252,7 @@ rb_struct_define(name, va_alist)
ary = rb_ary_new();
va_init_list(ar, name);
- while (mem = va_arg(ar, char*)) {
+ while ((mem = va_arg(ar, char*))) {
ID slot = rb_intern(mem);
rb_ary_push(ary, ID2SYM(slot));
}
Index: time.c
===================================================================
RCS file: /src/ruby/time.c,v
retrieving revision 1.103
diff -u -p -r1.103 time.c
--- time.c 4 Mar 2005 06:47:41 -0000 1.103
+++ time.c 27 Jun 2005 11:22:01 -0000
@@ -1979,6 +1979,7 @@ time_mload(time, str)
}
if ((p & (1<<31)) == 0) {
+ gmt = 0;
sec = p;
usec = s;
}
Index: util.c
===================================================================
RCS file: /src/ruby/util.c,v
retrieving revision 1.46
diff -u -p -r1.46 util.c
--- util.c 21 Sep 2004 03:08:31 -0000 1.46
+++ util.c 27 Jun 2005 11:22:01 -0000
@@ -782,7 +782,7 @@ ruby_strtod(string, endPtr)
* and also locate the decimal point.
*/
- for ( ; c = *p; p += 1) {
+ for ( ; (c = *p); p += 1) {
if (!ISDIGIT(c)) {
if (c != '.' || hasPoint) {
break;
--
|ZnZ(ゼット エヌ ゼット)
|西山和広(Kazuhiro NISHIYAMA)