1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2015-08-14 09:51:50 +00:00
parent f224fecc0f
commit 260a7d2c83
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Fri Aug 14 18:50:57 2015 Eric Wong <e@80x24.org>
* 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@80x24.org>
* process.c (close_unless_reserved): add extra check

View file

@ -68,7 +68,7 @@ typedef struct rb_callable_method_entry_struct { /* same fields with rb_method_e
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 *me, unsigned int safe)
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 =