lkml.org 
[lkml]   [2008]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] debug: fix BUILD_BUG_ON() for non-constant expressions


On Sun, 17 Aug 2008, Ingo Molnar wrote:
>
> try the patch below - it only gives this error during build:

Well, you didn't do it right:

> +#define __BBO(c) sizeof(const char[1 - 2*!!(c)])
> +#define __BBONC(c) __BBO(!__builtin_constant_p(c))
> +#define BUILD_BUG_ON_ZERO2(c) (__BBO(c) - __BBONC(c))
> +#define BUILD_BUG_ON2(c) (void)BUILD_BUG_ON_ZERO(c)

Look at the #define of BUILD_BUG_ON2 a bit more.

Hint: you're using the _wrong_ BUILD_BUG_ON_ZERO. The old one, not the v2
one!

That said, with that fixed, there's still something wrong. It does seem
like gcc has some very odd interaction there with __builtin_constant_p.
Odd.

Linus


\
 
 \ /
  Last update: 2008-08-17 20:43    [W:0.076 / U:0.068 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site