Re: [announce] [patch] Voluntary Kernel Preemption Patch

From: Andrea Arcangeli
Date: Mon Jul 12 2004 - 14:39:59 EST


On Mon, Jul 12, 2004 at 12:17:05PM +0200, Takashi Iwai wrote:
> Couldn't it be simply written like below?
>
> #define BUILD_BUG_ON(condition) do { if (unlikely(condition)) BUILD_BUG(); } while(0)

BUILD_BUG_ON is a different thing. the "condition" is meant to be
evaluated at _compile_ time, not at runtime (so the unlikely is useless
since the compiler knows the result before it generates the bytecode).
This is why BUILD_BUG() isn't implemented anywhere, so you get a linker
error during the compilation.

For example with it you can do things like:

BUILD_BUG_ON(offsetof(struct task_struct, thread.i387.fxsave) & 15);

(see asm-i386/bugs.h, it's doing the BUILD_BUG_ON by hand right now)
-
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/