Re: BUG_ON(x) instead of if (x) BUG() in mm/page_alloc,swap_state.c

From: Andrew Morton (akpm@zip.com.au)
Date: Mon Jul 01 2002 - 12:40:17 EST


Lightweight patch manager wrote:
>
> This replaces if(x) BUG() with BUG_ON(x) where necessarry, at least in
> mm/page_alloc.c and mm/swap_state.c

Thanks - I'll add to my pile.

> ...
> - if (!nr_pages--)
> - BUG();
> + BUG_ON(!nr_pages--)

Except for this chunk. It's best to avoid putting statements
with side-effects inside BUG_ON(). If someone wants to build
a super-small kernel with a no-op BUG_ON() then code such as the
above will cause it to fail.

It'll probably fail anyway, but hey - may as well try.

-
-
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 : Sun Jul 07 2002 - 22:00:07 EST