From nobody Thu Apr 9 13:31:44 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 2CFEF3469F6; Sun, 8 Mar 2026 21:24: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=1773005049; cv=none; b=YkyubMm/QNErcSK/vlP2LdkicLlqq6KhIrw4nP7pueZ3/r+pxKcbN7fIJyZhJY3sDGnGcMEbf12ZnAWHyiVNqq+pQ/ROtB2nqlQTUCwqpiP2eEsUhT2Ifug7Y25VBcryA2v6sQ4TWFdW6xgZkMkNFhh9dOHwmTPxIktaPOIawEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773005049; c=relaxed/simple; bh=Ie8JyQr29CSVgjSQS2X0Z0dBIBrZdPaXfIGJOlLEwHg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jfKrCteEdic/To0KvftngLRtg8RocP5PWwkRDOhbJ9JG35gZTQaT7Y2HMGSmxN0g9I109ABDxUdvt57S7z74t3UxRONF1zHM+Vdt0X3um4zk5MHrd9Gira3uCmkT/K0dHn/1PRsYndH7X25fAxdd9yDHHyHKLoy6NpRiekUEZkM= 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=D1VlyvgL; 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="D1VlyvgL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1773005045; bh=Ie8JyQr29CSVgjSQS2X0Z0dBIBrZdPaXfIGJOlLEwHg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=D1VlyvgLIz87gV3RK1FKkEE2I3cuVHU6EU3BBXIyxMVcqamwddG57yQ57jF8QPbOw cxh3InUgVxPTAVVwqyPtNSzRnVudL7oNFEFvsRqwnJuwOcIGOop+QKaulsO6YgQwCL LUJWTpYcgx+oWJOoXlrWKHiHJ3mmGJi/+IRiiErM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 08 Mar 2026 22:24:01 +0100 Subject: [PATCH RFC 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: <20260308-kbuild-uapi-c-v1-1-86aae09a7f1d@weissschuh.net> References: <20260308-kbuild-uapi-c-v1-0-86aae09a7f1d@weissschuh.net> In-Reply-To: <20260308-kbuild-uapi-c-v1-0-86aae09a7f1d@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=1773005045; l=1251; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Ie8JyQr29CSVgjSQS2X0Z0dBIBrZdPaXfIGJOlLEwHg=; b=WZH4lRI88tNFN2Djiy+PTrJVqBDBPOUiMKQsH89XeLk/xxo5O09yk37HdwwT9ml8AA2/mnTQn PoqlGgj9O66DHPGgVar5rMuCNQWvaQqzzpmSr3ybfTxFu1NvZtBI0OK 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 Thu Apr 9 13:31:44 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 5F88C293C42; Sun, 8 Mar 2026 21:24:08 +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=1773005050; cv=none; b=NJl5Ef4BFDKoHp0L3zaJVurM4d0teQyHIzBK2BSxfdXttwJntz8m40D+vhlGYdhmLlMEZf2zDYvIW4f7UIr6bRNN/BNP+IF8CK0yWZExPeuQF62wIFw64td46ofK+bXPq7EUGVouK0FmnKOEC7GnqsK2FJXKnE2PGvEpqfXQCEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773005050; c=relaxed/simple; bh=XE7aQ63fDTs412GySTUGTx0WOylnFvUIjIK4NeXoh7E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bTtaQGKmYexb7Zm6aPo02fzJoRLWTu02n1H9tR1IT4F0uCsS0f/yLA8NUQDyZLuDhtl3oPvqfmP9eyYMq1k5mlJ2OTFG4eWehhWxyxPw5f+2TUEDySVGTbTofhe+G53yAJpLCBH+xAeHgiOepKXCGxzHPaz34Q2uuQEGYN4YRnI= 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=gHUZLCcO; 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="gHUZLCcO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1773005045; bh=XE7aQ63fDTs412GySTUGTx0WOylnFvUIjIK4NeXoh7E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gHUZLCcOua6UDErCT7bhkhaI/2hF3ivIQbj9DGD/AGSeseb+jaiZnWCFfjNvXI09p FDRDmio3loHaxCp6zil5yW+9qtU9sg7riJN8IpaYsb0dVIYg2JLfcwoPfvbWJYLv5z 2OJtVXl91IOHar4OFQ+zfLKX30sY/UhggnXXaXyw= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 08 Mar 2026 22:24:02 +0100 Subject: [PATCH RFC 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: <20260308-kbuild-uapi-c-v1-2-86aae09a7f1d@weissschuh.net> References: <20260308-kbuild-uapi-c-v1-0-86aae09a7f1d@weissschuh.net> In-Reply-To: <20260308-kbuild-uapi-c-v1-0-86aae09a7f1d@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=1773005045; l=1368; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=XE7aQ63fDTs412GySTUGTx0WOylnFvUIjIK4NeXoh7E=; b=ZO4Yq5LW0IBrj2Q+7Tw5mcg/rGyBZTalt6dR9AKpcsZq7I12x3JmNOzfSK3EKD6lkwVkBQ5gl kdvw+bXoZRGC0tFEzWzonH4Tizdz9OgT/1U71Agu4g5BW3kwW+PCF88 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 Thu Apr 9 13:31:44 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 46F1A355F25; Sun, 8 Mar 2026 21:24:08 +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=1773005049; cv=none; b=ftoKUb0DVF1aY0BsXHvvA5MjViVPYNcawM7M+vYyJNtSe0mkOvHHGx6mPyBFk28UCFDaqBqTuK6fFY2sG/YaeZi98Wdem61i0BsVJUyw3yRTBqq7h2tb2yyrzftsXHKphFRJ6+4SAvWWZWhT4/A4i+Sg9cKZUxK/2CNAD6baxaU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773005049; c=relaxed/simple; bh=HwLfblw+VRZLHJdgjzQhIHg+sRaFcsc1K0c5qr+oBMY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=frfoDmLm5wbkV4udeaF9dMnYVJKh09238czFybUFXuEtm4NLlqzKmFcJ1zW1qyb/pQXqmdru/Nv7c48xKx0nACuZ9SsZ5rigH+RGAjDETDzhBpec32txGFH7ViNn7PJP6faIg/FJtTJ6U/mUlP7PFOlZ9WInqqNpc/zljCkVk/o= 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=ebT2VyAB; 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="ebT2VyAB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1773005045; bh=HwLfblw+VRZLHJdgjzQhIHg+sRaFcsc1K0c5qr+oBMY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ebT2VyABQsUQ5DK/pJmOfS9GUdwU6LaQk8qxfBLC2h3+okQrXd8PHg6Cz54yF0xwq likZpZziXxOcMUpBsaYwZbMAKWfa388RlQVWhBtmXlONKd/KkHUTrqWUeFwYOanYGj UaedLySmuNzei4jTPVwC1Le58INJVQsS3L4t5www= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 08 Mar 2026 22:24:03 +0100 Subject: [PATCH RFC 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: <20260308-kbuild-uapi-c-v1-3-86aae09a7f1d@weissschuh.net> References: <20260308-kbuild-uapi-c-v1-0-86aae09a7f1d@weissschuh.net> In-Reply-To: <20260308-kbuild-uapi-c-v1-0-86aae09a7f1d@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=1773005045; l=1749; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=HwLfblw+VRZLHJdgjzQhIHg+sRaFcsc1K0c5qr+oBMY=; b=DIDGAfWpVSn7G2ouaCJofvVSnkFxYDIZQRSGfJxtScz56ikvQv5mWzrSigzV14hjhZO7nYBMm ZwakK5g3dZBAJ1ckmGOzCa8S+WqZ8s3ZQkMEO5YQdiN6bVsYie877+7 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 Thu Apr 9 13:31:44 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 2D07334F498; Sun, 8 Mar 2026 21:24:08 +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=1773005049; cv=none; b=NZgdDHMG6fV2lRICFJ+V6Ef35x/BB3N6x0aK1EHyCW0CA5XxTZO24O52plYsoky2j69RXHcicJBB2LkUwsniWACtgfAxsP6QZuPmvqsE+9DTz+Es9H8tpEP/HP5tqRHfrIbSxD4jQ6//4Hp+TW32i13oy4miWz69VMS+ZENmeeo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773005049; c=relaxed/simple; bh=OVCw2lloa52/3LAY7ZS7KGho3Qo9V87Zi0bQjk321xA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YW8b9mj2K91x8fxXdeC7UzmdCVy/uuS/lDpWFVZ14lHxULOuIUtACwmRz59bnFo/GQVP7TxpYvW1BiHoQzOw6uDahHqpMnEvEiZry7Rigdhe+SMptANXG2SMKahHUYWDhoVsrsks4HJThHnCC5Fe6LHKiGGJFRtUqD8+OYiYPSI= 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=q1zbBMWh; 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="q1zbBMWh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1773005046; bh=OVCw2lloa52/3LAY7ZS7KGho3Qo9V87Zi0bQjk321xA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=q1zbBMWhTd+g4ofSbLLO2+TBhfeOtwpvh9CKz2qvBj+Y8MxQG5aUJH4XtPDw/nIcY I/iaRrCBR0IkgcWkj5SjIvTrStWn3zx5Lng2jopIfim5aG5jsBu0XdzSV5jCwEI2Ze 3IgPpvZ9tmdNyRXg+MTZhfdAcSr174P5H2+8k7dI= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 08 Mar 2026 22:24:04 +0100 Subject: [PATCH RFC 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: <20260308-kbuild-uapi-c-v1-4-86aae09a7f1d@weissschuh.net> References: <20260308-kbuild-uapi-c-v1-0-86aae09a7f1d@weissschuh.net> In-Reply-To: <20260308-kbuild-uapi-c-v1-0-86aae09a7f1d@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=1773005045; l=722; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=OVCw2lloa52/3LAY7ZS7KGho3Qo9V87Zi0bQjk321xA=; b=NPZNlEGF4j6TEYivWhMyXkthkDtEXpZFvnQdHtEg6fZx2a+I/NwMF/uAfGFhRNHyU3TfMz8HU Gdyxh+ppn1hAIgN3XKjzI71XCr6zsHpavYrCg/YWbyxl/pSj+O5Bxxd 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 Thu Apr 9 13:31:44 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 EC8D135DA71; Sun, 8 Mar 2026 21:24:10 +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=1773005052; cv=none; b=elCsm+xKifKQjLAU8Iqs76l+adPkE11K6uumSPLemfhEemNCwz/NRcPR/0PK/LTIga/o3aTmJYrAz+kFlcvd0Paqyzn0Of3kw+WPbmtdqiRUlhrAT7NPtpwVBTtGbz7vGCO7ecZggDAB5D8gkAly+sDKUJ+6Vb/iZ+egmfkw5WA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773005052; c=relaxed/simple; bh=8Xb6jJpdwO7R7c+RLnF9gP8gw2AUKUlOxUqqqcY0FA0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oCKjDCGWqZDmxU16bIO58ctovH1hXDAl1qlOEARWLAaYR9yLS1c5QTOK6zIXKT0qfdSS7L6IrL/vVo6lmFL3u9n9zh29chwmWUhL6PkiYz6GcyyWB1ETlEqUQF2Vm09J5q9WJJJWz81PAMRLofrCLGmOa0mkJXKOKkBIcR7ifbQ= 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=JK1d4TOc; 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="JK1d4TOc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1773005046; bh=8Xb6jJpdwO7R7c+RLnF9gP8gw2AUKUlOxUqqqcY0FA0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JK1d4TOcFfLslpBSbnx/9uF72ChMsLValB48qh2RwiP4xT9IrA8cGGQkSMy/Tgl4t jfb4IFmd2WbyjXn7roSYU0vsrNRlyVJQjxghHHj8eeshbvkLf4+FABHw0VFr+4FZge 2bvgvNSFuOrWUh4wjZNOAHRZIoXudVTkdzXGYrbM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 08 Mar 2026 22:24:05 +0100 Subject: [PATCH RFC 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: <20260308-kbuild-uapi-c-v1-5-86aae09a7f1d@weissschuh.net> References: <20260308-kbuild-uapi-c-v1-0-86aae09a7f1d@weissschuh.net> In-Reply-To: <20260308-kbuild-uapi-c-v1-0-86aae09a7f1d@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=1773005045; l=2840; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=8Xb6jJpdwO7R7c+RLnF9gP8gw2AUKUlOxUqqqcY0FA0=; b=0Wxl00PsQjn++HA/NrUflyKm0sM7sHvgM9X/ELqGnNImzexv0Vb+lTWcZZSMOollS4ssaE7BR r+ssUz0q7JDCdbz+BzzWTpiMlj5/JS3yfnbVGdTEUbKa9BjvRZ2lLvD 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..0e23aeace410 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) -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