Re: [PATCH] BUG(): CONFIG_BUG=n version of BUG() should be unreachable()

From: David Howells
Date: Tue Jan 05 2010 - 12:58:39 EST


Sam Ravnborg <sam@xxxxxxxxxxxx> wrote:

> +#define BUG() do { \
> + for (;;) \
> + /* endless loop*/; \
> + unreachable(); \
> +} while(0)

Can you not do:

#define BUG() do { \
unreachable(); \
} while(1)

instead? If the compiler is interpreting unreachable() to really mean that
what comes after will not be reached, then the condition/loop at the end of
the block should be optimised away.

David
--
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/