* Re: warnings in git-wireless
[not found] ` <4667364A.4040803@linux.intel.com>
@ 2007-06-07 1:04 ` Andrew Morton
2007-06-07 1:13 ` Dave Jones
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Morton @ 2007-06-07 1:04 UTC (permalink / raw)
To: James Ketrenos; +Cc: NetDev, linux-wireless, linux-sparse
On Wed, 06 Jun 2007 15:33:46 -0700 James Ketrenos <jketreno@linux.intel.com> wrote:
> Andrew Morton wrote:
> > On Wed, 06 Jun 2007 13:51:41 -0700 James Ketrenos <jketreno@linux.intel.com> wrote:
> >
> >>>> * make C=2 CF=-Wall will complain if you use ARRAY_SIZE on global data
> >>>> */
> >>>> #define GLOBAL_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> >>> This is identical to ARRAY_SIZE.
> >>>
> >>> And if there's some problem with ARRAY_SIZE then fix ARRAY_SIZE! Don't go
> >>> off and create some private thing and leave everyone else twisting in the
> >>> wind.
> >> The code was resolving the sparse warnings.
> >
> ...
> > Your GLOBAL_ARRAY_SIZE() is, afaict, identical to ARRAY_SIZE().
>
> >From include/linux/kernel.h
>
> #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
o crap, sorry, I was looking at one of the other definitions of ARRAY_SIZE :(
> >From drivers/net/wireless/mac80211/iwlwifi/iwl-helpers.h
>
> #define GLOBAL_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
>
> The '+ __must_be_array(arr)' part of ARRAY_SIZE was causing sparse to complain
> with:
>
> drivers/net/wireless/mac80211/iwlwifi/base.c:4646:22: error: cannot size expression
> ...
OK, that's a problem in sparse, I guess.
There _should_ be some #ifdeffable thing which is being passed to cpp when
we run sparse (but I'm not sure what it is). If there is such a thing then
we could disable the __must_be_array() thing during sparse runs.
But longer-term, sparse should be taught about __must_be_array().
> When I had run my builds, I had restricted the sparse checks to just iwlwifi
> (vs. checking the rest of the kernel).
>
> I just ran it C=2 CF=-Wall against the rest of the kernel and do see other code
> with the same problem, eg:
>
> sound/core/memalloc.c:521:14: error: cannot size expression
> ...
>
> I had erroneously thought it was just a problem with iwlwifi...
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: warnings in git-wireless
2007-06-07 1:04 ` warnings in git-wireless Andrew Morton
@ 2007-06-07 1:13 ` Dave Jones
0 siblings, 0 replies; 2+ messages in thread
From: Dave Jones @ 2007-06-07 1:13 UTC (permalink / raw)
To: Andrew Morton; +Cc: James Ketrenos, NetDev, linux-wireless, linux-sparse
On Wed, Jun 06, 2007 at 06:04:21PM -0700, Andrew Morton wrote:
> There _should_ be some #ifdeffable thing which is being passed to cpp when
> we run sparse (but I'm not sure what it is).
#ifdef __CHECKER__
(See include/linux/compiler.h, this is how we implement __user & friends)
Dave
--
http://www.codemonkey.org.uk
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-07 1:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20070605020614.3f06b2ab.akpm@linux-foundation.org>
[not found] ` <46671E5D.9070304@linux.intel.com>
[not found] ` <20070606163534.6a6cffb7.akpm@linux-foundation.org>
[not found] ` <4667364A.4040803@linux.intel.com>
2007-06-07 1:04 ` warnings in git-wireless Andrew Morton
2007-06-07 1:13 ` Dave Jones
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).