Skip to contentSkip to conversation

stddef: don't include compiler_types.h in the uAPI header

PATCH New Jakub Kicinski 1 participant 1 message May 21, 2025

Subsystems (2)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 stddef: don't include compiler_types.h in the uAPI header

The uAPI stddef header includes compiler_types.h, a non-uAPI header. There is a hack in scripts/headers_install.sh which strips includes of compiler.h and compiler_types.h.

But AFAICT there is nothing in stddef.h which would need the include. The include dates back to when uAPI stddef.h was first created, back then the including of compiler.h was the only line in the file. So presumably stddef.h has been including compiler headers to retain some chain of dependency? Perhaps someone with more build system understanding knows what that chain would be, given kernel doesn't include uAPI stddef.h, and user space has the compiler headers stripped.

Since nothing needs this include, let's remove it. Builds pass on x86, arm64, csky, m68k, riscv32. The direct motivation for the change is that the includes of compiler.h and co. make it hard to include uAPI headers from tools/.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 include/uapi/linux/stddef.h | 2 --
 1 file changed, 2 deletions(-)
include/uapi/linux/stddef.h +0 -2
index b87df1b485c2..3da0266643e6 100644
@@ -2,8 +2,6 @@
 #ifndef _UAPI_LINUX_STDDEF_H
 #define _UAPI_LINUX_STDDEF_H
 
-#include <linux/compiler_types.h>
-
 #ifndef __always_inline
 #define __always_inline inline
 #endif
Signature · 1 line
2.49.0