lkml.org 
[lkml]   [2008]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] BUILD_BUG_ON() should not use array type
> > +/* Force a compilation error if condition is constant and true */
> > +#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
>
> MAYBE_BUILD_BUG_ON() hurts my brain. It's doing:
>
> if (__builtin_constant_p(expr))
> BUILD_BUG_ON(expr);
>
> yes? For inlined (or macro) callsites which can be used with constant
> or non-constant args.
>
> It's tempting to just zap the one callsite and not add this at all,

Yes, please. There should be no maybes in kernel.

Imagine probabilistic BUG_ON(). Imagine probabilistic refcounting: maybe_get_net().



\
 
 \ /
  Last update: 2008-08-30 01:39    [W:0.038 / U:0.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site