]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
kbuild: uapi: provide a C++ compatible dummy definition of NULL
authorThomas Weißschuh <linux@weissschuh.net>
Mon, 16 Mar 2026 16:52:01 +0000 (17:52 +0100)
committerNicolas Schier <nsc@kernel.org>
Wed, 25 Mar 2026 12:24:41 +0000 (13:24 +0100)
NULL works differently in C++ compared to C.

To allow testing the UAPI headers against C++ compilers, provide
a variant of NULL which works with those.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20260316-kbuild-uapi-c-v2-4-35d6d0ed863f@weissschuh.net
Signed-off-by: Nicolas Schier <nsc@kernel.org>
usr/dummy-include/stddef.h

index a61703d1c896322625012fed3bbed07baf09bf95..525489daffe2e4138c1a5f84ed328197fb9df4a1 100644 (file)
@@ -3,6 +3,11 @@
 #define _DUMMY_STDDEF_H
 
 #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
+
+#ifdef __cplusplus
+#define NULL 0
+#else
 #define NULL ((void *)0)
+#endif
 
 #endif /* _DUMMY_STDDEF_H */