]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r361011: kernel: provide panicky version of __unreachable
authorKyle Evans <kevans@FreeBSD.org>
Thu, 21 May 2020 02:08:34 +0000 (02:08 +0000)
committerKyle Evans <kevans@FreeBSD.org>
Thu, 21 May 2020 02:08:34 +0000 (02:08 +0000)
commitf359167141f2ab817ca5adaf027cfcb37a347ddf
tree15a9e4180168bb23eda01bbca7a0af96c0837c76
parenta13d27861cec3bdd26b6be1d93b36b94452c8b5d
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.
sys/ddb/db_expr.c
sys/dev/nvdimm/nvdimm.c
sys/dev/ow/ow.c
sys/net/mppcc.c
sys/sys/systm.h