]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
kldxref: Prefer sys/cdefs.h __unreachable over the builtin
authorCollin Funk <collin.funk1@gmail.com>
Fri, 12 Apr 2024 22:38:19 +0000 (16:38 -0600)
committerWarner Losh <imp@FreeBSD.org>
Fri, 12 Apr 2024 22:39:25 +0000 (16:39 -0600)
commit52a19a90de6a5ad43e68742a477796580b69fb99
tree51d7cca85990b1aba192d9f1a5d8cb15b0f4086e
parentf7a10a7752592c0bec6e6ea377f3f6640e9ecfa5
kldxref: Prefer sys/cdefs.h __unreachable over the builtin

The __builtin_unreachable macro provided by Clang and GCC is a hint to
the compiler used for optimization. The programs work fine even if the
compiler doesn't support it. The sys/cdefs.h has had __unreachable for
9 years (commit 732b31de5d9244bd1cc98192e09ee1881e9f55e9). It expands
to the builtin if it is available. In the rare case that it is
unsupported it expands to a null statement so compilation does not
fail.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed by: imp, freebsd@igalic.co
Pull Request: https://github.com/freebsd/freebsd-src/pull/1117
usr.sbin/kldxref/elf.c