git: 12668eadcb82 - main - bsd.compiler.mk: Add a blocks compiler feature.

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Tue, 22 Apr 2025 17:45:09 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=12668eadcb82ec4e1bca83dc93f976bd3655ad79

commit 12668eadcb82ec4e1bca83dc93f976bd3655ad79
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-04-22 17:44:58 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-04-22 17:44:58 +0000

    bsd.compiler.mk: Add a blocks compiler feature.
    
    Sponsored by:   Klara, Inc.
    Reviewed by:    jrtc27
    Differential Revision:  https://reviews.freebsd.org/D49963
---
 lib/libc/gen/Makefile.inc      | 2 +-
 lib/libc/tests/gen/Makefile    | 2 +-
 lib/libc/tests/stdlib/Makefile | 2 +-
 share/mk/bsd.compiler.mk       | 1 +
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index fb2f0afaa2c7..9a223f2f69e8 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -168,7 +168,7 @@ SRCS+= \
 	valloc.c \
 	wordexp.c
 
-.if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_FEATURES:Mblocks}
 CFLAGS.fts.c= -fblocks
 .endif
 
diff --git a/lib/libc/tests/gen/Makefile b/lib/libc/tests/gen/Makefile
index 5c0febce81c1..247b44f50484 100644
--- a/lib/libc/tests/gen/Makefile
+++ b/lib/libc/tests/gen/Makefile
@@ -7,7 +7,7 @@ ATF_TESTS_C+=		fmtcheck2_test
 ATF_TESTS_C+=		fmtmsg_test
 ATF_TESTS_C+=		fnmatch2_test
 ATF_TESTS_C+=		fpclassify2_test
-.if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_FEATURES:Mblocks}
 ATF_TESTS_C+=		fts_blocks_test
 .endif
 ATF_TESTS_C+=		ftw_test
diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile
index df44a42ac9b1..08e356fc8706 100644
--- a/lib/libc/tests/stdlib/Makefile
+++ b/lib/libc/tests/stdlib/Makefile
@@ -7,7 +7,7 @@ ATF_TESTS_C+=		heapsort_test
 ATF_TESTS_C+=		libc_exit_test
 ATF_TESTS_C+=		mergesort_test
 ATF_TESTS_C+=		qsort_test
-.if ${COMPILER_TYPE} == "clang"
+.if ${COMPILER_FEATURES:Mblocks}
 ATF_TESTS_C+=		qsort_b_test
 .endif
 ATF_TESTS_C+=		qsort_r_compat_test
diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk
index e8d48cf0b5bf..2babccf91df1 100644
--- a/share/mk/bsd.compiler.mk
+++ b/share/mk/bsd.compiler.mk
@@ -245,6 +245,7 @@ ${X_}COMPILER_FEATURES+=	c++20
 ${X_}COMPILER_FEATURES+=	init-all
 .endif
 .if ${${X_}COMPILER_TYPE} == "clang"
+${X_}COMPILER_FEATURES+=	blocks
 ${X_}COMPILER_FEATURES+=	retpoline
 # PR257638 lld fails with BE compressed debug.  Fixed in main but external tool
 # chains will initially not have the fix.  For now limit the feature to LE