From 606c37c54160479130a7337e45efbdf01d013b13 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Fri, 12 Apr 2024 16:38:18 -0600 Subject: [PATCH] nproc: 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 Reviewed by: imp, freebsd@igalic.co Pull Request: https://github.com/freebsd/freebsd-src/pull/1117 --- bin/nproc/nproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/nproc/nproc.c b/bin/nproc/nproc.c index c2ab75826ce1..d8affe11b796 100644 --- a/bin/nproc/nproc.c +++ b/bin/nproc/nproc.c @@ -94,7 +94,7 @@ main(int argc, char *argv[]) break; case OPT_VERSION: version(); - __builtin_unreachable(); + __unreachable(); case OPT_HELP: help(); exit(EXIT_SUCCESS);