* compile.c: fix to remove -Wall warnings on gcc.

* compile.c (make_name_with_str): removed. use rb_sprintf() instead.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-06-28 10:41:39 +00:00
parent 8253094f39
commit b73d7a44aa
2 changed files with 21 additions and 20 deletions

View File

@ -1,3 +1,9 @@
Thu Jun 28 19:38:53 2007 Koichi Sasada <ko1@atdot.net>
* compile.c: fix to remove -Wall warnings on gcc.
* compile.c (make_name_with_str): removed. use rb_sprintf() instead.
Thu Jun 28 18:53:01 2007 Tanaka Akira <akr@fsij.org> Thu Jun 28 18:53:01 2007 Tanaka Akira <akr@fsij.org>
* bignum.c (rb_big_hash): fix hash area. * bignum.c (rb_big_hash): fix hash area.

View File

@ -1846,7 +1846,7 @@ compile_array(rb_iseq_t *iseq,
if (len != i) { if (len != i) {
if (0) rb_bug("node error: compile_array (%d: %d-%d)", if (0) rb_bug("node error: compile_array (%d: %d-%d)",
nd_line(node_root), len, i); (int)nd_line(node_root), len, i);
len = i; len = i;
} }
@ -2038,7 +2038,7 @@ compile_massign(rb_iseq_t *iseq, LINK_ANCHOR *ret,
if (lhs_splat) { if (lhs_splat) {
if (nd_type(splatn) == NODE_POSTARG) { if (nd_type(splatn) == NODE_POSTARG) {
int i, num = splatn->nd_2nd->nd_alen; int num = splatn->nd_2nd->nd_alen;
NODE *n = splatn->nd_2nd; NODE *n = splatn->nd_2nd;
ADD_INSN (ret, nd_line(n), dup); ADD_INSN (ret, nd_line(n), dup);
@ -2140,14 +2140,14 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
} }
else { else {
LABEL *lcont = NEW_LABEL(nd_line(node)); LABEL *lcont = NEW_LABEL(nd_line(node));
ADD_INSNL(ret, nd_line(node), branchif, lcont);
lfalse = NEW_LABEL(nd_line(node)); lfalse = NEW_LABEL(nd_line(node));
ADD_INSNL(ret, nd_line(node), branchif, lcont);
ADD_LABEL(ret, lfalse); ADD_LABEL(ret, lfalse);
ADD_INSN(ret, nd_line(node), putnil); ADD_INSN(ret, nd_line(node), putnil);
ADD_INSNL(ret, nd_line(node), jump, lfinish); ADD_INSNL(ret, nd_line(node), jump, lfinish);
ADD_LABEL(ret, lcont); ADD_LABEL(ret, lcont);
} }
} while (vals = vals->nd_next); } while ((vals = vals->nd_next));
} }
case NODE_STR: case NODE_STR:
case NODE_LIT: case NODE_LIT:
@ -2232,6 +2232,8 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
case NODE_CALL: case NODE_CALL:
self = Qfalse; self = Qfalse;
break; break;
default:
/* through */;
} }
if (node->nd_args) { if (node->nd_args) {
lfalse = NEW_LABEL(nd_line(node)); lfalse = NEW_LABEL(nd_line(node));
@ -2374,14 +2376,6 @@ make_name_for_block(rb_iseq_t *iseq)
return rb_str_new2(buf); return rb_str_new2(buf);
} }
static VALUE
make_name_with_str(const char *fmt, const char *str)
{
char buf[BUFSIZE];
snprintf(buf, BUFSIZE, fmt, str);
return rb_str_new2(buf);
}
static void static void
add_ensure_range(rb_iseq_t *iseq, struct ensure_range *erange, add_ensure_range(rb_iseq_t *iseq, struct ensure_range *erange,
LABEL *lstart, LABEL *lend) LABEL *lstart, LABEL *lend)
@ -4020,8 +4014,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
VALUE iseqval = VALUE iseqval =
NEW_CHILD_ISEQVAL( NEW_CHILD_ISEQVAL(
node->nd_body, node->nd_body,
make_name_with_str("<class:%s>", rb_sprintf("<class:%s>", rb_id2name(node->nd_cpath->nd_mid)),
rb_id2name(node->nd_cpath->nd_mid)),
ISEQ_TYPE_CLASS); ISEQ_TYPE_CLASS);
compile_cpath(ret, iseq, node->nd_cpath); compile_cpath(ret, iseq, node->nd_cpath);
COMPILE(ret, "super", node->nd_super); COMPILE(ret, "super", node->nd_super);
@ -4034,11 +4027,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break; break;
} }
case NODE_MODULE:{ case NODE_MODULE:{
VALUE iseqval = NEW_CHILD_ISEQVAL(node->nd_body, VALUE iseqval = NEW_CHILD_ISEQVAL(
make_name_with_str node->nd_body,
("<module:%s>", rb_sprintf("<module:%s>", rb_id2name(node->nd_cpath->nd_mid)),
rb_id2name(node->nd_cpath->
nd_mid)),
ISEQ_TYPE_CLASS); ISEQ_TYPE_CLASS);
COMPILE(ret, "mbase", node->nd_cpath->nd_head); COMPILE(ret, "mbase", node->nd_cpath->nd_head);
@ -4487,12 +4478,16 @@ static LABEL *
register_label(rb_iseq_t *iseq, struct st_table *labels_table, VALUE obj) register_label(rb_iseq_t *iseq, struct st_table *labels_table, VALUE obj)
{ {
LABEL *label = 0; LABEL *label = 0;
st_data_t tmp;
obj = rb_convert_type(obj, T_SYMBOL, "Symbol", "to_sym"); obj = rb_convert_type(obj, T_SYMBOL, "Symbol", "to_sym");
if (st_lookup(labels_table, obj, (st_data_t *)&label) == 0) { if (st_lookup(labels_table, obj, &tmp) == 0) {
label = NEW_LABEL(0); label = NEW_LABEL(0);
st_insert(labels_table, obj, (st_data_t)label); st_insert(labels_table, obj, (st_data_t)label);
} }
else {
label = (LABEL *)tmp;
}
return label; return label;
} }