From nobody Tue Apr 7 02:36:12 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BCC53CEB86; Mon, 16 Mar 2026 16:52:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773679929; cv=none; b=rkEKDHT1IeoqSL1tnK+tLzwyc1+y9k5r4PpM6Mj9xMvl5DeEsHcEQLxK0lq2vHCGzIjsw4F++7mpG8cFsrnE2f1tzy5JoGiLyPDptPD1DRdPMf7grY0oCTjeGRA+7YHHv+3cC7EVTVNIkFQ1VGYSw3TynE3UBpTA/QI/2ZXVPJk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773679929; c=relaxed/simple; bh=KJB6ACbqbsbmqAxi4TNeW9jRlGOcSgydMfqFKK95WM0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MDJU1UNKdcVmrnffh/Pk8Eyv9t+wC66+sh2S96MBF8cVFWFMGf5/VDxEibwM4ZIPtQNN9wv5BU0KcEZEURBP/de2dgXiADfc35dh6nerOegGiuJdV2cVelWi0ehV83t+r5vZ4KeGpRo2z/4EJzxXX7aXaXBkUGVbc5O+qD0KTpM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=Tkv29Ver; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="Tkv29Ver" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1773679918; bh=KJB6ACbqbsbmqAxi4TNeW9jRlGOcSgydMfqFKK95WM0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Tkv29VerNzJM2z4+etbifZRwjYB7nHEqIV3H1eSBwOhkJKHRO8GTCG+h0RYRiPhQu 3F2huUhuylpG9JYmdulttgKuL0GaXz41LEqcs5mRxM4h6nlFm7J5G8khXfJ0/9soFt UyRaqHZfYe/KSV/TVYR6vrxYn0KJHU2KUD902vg4= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 16 Mar 2026 17:51:58 +0100 Subject: [PATCH v2 1/5] kbuild: uapi: move some compiler arguments out of the command definition Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260316-kbuild-uapi-c-v2-1-35d6d0ed863f@weissschuh.net> References: <20260316-kbuild-uapi-c-v2-0-35d6d0ed863f@weissschuh.net> In-Reply-To: <20260316-kbuild-uapi-c-v2-0-35d6d0ed863f@weissschuh.net> To: Arnd Bergmann , Nathan Chancellor , Nicolas Schier Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773679918; l=1303; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=KJB6ACbqbsbmqAxi4TNeW9jRlGOcSgydMfqFKK95WM0=; b=xRx+cpWD98y2DtwtWIeIZxMbitA+oMdD9s5V8wsXoG30KJKodjJY1DSJy5ULwXM/k14WVJyMS zzgSl24fQBmDFkNkSr4qBC+36TxLckkD5D5kkDLMlJSDyDMnKPzo2T/ X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Simplify the definition of cmd_hdrtest by moving some of it to a new variable. This will both enable the upcoming reuse of those flags and also the extension of cmd_hdrtest. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Nathan Chancellor --- usr/include/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr/include/Makefile b/usr/include/Makefile index 845d06b63c2b..0b1c9a4b0477 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -140,11 +140,13 @@ always-y :=3D $(patsubst $(obj)/%.h,%.hdrtest, $(shel= l find $(obj) -name '*.h' 2>/ target-libc =3D $(filter $(uses-libc), $*.h) target-can-compile =3D $(filter-out $(no-header-test), $*.h) =20 +hdrtest-flags =3D -fsyntax-only -Werror \ + -nostdinc $(if $(target-libc), -I $(srctree)/usr/dummy-include) + # Include the header twice to detect missing include guard. quiet_cmd_hdrtest =3D HDRTEST $< cmd_hdrtest =3D \ - $(CC) $(c_flags) -fsyntax-only -Werror -x c /dev/null \ - -nostdinc $(if $(target-libc), -I $(srctree)/usr/dummy-include) \ + $(CC) $(c_flags) $(hdrtest-flags) -x c /dev/null \ $(if $(target-can-compile), -include $< -include $<); \ $(PERL) $(src)/headers_check.pl $(obj) $<; \ touch $@ --=20 2.53.0 From nobody Tue Apr 7 02:36:12 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1CC73CE4B5; Mon, 16 Mar 2026 16:52:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773679929; cv=none; b=BB8gN0SWR4AhoZ8fYMFGeAZu6TC6lOnF/eOS+6oiINoYxhpsjRgZr7yMdO/0h8tz496baudhzwoj8KBhvwHNpOeOCySHTHapRSN0s+yFngHRCnw5hioMH7Gpa2QauzG6q6b5euCNVGR93nq4DgAwSn89QnJltygPhlfZJn2NbwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773679929; c=relaxed/simple; bh=gLGpjutcwzsXPcLImqBkJxEAGC97psYwvwNqYhNwweM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LFS54ZrSC4opIRN9eZvsRShIrjmWkgW6y3NDyOUCuqjMJZ1wI2dLyxzZt9Flv2zoSnwgYFETtyYUwynRbvSjf2xqPPaRlDXBgd7Gf+fdf5Q9heNH7hcSkNqCi/rDQq/9gFV5dj4ni83L9Y9VYJHT37dL0sCF0ZhqC3jCLsUw0Jc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=F/RTx7Ra; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="F/RTx7Ra" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1773679918; bh=gLGpjutcwzsXPcLImqBkJxEAGC97psYwvwNqYhNwweM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=F/RTx7RacW5waBmuTTpcGsn8RKec+YSA2YH7Yju/DcJB07SeAta3nAg2mGkyBWRlE S/3INKMTh+fOfp+MYtIBMGM7w4+Uis7WrvGnfbLzukPHEvqc7niiv9aSlmsM/9oKDv C89x5qXSoBigJ6DaM6snDQr2PLtXli/P9qxldU5E= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 16 Mar 2026 17:51:59 +0100 Subject: [PATCH v2 2/5] kbuild: uapi: move all include path flags together Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260316-kbuild-uapi-c-v2-2-35d6d0ed863f@weissschuh.net> References: <20260316-kbuild-uapi-c-v2-0-35d6d0ed863f@weissschuh.net> In-Reply-To: <20260316-kbuild-uapi-c-v2-0-35d6d0ed863f@weissschuh.net> To: Arnd Bergmann , Nathan Chancellor , Nicolas Schier Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773679918; l=1420; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=gLGpjutcwzsXPcLImqBkJxEAGC97psYwvwNqYhNwweM=; b=ieC6qflpP/h0uMNU+D3WMq8J4cuQJpRGIzyQCSEdiigXPW2afNPa9B0kgxMNqmbJy+7kwYfV4 xDkKXWNx2lNC7Y0cTUMXCIuNunAUbGRvMRYX6zMEZRncgTkhMIGCl8f X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The argument to add the root of the UAPI header tree to the include path is separated from the other arguments concerning the include path. Move all include path arguments together for more consistency and balanced line lengths. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Nathan Chancellor --- usr/include/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/include/Makefile b/usr/include/Makefile index 0b1c9a4b0477..74f5ba24bb29 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -8,7 +8,7 @@ # We cannot go as far as adding -Wpedantic since it emits too many warning= s. UAPI_CFLAGS :=3D -std=3Dc90 -Werror=3Dimplicit-function-declaration =20 -override c_flags =3D $(KBUILD_USERCFLAGS) $(UAPI_CFLAGS) -Wp,-MMD,$(depfil= e) -I $(obj) +override c_flags =3D $(KBUILD_USERCFLAGS) $(UAPI_CFLAGS) -Wp,-MMD,$(depfil= e) =20 # The following are excluded for now because they fail to build. # @@ -141,7 +141,7 @@ target-libc =3D $(filter $(uses-libc), $*.h) target-can-compile =3D $(filter-out $(no-header-test), $*.h) =20 hdrtest-flags =3D -fsyntax-only -Werror \ - -nostdinc $(if $(target-libc), -I $(srctree)/usr/dummy-include) + -nostdinc -I $(obj) $(if $(target-libc), -I $(srctree)/usr/dummy-include) =20 # Include the header twice to detect missing include guard. quiet_cmd_hdrtest =3D HDRTEST $< --=20 2.53.0 From nobody Tue Apr 7 02:36:12 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BBD63CEB81; Mon, 16 Mar 2026 16:52:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773679928; cv=none; b=BDNYvFDmYccB8NwaehzD+5ZyeGJYSH6iQgbxT3rZyxs0fqINhEkctYoElkOL0Y/1ZJKjHlle5NsE42PTwzgRIF1eKgc4WiY4uMLfo2WDyWMuvYRle2bQe1YgSpLNqvCFQyaUfni2m3ZdBfTW2H3fA64gpJQ7oAYltycOBfeGQ1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773679928; c=relaxed/simple; bh=z2AvZfG8GcS99zV3OiirtbN+15thog5DinQQx8lMQUw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GkfcvOuZSbbiaPjyc7n0ZY2oTWzsSEdMFjqKElSiYyWasq9uGuq/MjgI5Gs6MK35LQFYb93qNnIR6dNTukVcXIvJ6Uzt5T/7FpX2WEmiF3QK4m50s+OlV6Dr5DFvTyWIDn9IUTJqdx8rapMpjMHXuDbAPSXWtiL5mB91jlyZV88= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=RF48Uf7w; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="RF48Uf7w" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1773679918; bh=z2AvZfG8GcS99zV3OiirtbN+15thog5DinQQx8lMQUw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=RF48Uf7w08mamxeCy3LPzIfRte8hXMAqLNHTsTNwTchjLTjvhsPB1oHCls2KGCIlb /QuUwvLzCUg70V1GM5YxkU3nzL4KQwHERQRlrbPZqvJDONu6bA8RQ+xa+DtnMjmLEH bf3y5mgJ5kc038ajEvF+w5qIy717V7t0rOYFvab8= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 16 Mar 2026 17:52:00 +0100 Subject: [PATCH v2 3/5] kbuild: uapi: handle UML in architecture-specific exclusion lists Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260316-kbuild-uapi-c-v2-3-35d6d0ed863f@weissschuh.net> References: <20260316-kbuild-uapi-c-v2-0-35d6d0ed863f@weissschuh.net> In-Reply-To: <20260316-kbuild-uapi-c-v2-0-35d6d0ed863f@weissschuh.net> To: Arnd Bergmann , Nathan Chancellor , Nicolas Schier Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773679918; l=1801; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=z2AvZfG8GcS99zV3OiirtbN+15thog5DinQQx8lMQUw=; b=rqcVN0QYUjyJcbX8MmtF13vqEKYIEQ6bHNjZ9p0Ho6d08Napv4js/F8ir9osEv5DNYc7hNXc7 BvBHQ9bFY1YArTzlihvWr6CfK3qtmhSb0utS85bDkRifgnv7LqcSfB7 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= When building User Mode Linux SRCARCH is set to 'um', while the actual underlying architecture is provided in HEADER_ARCH. Allow the exclusion lists to work on UML by comparing against HEADER_ARCH when that is available. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Nathan Chancellor --- usr/include/Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/usr/include/Makefile b/usr/include/Makefile index 74f5ba24bb29..edeaf9d778c4 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -7,6 +7,7 @@ # -std=3Dc90 (equivalent to -ansi) catches the violation of those. # We cannot go as far as adding -Wpedantic since it emits too many warning= s. UAPI_CFLAGS :=3D -std=3Dc90 -Werror=3Dimplicit-function-declaration +UAPI_ARCH :=3D $(or $(HEADER_ARCH),$(SRCARCH)) =20 override c_flags =3D $(KBUILD_USERCFLAGS) $(UAPI_CFLAGS) -Wp,-MMD,$(depfil= e) =20 @@ -48,11 +49,11 @@ no-header-test +=3D xen/privcmd.h =20 # More headers are broken in some architectures =20 -ifneq ($(filter arc openrisc xtensa nios2, $(SRCARCH)),) +ifneq ($(filter arc openrisc xtensa nios2, $(UAPI_ARCH)),) no-header-test +=3D linux/bpf_perf_event.h endif =20 -ifeq ($(SRCARCH),sparc) +ifeq ($(UAPI_ARCH),sparc) no-header-test +=3D asm/uctx.h no-header-test +=3D asm/fbio.h endif @@ -122,15 +123,15 @@ uses-libc +=3D linux/wireless.h uses-libc +=3D regulator/regulator.h uses-libc +=3D scsi/fc/fc_els.h =20 -ifeq ($(SRCARCH),hexagon) +ifeq ($(UAPI_ARCH),hexagon) uses-libc +=3D asm/sigcontext.h endif =20 -ifeq ($(SRCARCH),nios2) +ifeq ($(UAPI_ARCH),nios2) uses-libc +=3D asm/ptrace.h endif =20 -ifeq ($(SRCARCH),s390) +ifeq ($(UAPI_ARCH),s390) uses-libc +=3D asm/chpid.h uses-libc +=3D asm/chsc.h endif --=20 2.53.0 From nobody Tue Apr 7 02:36:12 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1C36339872; Mon, 16 Mar 2026 16:52:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773679928; cv=none; b=YdwV6ImcUvup1bMeSyov7O9DJhKMFJrTPHJh6kjxqRZhaA08rjaWw+KFp2eznDsrNURyETgG8IvXDhpSNBaELR7d0En0ldP/pokgvhJIrgo1+5p1wuaThhNVM3a2db6PHH3+U8a//TD5DLfRvrheZOuVRDNgtaGQ8pminj3XLHY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773679928; c=relaxed/simple; bh=fXZsbxaGn7gXyBNn9a1815Xva7zjv/XPM15Bx/AZ+u4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VjlgswWr3HKC1wl0lRinZKAZfF9Nq6J+zU54YMEJiIcw3QXHTZEMFuKnzRHhLc9zBzaHtdbHTYbvobsko4SK9kBC8UnB1HaASo/IPRSlY862psPlKJoTZzvmwNVKs51lGyBsT2Fh+babbYVQ8DFnHUbWIaBAwxYCDMqBZx4IdUo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=omkWFqnb; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="omkWFqnb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1773679918; bh=fXZsbxaGn7gXyBNn9a1815Xva7zjv/XPM15Bx/AZ+u4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=omkWFqnb9oJVDsoh8uowWc6yiDRijjWldhocf/CFQDWuVmH1gn06GI4DwkpKSrkmM hhD09c4ziXrEYiBxx8GWAD89nb6E5et+WMBPfyNE+iNGMRzIDUE4oLl3IDsRk9hjyD WA8NK92E+w146iusW6Ysyg0A/88WcrrvRNcZeRG0= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 16 Mar 2026 17:52:01 +0100 Subject: [PATCH v2 4/5] kbuild: uapi: provide a C++ compatible dummy definition of NULL Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260316-kbuild-uapi-c-v2-4-35d6d0ed863f@weissschuh.net> References: <20260316-kbuild-uapi-c-v2-0-35d6d0ed863f@weissschuh.net> In-Reply-To: <20260316-kbuild-uapi-c-v2-0-35d6d0ed863f@weissschuh.net> To: Arnd Bergmann , Nathan Chancellor , Nicolas Schier Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773679918; l=774; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=fXZsbxaGn7gXyBNn9a1815Xva7zjv/XPM15Bx/AZ+u4=; b=WaOLXlWcq3BVZytcn52ZchCb+6Bx+FXm69Jws2mFBXzP2O0eLk7t7uZD4C3OCLwlMeWsHBeWD e2h3UpXL/dsBM+Cuj/xK3Sr6Ox+IziPnsAiyXexo6eSZBKg7BXK3PcB X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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=C3=9Fschuh Reviewed-by: Nathan Chancellor --- usr/dummy-include/stddef.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr/dummy-include/stddef.h b/usr/dummy-include/stddef.h index a61703d1c896..525489daffe2 100644 --- a/usr/dummy-include/stddef.h +++ b/usr/dummy-include/stddef.h @@ -3,6 +3,11 @@ #define _DUMMY_STDDEF_H =20 #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) + +#ifdef __cplusplus +#define NULL 0 +#else #define NULL ((void *)0) +#endif =20 #endif /* _DUMMY_STDDEF_H */ --=20 2.53.0 From nobody Tue Apr 7 02:36:12 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0F653CF67E; Mon, 16 Mar 2026 16:52:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773679931; cv=none; b=jeIn+npXVoR1/r8RsgWGe91fnOl64oM4ne8o/PVhWt/KbkmDw3cwHDXVFwUVnKvwhJe823PNVWHuIcQw4FsHA9WvG9+1Fan5lPOrdJAivzvLReTY5djnu4A/Adr3BGSKfQH+b7gJ39QfamR4ioV5WHtVVN5PsqGapn3fvpo65A4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773679931; c=relaxed/simple; bh=/d9uTb8lpguhHEi+JxjNFpFcFYqtR3gJDfleYqFkWsA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DrIYzQZ0IqnysMjipUVEErZwFgup/eeU2cmAh1wKEnuNwbeDxFlSTR7DgHBSKpB3b8gHfNRB4/W4+sawpUOoLO3MclfCI+qtzJsyV1lQsH7OrKBzPe4Nv7lVF7rCckGMKKBLX5f2RYwkWaBiz/l6db0KdH5RkM48Q0fHsHkYTe8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=aOdBU55F; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="aOdBU55F" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1773679919; bh=/d9uTb8lpguhHEi+JxjNFpFcFYqtR3gJDfleYqFkWsA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aOdBU55FO8krvC33X6aufc7I2rcIK5hwdi7HBpKyCibg6OLQ0eOtte2nULErYwmwg HhYYLxM+cNXgaoz8zstPn/8w06x79gILZWK7HXL24CiLL820uGjK0WBntZ2LmPuLcE dBjo/fIDvK7bZbgyQJ6B+WTHuuQzjZNWueNPtW0k= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 16 Mar 2026 17:52:02 +0100 Subject: [PATCH v2 5/5] kbuild: uapi: also test UAPI headers against C++ compilers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260316-kbuild-uapi-c-v2-5-35d6d0ed863f@weissschuh.net> References: <20260316-kbuild-uapi-c-v2-0-35d6d0ed863f@weissschuh.net> In-Reply-To: <20260316-kbuild-uapi-c-v2-0-35d6d0ed863f@weissschuh.net> To: Arnd Bergmann , Nathan Chancellor , Nicolas Schier Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1773679918; l=2907; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=/d9uTb8lpguhHEi+JxjNFpFcFYqtR3gJDfleYqFkWsA=; b=Rf867dfg8pc2Ei9wBq/ZCIroWe5YVBnjK5uI2gGJozOIKdMiLs/9BFhbMEFVZK2WQYpDSgB4+ 55L9z8rkRogBzlGKzczyFpVYF6Rpq7lzsC8AB6JVJ7N7c6R7JJSxOAs X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= C++ language requirements differ from those of C. Also test the headers against C++ compilers to make sure no errors creep in accidentally. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Nathan Chancellor --- usr/include/Makefile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/usr/include/Makefile b/usr/include/Makefile index edeaf9d778c4..ee69dd9d970e 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -10,6 +10,7 @@ UAPI_CFLAGS :=3D -std=3Dc90 -Werror=3Dimplicit-function-d= eclaration UAPI_ARCH :=3D $(or $(HEADER_ARCH),$(SRCARCH)) =20 override c_flags =3D $(KBUILD_USERCFLAGS) $(UAPI_CFLAGS) -Wp,-MMD,$(depfil= e) +cxx_flags =3D $(filter-out -Wmissing-prototypes -Wstrict-prototypes -std= =3D%, $(KBUILD_USERCFLAGS)) -std=3Dc++98 =20 # The following are excluded for now because they fail to build. # @@ -61,6 +62,27 @@ endif # asm-generic/*.h is used by asm/*.h, and should not be included directly no-header-test +=3D asm-generic/% =20 +# The following are not compatible with C++. +# +# Do not add a new header to the list without legitimate reason. +# Please consider to fix the header first. +# +# Sorted alphabetically. +no-header-test-cxx +=3D linux/auto_dev-ioctl.h +no-header-test-cxx +=3D linux/map_to_14segment.h +no-header-test-cxx +=3D linux/map_to_7segment.h +no-header-test-cxx +=3D linux/netfilter/xt_sctp.h +no-header-test-cxx +=3D linux/target_core_user.h +no-header-test-cxx +=3D linux/vhost.h +no-header-test-cxx +=3D linux/vhost_types.h +no-header-test-cxx +=3D linux/virtio_net.h +no-header-test-cxx +=3D linux/virtio_ring.h +no-header-test-cxx +=3D scsi/fc/fc_els.h + +ifeq ($(UAPI_ARCH),x86) +no-header-test-cxx +=3D asm/elf.h +endif + # The following are using libc header and types. # # Do not add a new header to the list without legitimate reason. @@ -138,8 +160,12 @@ endif =20 always-y :=3D $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '= *.h' 2>/dev/null)) =20 +# $(cc-option) forces '-x c' which breaks '-x c++' detection. +cc-can-compile-cxx :=3D $(call try-run,$(CC) $(CLANG_FLAGS) -c -x c++ /dev= /null -o "$$TMP", 1) + target-libc =3D $(filter $(uses-libc), $*.h) target-can-compile =3D $(filter-out $(no-header-test), $*.h) +target-can-compile-cxx =3D $(and $(cc-can-compile-cxx), $(target-can-compi= le), $(filter-out $(no-header-test-cxx), $*.h)) =20 hdrtest-flags =3D -fsyntax-only -Werror \ -nostdinc -I $(obj) $(if $(target-libc), -I $(srctree)/usr/dummy-include) @@ -149,6 +175,8 @@ quiet_cmd_hdrtest =3D HDRTEST $< cmd_hdrtest =3D \ $(CC) $(c_flags) $(hdrtest-flags) -x c /dev/null \ $(if $(target-can-compile), -include $< -include $<); \ + $(if $(target-can-compile-cxx), \ + $(CC) $(cxx_flags) $(hdrtest-flags) -x c++ /dev/null -include $<;) \ $(PERL) $(src)/headers_check.pl $(obj) $<; \ touch $@ =20 --=20 2.53.0