dumping ground for random patches and texts
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] method.h: cast checks to int for >= 0 checks
Date: Fri, 14 Aug 2015 09:50:32 +0000	[thread overview]
Message-ID: <1439545832-17296-1-git-send-email-e@80x24.org> (raw)

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


                 reply	other threads:[~2015-08-14  9:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439545832-17296-1-git-send-email-e@80x24.org \
    --to=e@80x24.org \
    --cc=spew@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).