Re: [PATCH] debug: fix BUILD_BUG_ON() for non-constant expressions
From: adobriyan
Date: Wed Aug 20 2008 - 08:38:21 EST
On Wed, Aug 20, 2008 at 03:31:53PM +0300, Boaz Harrosh wrote:
> Ingo Molnar wrote:
> > * Boaz Harrosh <bharrosh@xxxxxxxxxxx> wrote:
> >
> >> If the user of virtio_has_feature() must pass a compile-time constant
> >> then it must be converted to a MACRO, and then the BUILD_BUG_ON will
> >> work. Or it should be changed to a BUG_ON() if fbit is a runtime
> >> variable.
> >
>
> The use of __builtin_constant_p in inline functions is broken. This
> is because it will give different results depending on the -O level
> used. So I think that using it in the Kernel with inlines is plain
> broken. And should be discouraged.
See how kmalloc() works.
--
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/