git: 2f1940cbfdc4 - main - sched: Use CPPFLAGS in 'compile-with' for namespacing headers

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Thu, 19 Nov 2026 14:50:27 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=2f1940cbfdc4a4e9e321793fb283d18265e3d1f7

commit 2f1940cbfdc4a4e9e321793fb283d18265e3d1f7
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-11-03 21:48:09 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-11-19 14:50:00 +0000

    sched: Use CPPFLAGS in 'compile-with' for namespacing headers
    
    This gives an example of what stance to use should running the
    preprocessor safely be necessary to generate other files.
    
    Because _KERNEL is now defined via a '-D' directive in CPPFLAGS, the
    explicit '_KERNEL' define in 'sys/kern/sched_ns.h' is no more necessary.
    Remove it.
    
    No functional change (intended).
    
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D61169
---
 sys/conf/files      | 4 ++--
 sys/kern/sched_ns.h | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/conf/files b/sys/conf/files
index 8a284016ea3d..cdd54d23a91d 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -4722,7 +4722,7 @@ kern/sched_4bsd.c		optional sched_4bsd
 sched_4bsd_ns.h			optional sched_4bsd \
 	dependency		"$S/kern/sched_ns.h $S/sys/sched.h \
 	$S/tools/sched_impl_ns.awk" \
-	compile-with		"${CPP} ${INCLUDES} -DSCHED_IMPLEMENTATION=4bsd \
+	compile-with		"${CPP} ${CPPFLAGS} -DSCHED_IMPLEMENTATION=4bsd \
 	$S/kern/sched_ns.h | \
 	${AWK} -f $S/tools/sched_impl_ns.awk > ${.TARGET}" \
 	no-obj no-implicit-rule before-depend local \
@@ -4731,7 +4731,7 @@ kern/sched_ule.c		optional sched_ule
 sched_ule_ns.h			optional sched_ule \
 	dependency		"$S/kern/sched_ns.h $S/sys/sched.h \
 	$S/tools/sched_impl_ns.awk" \
-	compile-with		"${CPP} ${INCLUDES} -DSCHED_IMPLEMENTATION=ule \
+	compile-with		"${CPP} ${CPPFLAGS} -DSCHED_IMPLEMENTATION=ule \
 	$S/kern/sched_ns.h | \
 	${AWK} -f $S/tools/sched_impl_ns.awk > ${.TARGET}" \
 	no-obj no-implicit-rule before-depend local \
diff --git a/sys/kern/sched_ns.h b/sys/kern/sched_ns.h
index 0c71f4350fbc..da8e85323e45 100644
--- a/sys/kern/sched_ns.h
+++ b/sys/kern/sched_ns.h
@@ -33,7 +33,6 @@
  * machinery.
  */
 
-#define _KERNEL
 #include <sys/cdefs.h>
 #include <sys/sched.h>