Re: [PATCH RESEND] bug: When !CONFIG_BUG, simplify WARN_ON_ONCE and family

From: David Howells
Date: Mon Feb 24 2014 - 07:09:29 EST


Josh Triplett <josh@xxxxxxxxxxxxxxxx> wrote:

> > This means we actually want BUG() to end with __builtin_unreachable()
> > as in the CONFIG_BUG=y case, and also ensure it actually is
> > unreachable. As I have shown in [1], the there is a small overhead
> > of doing this in terms of code size.
>
> I agree that allowing BUG() to become a no-op seems suboptimal, if only
> because of the resulting warnings and mis-optimizations. However, I
> think the overhead could be cut down massively, such that BUG() just
> compiles down to a one-byte undefined instruction. (__builtin_trap()
> might do the right thing here; worth checking.)

Is it possible to use an inline function with an empty body in this? Let the
compiler prune away all the arguments?

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/