lkml.org 
[lkml]   [2003]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Sparse warning: bitmap.h: bad constant expression
On Mon, 1 September 2003 18:57:02 -0700, Dave Olien wrote:
>
> The problem seems to be that sparse currently will only accept array
> declarations with a size that can be evaluated at compile time to
> a fixed value. So an array declaration of the form:
>
> int asize;
> int data[asize];
>
> will fail. sparse needs to be modified to recognize this type of
> declaration with a variable array size. That'll take a few hours of
> someone's time to fix.

Not quite true. The above is an implicit call to alloca and should
not exist in the kernel. No need to hack support into sparse.

Petri's code below has constant array bounds, once the preprocessing
is done, that should be fixed in sparse.

> On Mon, Sep 01, 2003 at 10:59:21PM +0300, Petri Koistinen wrote:
> > Hi!
> >
> > If I try to compile latest kernel with "make C=1" I'll get many warning
> > messages from sparse saying:
> >
> > warning: include/linux/bitmap.h:85:2: bad constant expression
> > warning: include/linux/bitmap.h:98:2: bad constant expression
> >
> > Sparse doesn't seem to like DECLARE_BITMAP macros.
> >
> > #define DECLARE_BITMAP(name,bits) \
> > unsigned long name[BITS_TO_LONGS(bits)]
> >
> > So what is wrong with this and how it could be fixed so that sparse
> > wouldn't complain?

Sorry, I've just had a casual glance at sparse so far. Looks like a
preprocessing problem, that's all I can say.

Jörn

--
Fancy algorithms are slow when n is small, and n is usually small.
Fancy algorithms have big constants. Until you know that n is
frequently going to be big, don't get fancy.
-- Rob Pike
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:48    [W:0.062 / U:0.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site