HomeFreeBSD

MFC r361011: kernel: provide panicky version of __unreachable

Description

MFC r361011: kernel: provide panicky version of __unreachable

__builtin_unreachable doesn't raise any compile-time warnings/errors on its
own, so problems with its usage can't be easily detected. While it would be
nice for this situation to change and compilers to at least add a warning
for trivial cases where local state means the instruction can't be reached,
this isn't the case at the moment and likely will not happen.

This commit adds an assert_unreachable, whose intent is incredibly clear:
it asserts that this instruction is unreachable. On INVARIANTS builds, it's
a panic(), and on non-INVARIANTS it expands to
unreachable().

Existing users of unreachable() are converted to assert_unreachable,
to improve debuggability if this assumption is violated.

Details

Provenance
kevansAuthored on
Parents
rS361314: MFC r361066:
Branches
Unknown
Tags
Unknown