lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <431f7c45e7294d4da4f8abcd57ce7b5e@AcuMS.aculab.com>
Date: Sun, 28 Jul 2024 14:23:52 +0000
From: David Laight <David.Laight@...LAB.COM>
To: "'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>
CC: 'Linus Torvalds' <torvalds@...uxfoundation.org>, 'Jens Axboe'
	<axboe@...nel.dk>, "'Matthew Wilcox (Oracle)'" <willy@...radead.org>,
	'Christoph Hellwig' <hch@...radead.org>, 'Andrew Morton'
	<akpm@...ux-foundation.org>, 'Andy Shevchenko'
	<andriy.shevchenko@...ux.intel.com>, 'Dan Carpenter'
	<dan.carpenter@...aro.org>, 'Arnd Bergmann' <arnd@...nel.org>,
	"'Jason@...c4.com'" <Jason@...c4.com>, "'pedro.falcato@...il.com'"
	<pedro.falcato@...il.com>, 'Mateusz Guzik' <mjguzik@...il.com>,
	"'linux-mm@...ck.org'" <linux-mm@...ck.org>, 'Lorenzo Stoakes'
	<lorenzo.stoakes@...cle.com>
Subject: [PATCH v2 7/8] minmax: Use __auto_type

Replacing 'typeof(x) _x = (x)' with '__auto_type _x = (x)' removes
one expansion of 'x'.

Signed-off-by: David Laight <david.laight@...lab.com>
---
New patch for v2

 include/linux/minmax.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/linux/minmax.h b/include/linux/minmax.h
index ad57c8eddc8a..cb3515824a64 100644
--- a/include/linux/minmax.h
+++ b/include/linux/minmax.h
@@ -47,9 +47,9 @@
 #define __cmp(op, x, y)	((x) __cmp_op_##op (y) ? (x) : (y))
 
 #define __cmp_once(op, x, y, unique_x, unique_y) ({	\
-	typeof(x) unique_x = (x);			\
-	typeof(y) unique_y = (y);			\
-	_Static_assert(__types_ok(x, y),			\
+	__auto_type unique_x = (x);			\
+	__auto_type unique_y = (y);			\
+	_Static_assert(__types_ok(x, y),		\
 		#op "(" #x ", " #y ") signedness error, fix types or consider u" #op "() before " #op "_t()"); \
 	__cmp(op, unique_x, unique_y); })
 
@@ -131,18 +131,18 @@
  * @y: value2
  */
 #define min_not_zero(x, y) ({			\
-	typeof(x) __x = (x);			\
-	typeof(y) __y = (y);			\
+	__auto_type __x = (x);			\
+	__auto_type __y = (y);			\
 	__x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); })
 
 #define __clamp(val, lo, hi)	\
 	((val) >= (hi) ? (hi) : ((val) <= (lo) ? (lo) : (val)))
 
 #define __clamp_once(val, lo, hi, unique_val, unique_lo, unique_hi) ({		\
-	typeof(val) unique_val = (val);						\
-	typeof(lo) unique_lo = (lo);						\
-	typeof(hi) unique_hi = (hi);						\
-	_Static_assert(__if_constexpr((lo) <= (hi), (lo) <= (hi), true),		\
+	__auto_type unique_val = (val);						\
+	__auto_type unique_lo = (lo);						\
+	__auto_type unique_hi = (hi);						\
+	_Static_assert(__if_constexpr((lo) <= (hi), (lo) <= (hi), true),	\
 		"clamp() low limit " #lo " greater than high limit " #hi);	\
 	_Static_assert(__types_ok(val, lo), "clamp() 'lo' signedness error");	\
 	_Static_assert(__types_ok(val, hi), "clamp() 'hi' signedness error");	\
-- 
2.17.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ