[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241203-is_constexpr-refactor-v1-7-4e4cbaecc216@wanadoo.fr>
Date: Tue, 03 Dec 2024 02:33:29 +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 07/10] overflow: replace __is_constexpr() by is_const()
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
is_const() is a one to one replacement of __is_constexpr(). Do the
replacement so that __is_constexpr() can be removed.
Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
---
include/linux/overflow.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/overflow.h b/include/linux/overflow.h
index 0c7e3dcfe8670cb95f371a6f7d41bb8b63b1786c..d69361a3128897d493b5e2ec471f077ca2b9861d 100644
--- a/include/linux/overflow.h
+++ b/include/linux/overflow.h
@@ -234,7 +234,7 @@ static inline bool __must_check __must_check_overflow(bool overflow)
* Returns: true if overflow can occur, false otherwise.
*/
#define overflows_type(n, T) \
- __builtin_choose_expr(__is_constexpr(n), \
+ __builtin_choose_expr(is_const(n), \
__overflows_type_constexpr(n, T), \
__overflows_type(n, T))
@@ -250,7 +250,7 @@ static inline bool __must_check __must_check_overflow(bool overflow)
* back to __same_type().
*/
#define castable_to_type(n, T) \
- __builtin_choose_expr(__is_constexpr(n), \
+ __builtin_choose_expr(is_const(n), \
!__overflows_type_constexpr(n, T), \
__same_type(n, T))
@@ -352,7 +352,7 @@ static inline size_t __must_check size_sub(size_t minuend, size_t subtrahend)
* Return: number of bytes needed or SIZE_MAX on overflow.
*/
#define flex_array_size(p, member, count) \
- __builtin_choose_expr(__is_constexpr(count), \
+ __builtin_choose_expr(is_const(count), \
(count) * sizeof(*(p)->member) + __must_be_array((p)->member), \
size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
@@ -368,7 +368,7 @@ static inline size_t __must_check size_sub(size_t minuend, size_t subtrahend)
* Return: number of bytes needed or SIZE_MAX on overflow.
*/
#define struct_size(p, member, count) \
- __builtin_choose_expr(__is_constexpr(count), \
+ __builtin_choose_expr(is_const(count), \
sizeof(*(p)) + flex_array_size(p, member, count), \
size_add(sizeof(*(p)), flex_array_size(p, member, count)))
--
2.45.2
Powered by blists - more mailing lists