Message ID | 20241203-is_constexpr-refactor-v1-0-4e4cbaecc216@wanadoo.fr (mailing list archive) |
---|---|
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63388D7833D for <linux-arm-kernel@archiver.kernel.org>; Mon, 2 Dec 2024 17:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To: Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject: From:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=VQbNxxLvKizWmipaY6ktrmBB/P4axuGO/OUGY80KUCM=; b=JO6OJskWC2cynFmUbY5ePmYUfU o5RicmmERzp2yKfM2YR6wjPvmEAILKnpJ2yAwgY70iF8ZpdSOtap0WYZMsuX2+z4nAP92bN6M3BZ+ dJ8j4eXk4l8A7eaxahpytsS7JjPZDu52tNDhegVpoVDB/HVduxREtQEY96lEja1oD4T9IAhLTlpSn DBIEr9jB0gsIrCa0/qaKhhdFakFwAiQr0CI+nPQ84j4EvnMDDl7WTI+rgf0mmLA6GZCkXgdztxe8M dMxevulHSUbPIzJMFGqpBDbo7ORlNSTDZ6VixFdJ3c/c80cQnDngBra+UDH/BxD6tXpVv1AsfDoHV gA8ojkZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tIAQ8-000000073XS-40Fd; Mon, 02 Dec 2024 17:41:16 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tIAK9-000000071zg-1H0f for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 17:35:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 320D35C0365; Mon, 2 Dec 2024 17:34:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id D02C2C4CED1; Mon, 2 Dec 2024 17:35:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733160903; bh=H6X4HxSuzHzBru4loE1fIv7uvjl0ePjrXaJ1JNnadsE=; h=From:Subject:Date:To:Cc:Reply-To:From; b=cvO1Ds0kUEVV4XP+U5TwsILj0wy1zw0nCs8k2BqpB3wKlYNvzoUniCJQW65nhjh1o saSQvVKWHUB6swLh4BekAGHyuiL7dQGD057mzrrCfRUuwd10KzdXMc8tpFW/8BnkRB 4HeDTCgax/W3CPuKaTfS5n8go2bgRAPSFtrer4xmE9FlWmX/LZZtPzC/Jez2CPdj9H 5kh1QsTxfKRNhIuSLYUGggIwNioUd/ecVgh+aInzhkQwluvfUTcIwBJUfkw6rsCVyw MzGKoRpR7joyAEBnq0jj5mfcJYOTeryL6ScLsY4B/FLWvv2G+zYK2fx6rQjA8yM9PF DjJT9eyAXyZFA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABEF6D7831C; Mon, 2 Dec 2024 17:35:03 +0000 (UTC) From: Vincent Mailhol via B4 Relay <devnull+mailhol.vincent.wanadoo.fr@kernel.org> Subject: [PATCH 00/10] compiler.h: refactor __is_constexpr() into is_const{,_true,_false}() Date: Tue, 03 Dec 2024 02:33:22 +0900 Message-Id: <20241203-is_constexpr-refactor-v1-0-4e4cbaecc216@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAGLvTWcC/x2MQQqAIBAAvxJ7TlCRqL4SEaJb7UVlNyII/550H IaZFwSZUGDuXmC8SSinBqbvIJw+HagoNgarrTPGTopkCznJhU9hxbj7cGVWZnKD9hFjcCO0tjR Dz/9d1lo/1Xd5X2cAAAA= X-Change-ID: 20241129-is_constexpr-refactor-19460adedc48 To: Linus Torvalds <torvalds@linux-foundation.org>, David Laight <David.Laight@aculab.com>, Luc Van Oostenryck <luc.vanoostenryck@gmail.com>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Bill Wendling <morbo@google.com>, Justin Stitt <justinstitt@google.com>, Yury Norov <yury.norov@gmail.com>, Rasmus Villemoes <linux@rasmusvillemoes.dk>, Kees Cook <kees@kernel.org>, "Gustavo A. R. Silva" <gustavoars@kernel.org>, Jani Nikula <jani.nikula@linux.intel.com>, Joonas Lahtinen <joonas.lahtinen@linux.intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>, Tvrtko Ursulin <tursulin@ursulin.net>, David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>, Suzuki K Poulose <suzuki.poulose@arm.com>, Mike Leach <mike.leach@linaro.org>, James Clark <james.clark@linaro.org>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Rikard Falkeborn <rikard.falkeborn@gmail.com>, Martin Uecker <Martin.Uecker@med.uni-goettingen.de> Cc: linux-sparse@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Vincent Mailhol <mailhol.vincent@wanadoo.fr> X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2878; i=mailhol.vincent@wanadoo.fr; h=from:subject:message-id; bh=H6X4HxSuzHzBru4loE1fIv7uvjl0ePjrXaJ1JNnadsE=; b=owGbwMvMwCV2McXO4Xp97WbG02pJDOm+749yHXE+efV7rnOkcu+WY3bx8n7fTmrbr7jmluH9X F7W1cW8o5SFQYyLQVZMkWVZOSe3Qkehd9ihv5Ywc1iZQIYwcHEKwER4zRkZer+7/w40uWUXt65D Rr+mWXn16tUHF2i6i7bLMZjcEecUZmQ4/WjnTadfPbbmk36KXW7f62Rq1pXeP+uB7A/2w3svHNv MBgA= X-Developer-Key: i=mailhol.vincent@wanadoo.fr; a=openpgp; fpr=ED8F700574E67F20E574E8E2AB5FEB886DBB99C2 X-Endpoint-Received: by B4 Relay for mailhol.vincent@wanadoo.fr/default with auth_id=291 X-Original-From: Vincent Mailhol <mailhol.vincent@wanadoo.fr> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_093505_432469_F931B59B X-CRM114-Status: GOOD ( 11.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Reply-To: mailhol.vincent@wanadoo.fr Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
compiler.h: refactor __is_constexpr() into is_const{,_true,_false}()
|
expand
|
This series is the spiritual successor of [1] which introduced const_true(). In [1], following a comment from David Laight, Linus came with a suggestion to simplify __is_constexpr() and its derived macros using a _Generic() selection. Because of the total change of scope, I am starting a new series. The goal is to introduce a set of three macros: - is_const(): a one to one replacement of __is_constexpr() in term of features but written in a less hacky way thanks to _Generic(). - is_const_true(): tells whether or not the argument is a true integer constant expression. - is_const_false(): tells whether or not the argument is a false integer constant expression. Once defined, apply them tree-wide. All those three macros will rely on a single building block: __is_const_zero(). Patch 1 adds statically_false(). This is just done so that at the end of this series, the full set of statically_true/false() and is_const_true/false() is present. Patch 2 adds __is_const_zero() and is_const(). Patch 3 adds is_const_true() and is_const_false(). Patch 4 to 9 do a tree-wide replacement to remove all the usages of __is_constexpr() and replace them by is_const_true() or is_const_false() whenever feasible, or by is_const() otherwise. Patch 10 finally remove __is_constexpr(). RIP! [1] add const_true() to simplify GENMASK_INPUT_CHECK() Link: https://lore.kernel.org/all/20241113172939.747686-4-mailhol.vincent@wanadoo.fr/ Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> --- Vincent Mailhol (10): compiler.h: add statically_false() compiler.h: add is_const() as a replacement of __is_constexpr() compiler.h: add is_const_true() and is_const_false() linux/bits.h: simplify GENMASK_INPUT_CHECK() by using is_const_true() minmax: simplify __clamp_once() by using is_const_false() fortify: replace __is_constexpr() by is_const() in strlen() overflow: replace __is_constexpr() by is_const() drm/i915/reg: replace __is_const_expr() by is_const_true() or is_const() coresight: etm4x: replace __is_const_expr() by is_const() compiler.h: remove __is_constexpr() drivers/gpu/drm/i915/i915_reg_defs.h | 47 +++++------ drivers/hwtracing/coresight/coresight-etm4x.h | 2 +- include/linux/bits.h | 5 +- include/linux/compiler.h | 112 +++++++++++++++----------- include/linux/fortify-string.h | 4 +- include/linux/minmax.h | 3 +- include/linux/overflow.h | 8 +- 7 files changed, 97 insertions(+), 84 deletions(-) --- base-commit: e70140ba0d2b1a30467d4af6bcfe761327b9ec95 change-id: 20241129-is_constexpr-refactor-19460adedc48 Best regards,