Re: [PATCH] bug: Fix CONFIG_BUG=n BUG_ON()

Bart Van Assche
2014-06-19T17:51:50Z

On 06/19/14 19:21, josh@joshtriplett.org wrote:
> That's exactly what BUG_ON becomes if CONFIG_BUG=y, and that
> significantly increases kernel size; if you want that, set CONFIG_BUG=y.
> BUG_ON should continue to compile to nothing if CONFIG_BUG=n, or
> CONFIG_BUG=n has no reason to exist.

Hello Josh,

I wasn't aware that the current behavior of BUG_ON() with CONFIG_BUG=n
was intentional. The reason I started looking into this is because
different compiler warnings are generated for code with BUG_ON(1)
statements when building against a kernel with CONFIG_BUG=y or
CONFIG_BUG=n. There is an easy alternative though: changing BUG_ON(1)
into BUG() in my code.

Bart.