From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LgDOp-0008Im-1f for qemu-devel@nongnu.org; Sun, 08 Mar 2009 03:26:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LgDOo-0008IY-00 for qemu-devel@nongnu.org; Sun, 08 Mar 2009 03:26:14 -0400 Received: from [199.232.76.173] (port=37640 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LgDOn-0008IV-SE for qemu-devel@nongnu.org; Sun, 08 Mar 2009 03:26:13 -0400 Received: from mail-fx0-f175.google.com ([209.85.220.175]:50737) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LgDOn-00042l-HL for qemu-devel@nongnu.org; Sun, 08 Mar 2009 03:26:13 -0400 Received: by fxm23 with SMTP id 23so1009989fxm.34 for ; Sat, 07 Mar 2009 23:26:12 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <68676e00903070851kf4b9bf5g30570c3830c7d9f0@mail.gmail.com> References: <68676e00903070851kf4b9bf5g30570c3830c7d9f0@mail.gmail.com> Date: Sun, 8 Mar 2009 09:26:12 +0200 Message-ID: Subject: Re: [Qemu-devel] [6737] Sparse fixes: truncation by cast From: Blue Swirl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 3/7/09, Luca Tettamanti wrote: > On Sat, Mar 7, 2009 at 4:46 PM, Blue Swirl 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.