Re: [2.6 patch] if ... BUG() -> BUG_ON()

From: Richard Henderson
Date: Thu Jan 15 2004 - 00:07:37 EST


On Thu, Jan 15, 2004 at 10:20:48AM +1100, Rusty Russell wrote:
> The right fix is to hack gcc to allow functions (in this case, BUG()) to have
> an "unlikely" attribute, and therefore know that this branch is unlikely.

The minimal change to make this work is some new annotation that says
that control does not fall through an asm. Or give up on the keen-o
diagnostics and use __builtin_trap ().

Either way, branches that lead to dead ends (such as trap or abort or
any other noreturn function) are automatically predicted not taken.


r~
-
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/