git: 52a19a90de6a - main - kldxref: Prefer sys/cdefs.h __unreachable over the builtin
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 12 Apr 2024 22:42:49 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=52a19a90de6a5ad43e68742a477796580b69fb99 commit 52a19a90de6a5ad43e68742a477796580b69fb99 Author: Collin Funk <collin.funk1@gmail.com> AuthorDate: 2024-04-12 22:38:19 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-04-12 22:39:25 +0000 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/kldxref/elf.c b/usr.sbin/kldxref/elf.c index a93cf996ccc7..f98c39b69c0b 100644 --- a/usr.sbin/kldxref/elf.c +++ b/usr.sbin/kldxref/elf.c @@ -532,7 +532,7 @@ elf_address_from_pointer(struct elf_file *efile, const void *p) else return (be64dec(p)); default: - __builtin_unreachable(); + __unreachable(); } }