From: Adel Gadllah <adel.gadllah@gmail.com>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: Alexey Dobriyan <adobriyan@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix sparse problems with ARRAY_SIZE
Date: Thu, 12 Jul 2007 12:27:49 +0200 [thread overview]
Message-ID: <46960225.1030102@gmail.com> (raw)
In-Reply-To: <20070710224059.GS21668@ftp.linux.org.uk>
Al Viro wrote:
> On Tue, Jul 10, 2007 at 09:58:18PM +0100, Al Viro wrote:
>
>> On Tue, Jul 10, 2007 at 11:40:33PM +0400, Alexey Dobriyan wrote:
>>
>>> On Tue, Jul 10, 2007 at 06:09:48PM +0200, Adel Gadllah wrote:
>>>
>>>> --- linux-2.6.orig/include/linux/kernel.h
>>>> +++ linux-2.6/include/linux/kernel.h
>>>> @@ -35,7 +35,11 @@ extern const char linux_proc_banner[];
>>>> #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
>>>> #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
>>>>
>>>> +#ifdef __CHECKER_
>>>> +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
>>>> +#else
>>>> #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
>>>> +#endif
>>>>
>>> Al Viro recently gave a hint that he have patches for sparse to not give
>>> spurious ARRAY_SIZE warnings.
>>>
>> I do. Right now it's either 2 or 4 patches away from mainline sparse,
>> depending on reordering... I'm splitting the last patch in series,
>> hopefully will reorder and send tonight.
>>
>> Basically, it's a matter of getting __builtin_compatible_types_p()
>> implementation (really - evaluate.c:type_difference()) somewhere sane.
>>
>
> Try git://git.kernel.org/pub/scm/linux/kernel/git/viro/sparse.git/,
> the branch is type_difference
>
>
ok a proper fix is always better than a workaround ;)
it seems that ARRAY_SIZE is defined multiple times....
seem wrong... shouldn't all users include linux/kernel.h and use that one?
prev parent reply other threads:[~2007-07-12 10:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-10 16:05 [PATCH] fix sparse problems with ARRAY_SIZE Adel Gadllah
2007-07-10 16:09 ` Adel Gadllah
2007-07-10 19:40 ` Alexey Dobriyan
2007-07-10 20:58 ` Al Viro
2007-07-10 22:40 ` Al Viro
2007-07-12 10:27 ` Adel Gadllah [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=46960225.1030102@gmail.com \
--to=adel.gadllah@gmail.com \
--cc=adobriyan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ftp.linux.org.uk \
/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