[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241203-is_constexpr-refactor-v1-10-4e4cbaecc216@wanadoo.fr>
Date: Tue, 03 Dec 2024 02:33:32 +0900
From: Vincent Mailhol via B4 Relay <devnull+mailhol.vincent.wanadoo.fr@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
David Laight <David.Laight@...lab.com>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>,
Yury Norov <yury.norov@...il.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>, Kees Cook <kees@...nel.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Tvrtko Ursulin <tursulin@...ulin.net>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>, James Clark <james.clark@...aro.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Rikard Falkeborn <rikard.falkeborn@...il.com>,
Martin Uecker <Martin.Uecker@....uni-goettingen.de>
Cc: linux-sparse@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, linux-hardening@...r.kernel.org,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
Vincent Mailhol <mailhol.vincent@...adoo.fr>
Subject: [PATCH 10/10] compiler.h: remove __is_constexpr()
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Now that all the users of __is_constexpr() have been migrated to
is_const() or one of its friends, remove it.
The homage to Martin Uecker's genius hack remains in the documentation
of __is_const_zero().
Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
---
include/linux/compiler.h | 47 -----------------------------------------------
1 file changed, 47 deletions(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 165aa5b9bc484376087a130a1ac1f3edb50c983d..7ba75044828129cf1f81f458ade695786dbf132a 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -252,53 +252,6 @@ static inline void *offset_to_ptr(const int *off)
#define __must_be_cstr(p) \
__BUILD_BUG_ON_ZERO_MSG(__annotated(p, nonstring), "must be cstr (NUL-terminated)")
-/*
- * This returns a constant expression while determining if an argument is
- * a constant expression, most importantly without evaluating the argument.
- * Glory to Martin Uecker <Martin.Uecker@....uni-goettingen.de>
- *
- * Details:
- * - sizeof() return an integer constant expression, and does not evaluate
- * the value of its operand; it only examines the type of its operand.
- * - The results of comparing two integer constant expressions is also
- * an integer constant expression.
- * - The first literal "8" isn't important. It could be any literal value.
- * - The second literal "8" is to avoid warnings about unaligned pointers;
- * this could otherwise just be "1".
- * - (long)(x) is used to avoid warnings about 64-bit types on 32-bit
- * architectures.
- * - The C Standard defines "null pointer constant", "(void *)0", as
- * distinct from other void pointers.
- * - If (x) is an integer constant expression, then the "* 0l" resolves
- * it into an integer constant expression of value 0. Since it is cast to
- * "void *", this makes the second operand a null pointer constant.
- * - If (x) is not an integer constant expression, then the second operand
- * resolves to a void pointer (but not a null pointer constant: the value
- * is not an integer constant 0).
- * - The conditional operator's third operand, "(int *)8", is an object
- * pointer (to type "int").
- * - The behavior (including the return type) of the conditional operator
- * ("operand1 ? operand2 : operand3") depends on the kind of expressions
- * given for the second and third operands. This is the central mechanism
- * of the macro:
- * - When one operand is a null pointer constant (i.e. when x is an integer
- * constant expression) and the other is an object pointer (i.e. our
- * third operand), the conditional operator returns the type of the
- * object pointer operand (i.e. "int *"). Here, within the sizeof(), we
- * would then get:
- * sizeof(*((int *)(...)) == sizeof(int) == 4
- * - When one operand is a void pointer (i.e. when x is not an integer
- * constant expression) and the other is an object pointer (i.e. our
- * third operand), the conditional operator returns a "void *" type.
- * Here, within the sizeof(), we would then get:
- * sizeof(*((void *)(...)) == sizeof(void) == 1
- * - The equality comparison to "sizeof(int)" therefore depends on (x):
- * sizeof(int) == sizeof(int) (x) was a constant expression
- * sizeof(int) != sizeof(void) (x) was not a constant expression
- */
-#define __is_constexpr(x) \
- (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
-
/*
* Whether 'type' is a signed type or an unsigned type. Supports scalar types,
* bool and also pointer types.
--
2.45.2
Powered by blists - more mailing lists