Re: BUGed to death

From: Sean Neakums (sneakums@zork.net)
Date: Tue Apr 15 2003 - 07:49:39 EST


Jens Axboe <axboe@suse.de> writes:

> On Tue, Apr 15 2003, Duncan Sands wrote:
>> On Monday 14 April 2003 22:19, Martin J. Bligh wrote:
>> > Seems all these bug checks are fairly expensive. I can get 1%
>> > back on system time for kernel compiles by changing BUG to
>> > "do {} while (0)" to make them all compile away. Profiles aren't
>> > very revealing though ... seems to be within experimental error ;-(
>>
>> What happens if you just turn BUG_ON into "do {} while (0)"?
>
> If you do that, you must audit every single BUG_ON to make sure the
> expression doesn't have any side effects.
>
> BUG_ON(do_the_good_stuff());

#define BUG_ON(x) x; do the trick. With any luck the compiler will
throw away most of the simple comparisons and whatnot.

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



This archive was generated by hypermail 2b29 : Tue Apr 15 2003 - 22:00:35 EST