ruby-changes:18212
From: akr <ko1@a...>
Date: Fri, 17 Dec 2010 07:06:22 +0900 (JST)
Subject: [ruby-changes:18212] Ruby:r30233 (trunk): * iseq.c: parenthesize macro arguments.
akr 2010-12-17 07:05:58 +0900 (Fri, 17 Dec 2010) New Revision: 30233 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30233 Log: * iseq.c: parenthesize macro arguments. Modified files: trunk/ChangeLog trunk/iseq.c Index: ChangeLog =================================================================== --- ChangeLog (revision 30232) +++ ChangeLog (revision 30233) @@ -1,3 +1,7 @@ +Fri Dec 17 07:04:09 2010 Tanaka Akira <akr@f...> + + * iseq.c: parenthesize macro arguments. + Fri Dec 17 04:18:37 2010 Eric Hodel <drbrain@s...> * transcode.c (str_encode): Alter comment for better wording and ri Index: iseq.c =================================================================== --- iseq.c (revision 30232) +++ iseq.c (revision 30233) @@ -325,13 +325,13 @@ *option = COMPILE_OPTION_DEFAULT; #define SET_COMPILE_OPTION(o, h, mem) \ - { VALUE flag = rb_hash_aref(h, ID2SYM(rb_intern(#mem))); \ - if (flag == Qtrue) { o->mem = 1; } \ - else if (flag == Qfalse) { o->mem = 0; } \ + { VALUE flag = rb_hash_aref((h), ID2SYM(rb_intern(#mem))); \ + if (flag == Qtrue) { (o)->mem = 1; } \ + else if (flag == Qfalse) { (o)->mem = 0; } \ } #define SET_COMPILE_OPTION_NUM(o, h, mem) \ { VALUE num = rb_hash_aref(opt, ID2SYM(rb_intern(#mem))); \ - if (!NIL_P(num)) o->mem = NUM2INT(num); \ + if (!NIL_P(num)) (o)->mem = NUM2INT(num); \ } SET_COMPILE_OPTION(option, opt, inline_const_cache); SET_COMPILE_OPTION(option, opt, peephole_optimization); @@ -355,9 +355,9 @@ { VALUE opt = rb_hash_new(); #define SET_COMPILE_OPTION(o, h, mem) \ - rb_hash_aset(h, ID2SYM(rb_intern(#mem)), o->mem ? Qtrue : Qfalse) + rb_hash_aset((h), ID2SYM(rb_intern(#mem)), (o)->mem ? Qtrue : Qfalse) #define SET_COMPILE_OPTION_NUM(o, h, mem) \ - rb_hash_aset(h, ID2SYM(rb_intern(#mem)), INT2NUM(o->mem)) + rb_hash_aset((h), ID2SYM(rb_intern(#mem)), INT2NUM((o)->mem)) { SET_COMPILE_OPTION(option, opt, inline_const_cache); SET_COMPILE_OPTION(option, opt, peephole_optimization); @@ -433,9 +433,9 @@ bopt, &COMPILE_OPTION_DEFAULT); } -#define CHECK_ARRAY(v) rb_convert_type(v, T_ARRAY, "Array", "to_ary") -#define CHECK_STRING(v) rb_convert_type(v, T_STRING, "String", "to_str") -#define CHECK_SYMBOL(v) rb_convert_type(v, T_SYMBOL, "Symbol", "to_sym") +#define CHECK_ARRAY(v) rb_convert_type((v), T_ARRAY, "Array", "to_ary") +#define CHECK_STRING(v) rb_convert_type((v), T_STRING, "String", "to_str") +#define CHECK_SYMBOL(v) rb_convert_type((v), T_SYMBOL, "Symbol", "to_sym") static inline VALUE CHECK_INTEGER(VALUE v) {(void)NUM2LONG(v); return v;} static VALUE iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt) @@ -1382,7 +1382,7 @@ VALUE a, args = rb_ary_new2(iseq->arg_size); ID req, opt, rest, block; #define PARAM_TYPE(type) rb_ary_push(a = rb_ary_new2(2), ID2SYM(type)) -#define PARAM_ID(i) iseq->local_table[i] +#define PARAM_ID(i) iseq->local_table[(i)] #define PARAM(i, type) ( \ PARAM_TYPE(type), \ rb_id2name(PARAM_ID(i)) ? \ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/