lkml.org 
[lkml]   [2008]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: rc4-mmotm1110 - Another build error
From
Date
On Mon, 10 Nov 2008 19:43:53 PST, Andrew Morton said:
> On Mon, 10 Nov 2008 22:20:33 -0500 Valdis.Kletnieks@vt.edu wrote:
>
> > gcc --version says:
> > gcc (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7)
> >
> > ka-blam number 2:
> >
> > CC kernel/audit.o
> > In file included from include/net/dst.h:15,
> > from include/net/sock.h:57,
> > from kernel/audit.c:54:
> > include/net/neighbour.h:114: error: braced-group within expression allowed
only inside a function
> > make[1]: *** [kernel/audit.o] Error 1
> >
> > I'm placing bets on patches/align-avoid-evaluating-its-argument-twice.patch
> >
> > Yep, revert that patch, and audit.o compiles again.
> >
>
> I hadn't got around to testing that one yet.
>
> So ug. ALIGN() is used in array sizing and hence has to be a
> compile-time thing. But ALIGN(foo, bar()) will call bar() twice.
>
> Now how do we fix that?

Can we abuse __builtin_constant_p somehow? Maybe we can make a definition
something like:

#define __align_mask(x,mask) (
__builtin_constant_p(mask) ? {
(((x)+(mask))&~(mask)) :
{ \
typeof(mask) __mask = mask; \
(((x) + __mask) & ~__mask); \
}
})

If it's a compile-time constant, it's safe to evaluate mask twice.
And if it's *not* a constant, it shouldn't be used for sizing arrays
in open code. And if it's an array local to a procedure, it probably
should be kmalloc()'ed instead.

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2008-11-11 20:07    [W:0.089 / U:0.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site