Re: [linux-usb-devel] Re: [BK PATCH] USB changes for 2.5.34

Linus Torvalds
2002-09-10T18:35:41Z

On Tue, 10 Sep 2002, David S. Miller wrote:
>
> IMO we should have ASSERT() and OHSHIT(),
>
> I fully support the addition of an OHSHIT() macro.

Oh, please no. We'd end up with endless asserts in the networking layer,
just because David would find it amusing.

I can just see it now - code bloat hell.

And no, I still don't like ASSERT().

I think the approach should clearly spell what the trouble level is:

DEBUG(x != y, "x=%d, y=%d\n", x, y);

WARN(x != y, "crap happens: x=%d y=%d\n", x, y);

FATAL(x != y, "Aiee: x=%d y=%d\n", x, y);

where the DEBUG one gets compiled out normally (or has some nice per-file
way of being enabled/disabled - a perfect world would expose the on/off in
devicefs as a per-file entity when kernel debugging is on), WARN continues
but writes a message (and normally does _not_ get compiled out), and FATAL
is like our current BUG_ON().

All would print out the filename and line number, the message, and the
backtrace.

Linus