From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 1/1] Avoid compiler error when building block/blkdebug.c with -Wtype-limits
Date: Fri, 10 Sep 2010 19:15:14 +0200 [thread overview]
Message-ID: <4C8A67A2.1080300@redhat.com> (raw)
In-Reply-To: <AANLkTinmwaoJZTWaTSyb58c8427W+PxkMSH2xr1nLSDU@mail.gmail.com>
On 09/10/10 19:05, Blue Swirl wrote:
> On Fri, Sep 10, 2010 at 2:04 PM, <Jes.Sorensen@redhat.com> wrote:
>> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>>
>> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
>> ---
>> block/blkdebug.c | 7 ++++++-
>> 1 files changed, 6 insertions(+), 1 deletions(-)
>>
>> diff --git a/block/blkdebug.c b/block/blkdebug.c
>> index 2a63df9..17d796d 100644
>> --- a/block/blkdebug.c
>> +++ b/block/blkdebug.c
>> @@ -439,7 +439,12 @@ static void blkdebug_debug_event(BlockDriverState *bs, BlkDebugEvent event)
>> struct BlkdebugRule *rule;
>> BlkdebugVars old_vars = s->vars;
>>
>> - if (event < 0 || event >= BLKDBG_EVENT_MAX) {
>> + /*
>> + * enum is not guaranteed to be signed on all archs, so cast to
>> + * int before the comparison against zero to avoid compiler
>> + * warning when building with -Wtype-limits
>> + */
>> + if ((int)event < 0 || event >= BLKDBG_EVENT_MAX) {
>
> I changed 'if' to 'assert' in my version because the check could only
> fail due to an internal error:
> http://lists.nongnu.org/archive/html/qemu-devel/2010-09/msg00239.html
Sorry I missed your posting. I am happy with your version too, ACK from me.
I did a pull before doing this patch and didn't see it, which is why I
posted my version, but your patch does the trick nicely.
Cheers,
Jes
prev parent reply other threads:[~2010-09-10 17:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-10 14:04 [Qemu-devel] [PATCH 0/1] Avoid compiler error when building block/blkdebug.c with -Wtype-limits Jes.Sorensen
2010-09-10 14:04 ` [Qemu-devel] [PATCH 1/1] " Jes.Sorensen
2010-09-10 17:05 ` [Qemu-devel] " Blue Swirl
2010-09-10 17:15 ` Jes Sorensen [this message]
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=4C8A67A2.1080300@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.