[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <530EBFC7.9030309@zytor.com>
Date: Wed, 26 Feb 2014 20:32:07 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Ben Pfaff <blp@...ira.com>
CC: Joe Perches <joe@...ches.com>, Christopher Li <sparse@...isli.org>,
Josh Triplett <josh@...htriplett.org>,
linux-sparse@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V2] sparse: Allow override of sizeof(bool) warning
On 02/26/2014 08:26 PM, Ben Pfaff wrote:
>
>> Because sizeof(_Bool) is a little bit special compare to sizeof(long).
>> In the case of long, all sizeof(long) * 8 bits are use in the actual value.
>> But for the _Bool, only the 1 bit is used in the 8 bits size. In other words,
>> the _Bool has a special case of the actual bit size is not a multiple of 8.
Quite frankly, this is silly in my opinion, *and* it is not guaranteed
by C either (read about "trap representations").
>> Sparse has two hats, it is a C compiler front end, and more often it is
>> used in the Linux kernel source sanitize checking. Depending on the sizeof
>> _Bool sounds a little bit suspicious in the kernel. I would love to the heard
>> your actual usage case of the sizeof(_Bool). Why do you care about this
>> warning?
Anything that moves data around in a generic fashion. It can be as
simple as:
memcpy(foo, bar, sizeof *foo);
-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists