Re: [PATCH 4/4] bug: mark disabled BUG() as unreachable() code

From: Andrew Morton
Date: Sat Apr 28 2012 - 02:13:00 EST


On Sat, 28 Apr 2012 09:10:18 +0400 Konstantin Khlebnikov <khlebnikov@xxxxxxxxxx> wrote:

> Konstantin Khlebnikov wrote:
> > This patch suppress some compiler warnings (if CONFIG_BUG=n)
> > "warning: control reaches end of non-void function"
>
> With this patch gcc throw out loop at the end of do_exit():
>
> schedule();
> BUG();
> /* Avoid "noreturn function does return". */
> for (;;)
> cpu_relax(); /* For when BUG is null */
>
> Is this ok? Probably not, and we need here some BUG_NORETURN() which
> really never returns even if CONFIG_BUG=n.

Probably we should do away with CONFIG_BUG.

CONFIG_BUG=n causes various compile-time warnings to come out when the
execution proceeds into places where we didn't intend and these aren't
worth fixing.

More seriously, I rather doubt that anyone ever sets it to n. And it
would be a pretty dumb thing to do - if your kernel has seriously
malfunctioned and it *knows* that it malfunctioned, it will just
blunder on anyway not telling anyone about it.

It doesn't seem worth any effort to support this thing.
--
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/