ruby-changes:39496
From: normal <ko1@a...>
Date: Fri, 14 Aug 2015 18:52:01 +0900 (JST)
Subject: [ruby-changes:39496] normal:r51577 (trunk): method.h: cast checks to int for >= 0 checks
normal 2015-08-14 18:51:50 +0900 (Fri, 14 Aug 2015) New Revision: 51577 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51577 Log: method.h: cast checks to int for >= 0 checks Setting VM_CHECK_MODE to 1 in vm_core.h makes noisy warnings otherwise. AFAIK, the signedness of enums is implementation-dependent, and GCC considers them unsigned and warns. Tested on gcc 4.7.2 (Debian 4.7.2-5) * method.h (METHOD_ENTRY_VISI_SET): cast visi to int (METHOD_ENTRY_FLAGS_SET): ditto Modified files: trunk/ChangeLog trunk/method.h Index: method.h =================================================================== --- method.h (revision 51576) +++ method.h (revision 51577) @@ -68,7 +68,7 @@ typedef struct rb_callable_method_entry_ https://github.com/ruby/ruby/blob/trunk/method.h#L68 static inline void METHOD_ENTRY_VISI_SET(rb_method_entry_t *me, rb_method_visibility_t visi) { - VM_ASSERT(visi >= 0 && visi <= 3); + VM_ASSERT((int)visi >= 0 && visi <= 3); me->flags = (me->flags & ~(IMEMO_FL_USER0 | IMEMO_FL_USER1)) | (visi << IMEMO_FL_USHIFT+0); } static inline void @@ -86,7 +86,7 @@ METHOD_ENTRY_SAFE_SET(rb_method_entry_t https://github.com/ruby/ruby/blob/trunk/method.h#L86 static inline void METHOD_ENTRY_FLAGS_SET(rb_method_entry_t *me, rb_method_visibility_t visi, unsigned int basic, unsigned int safe) { - VM_ASSERT(visi >= 0 && visi <= 3); + VM_ASSERT((int)visi >= 0 && visi <= 3); VM_ASSERT(basic <= 1); VM_ASSERT(safe <= 1); me->flags = Index: ChangeLog =================================================================== --- ChangeLog (revision 51576) +++ ChangeLog (revision 51577) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Aug 14 18:50:57 2015 Eric Wong <e@8...> + + * method.h (METHOD_ENTRY_VISI_SET): cast visi to int + (METHOD_ENTRY_FLAGS_SET): ditto + Fri Aug 14 18:43:11 2015 Eric Wong <e@8...> * process.c (close_unless_reserved): add extra check -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/