Thread (3 messages) 3 messages, 3 authors, 2025-08-28

Re: [PATCH net-next v2] uapi: wrap compiler_types.h in an ifdef instead of the implicit strip

From: Simon Horman <horms@kernel.org>
Date: 2025-08-27 15:52:28
Also in: linux-kbuild, lkml

On Mon, Aug 25, 2025 at 01:18:28PM -0700, Jakub Kicinski wrote:
The uAPI stddef header includes compiler_types.h, a kernel-only
header, to make sure that kernel definitions of annotations
like __counted_by() take precedence.

There is a hack in scripts/headers_install.sh which strips includes
of compiler.h and compiler_types.h when installing uAPI headers.
While explicit handling makes sense for compiler.h, which is included
all over the uAPI, compiler_types.h is only included by stddef.h
(within the uAPI, obviously it's included in kernel code a lot).

Remove the stripping from scripts/headers_install.sh and wrap
the include of compiler_types.h in #ifdef __KERNEL__ instead.
This should be equivalent functionally, but is easier to understand
to a casual reader of the code. It also makes it easier to work
with kernel headers directly from under tools/

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v2:
 - remove the hack from scripts/headers_install.sh
 - wrap in __KERNEL__ instead of removing
v1: https://lore.kernel.org/20250818181848.799566-1-kuba@kernel.org (local)
Reviewed-by: Simon Horman <horms@kernel.org>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help