HomeFreeBSD

kernel: provide panicky version of __unreachable

Description

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.

Reviewed by: mjg
Differential Revision: https://reviews.freebsd.org/D23793

Details

Provenance
kevansAuthored on
Reviewer
mjg
Differential Revision
D23793: kernel: provide panicky version of __unreachable
Parents
rS361010: riscv: Fix pmap_protect for superpages
Branches
Unknown
Tags
Unknown