Re: [PATCH] BUILD_BUG_ON: make it handle more cases

2009-11-05 Thread Rusty Russell
On Thu, 5 Nov 2009 05:08:42 pm Stephen Rothwell wrote: > Hi Rusty, > > On Thu, 5 Nov 2009 16:58:36 +1030 Rusty Russell wrote: > > > > Huh? virtio_has_feature does: > > > > if (__builtin_constant_p(fbit)) > > BUILD_BUG_ON(fbit >= 32); > > else > > BUG_ON(fbit >= 3

Re: [PATCH] BUILD_BUG_ON: make it handle more cases

2009-11-04 Thread Stephen Rothwell
Hi Rusty, On Tue, 20 Oct 2009 14:15:33 +1030 Rusty Russell wrote: > > +#ifndef __OPTIMIZE__ > +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) > +#else > +extern int __build_bug_on_failed; > +#define BUILD_BUG_ON(condition) \ > +

Re: [PATCH] BUILD_BUG_ON: make it handle more cases

2009-10-29 Thread Hollis Blanchard
On Tue, 2009-10-20 at 14:15 +1030, Rusty Russell wrote: > BUILD_BUG_ON used to use the optimizer to do code elimination or fail > at link time; it was changed to first the size of a negative array (a > nicer compile time error), then (in > 8c87df457cb58fe75b9b893007917cf8095660a0) to a bitfield. >

Re: [PATCH] BUILD_BUG_ON: make it handle more cases

2009-10-22 Thread Américo Wang
On Tue, Oct 20, 2009 at 10:43 PM, Alan Jenkins wrote: > On 10/20/09, Américo Wang wrote: >> On Tue, Oct 20, 2009 at 02:15:33PM +1030, Rusty Russell wrote: >>>BUILD_BUG_ON used to use the optimizer to do code elimination or fail >>>at link time; it was changed to first the size of a negative array

Re: [PATCH] BUILD_BUG_ON: make it handle more cases

2009-10-22 Thread Hollis Blanchard
On Tue, 2009-10-20 at 14:15 +1030, Rusty Russell wrote: > BUILD_BUG_ON used to use the optimizer to do code elimination or fail > at link time; it was changed to first the size of a negative array (a > nicer compile time error), then (in > 8c87df457cb58fe75b9b893007917cf8095660a0) to a bitfield. >

Re: [PATCH] BUILD_BUG_ON: make it handle more cases

2009-10-20 Thread Alan Jenkins
On 10/20/09, Américo Wang wrote: > On Tue, Oct 20, 2009 at 02:15:33PM +1030, Rusty Russell wrote: >>BUILD_BUG_ON used to use the optimizer to do code elimination or fail >>at link time; it was changed to first the size of a negative array (a >>nicer compile time error), then (in >>8c87df457cb58fe7

Re: [PATCH] BUILD_BUG_ON: make it handle more cases

2009-10-20 Thread Américo Wang
On Tue, Oct 20, 2009 at 02:15:33PM +1030, Rusty Russell wrote: >BUILD_BUG_ON used to use the optimizer to do code elimination or fail >at link time; it was changed to first the size of a negative array (a >nicer compile time error), then (in >8c87df457cb58fe75b9b893007917cf8095660a0) to a bitfield.

[PATCH] BUILD_BUG_ON: make it handle more cases

2009-10-19 Thread Rusty Russell
BUILD_BUG_ON used to use the optimizer to do code elimination or fail at link time; it was changed to first the size of a negative array (a nicer compile time error), then (in 8c87df457cb58fe75b9b893007917cf8095660a0) to a bitfield. bitfields: needs a literal constant at parse time, and can't be p