dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH] method.h: cast checks to int for >= 0 checks
@ 2015-08-14  9:50 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-08-14  9:50 UTC (permalink / raw)
  To: spew

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
---
 method.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/method.h b/method.h
index e46ba55..71dc2c0 100644
--- a/method.h
+++ b/method.h
@@ -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 =
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-08-14  9:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-14  9:50 [PATCH] method.h: cast checks to int for >= 0 checks Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).