From: Blue Swirl <blauwirbel@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [6737] Sparse fixes: truncation by cast
Date: Sun, 8 Mar 2009 09:26:12 +0200 [thread overview]
Message-ID: <f43fc5580903072326r3f4140a4h26acecdd2c70c520@mail.gmail.com> (raw)
In-Reply-To: <68676e00903070851kf4b9bf5g30570c3830c7d9f0@mail.gmail.com>
On 3/7/09, Luca Tettamanti <kronos.it@gmail.com> wrote:
> On Sat, Mar 7, 2009 at 4:46 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
> > Revision: 6737
> > http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6737
> > Author: blueswir1
> > Date: 2009-03-07 15:46:23 +0000 (Sat, 07 Mar 2009)
> > Log Message:
> > -----------
> > Sparse fixes: truncation by cast
> >
> > Fix Sparse warnings about constant truncation caused by cast
> >
>
> > Modified: trunk/bswap.h
> > ===================================================================
> > --- trunk/bswap.h 2009-03-07 15:32:56 UTC (rev 6736)
> > +++ trunk/bswap.h 2009-03-07 15:46:23 UTC (rev 6737)
> > @@ -151,7 +151,7 @@
> > {
> > uint8_t *p1 = (uint8_t *)p;
> >
> > - p1[0] = v;
> > + p1[0] = v & 0xff;
> > p1[1] = v >> 8;
>
>
> Hum, by the same principle the last line should be:
> p1[1] = (v >> 8) & 0xff;
> no?
Maybe and there would be other similar places, but there is no warning
from Sparse except for this. Instead of "fix" I should have used
something like "suppress" because the code wasn't broken, it's just
that now Sparse is much more silent and real warnings are more visible
from the noise.
prev parent reply other threads:[~2009-03-08 7:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-07 15:46 [Qemu-devel] [6737] Sparse fixes: truncation by cast Blue Swirl
2009-03-07 16:51 ` Luca Tettamanti
2009-03-08 7:26 ` Blue Swirl [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=f43fc5580903072326r3f4140a4h26acecdd2c70c520@mail.gmail.com \
--to=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 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 NNTP newsgroup(s).