Re: [PATCH] BUILD_BUG_ON() should not use array type

From: Alexey Dobriyan
Date: Fri Aug 29 2008 - 19:36:55 EST


> > +/* 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().

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/