From patchwork Sun Jul 28 14:23:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Laight X-Patchwork-Id: 13744008 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E717C3DA49 for ; Sun, 28 Jul 2024 14:24:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA6D86B0085; Sun, 28 Jul 2024 10:24:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A57726B0088; Sun, 28 Jul 2024 10:24:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 91E8D6B0089; Sun, 28 Jul 2024 10:24:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 764426B0085 for ; Sun, 28 Jul 2024 10:24:47 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 292EEA3244 for ; Sun, 28 Jul 2024 14:24:47 +0000 (UTC) X-FDA: 82389382614.17.A359D23 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by imf12.hostedemail.com (Postfix) with ESMTP id D0C4A40018 for ; Sun, 28 Jul 2024 14:24:44 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of david.laight@aculab.com designates 185.58.86.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com; dmarc=pass (policy=none) header.from=aculab.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722176682; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eLNGDMHkgt4RmoWDWNbhDdjLfGJfa5I0/Di1Ur+Ex5s=; b=SeMiaCHSdFrlmazmbY7cEQn87e7iau3mdm37EUNAPkl30UyzEMYMbJ5UmEOZHFbKguLsm6 2JmYeGsQZQqVHItSpjA7lIgjeramWRnMvAH7SuvhwD7rgNZgrGOhGECbojfRgFkKdbOSVR IXJFS8NixHjs6h7+mUOrsO9P36+KlgM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of david.laight@aculab.com designates 185.58.86.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com; dmarc=pass (policy=none) header.from=aculab.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722176682; a=rsa-sha256; cv=none; b=Y8hYJWqoFLTARKZ1tubwil3RWyjmYj+vKOCYinN2eN9cYvQP69ZXpZQtG3LAlFTyt4Rc7s 4KuL0bW3RMTP7yjIXu7WNJPBzoWsdlUzQFjJz2CEqGlYqQqmq7SONIO62dis0JuPRoB1Z5 Nv+xv6UhQuJVCLZLAgVOCxLY0CdA/3A= Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-277-nlUHsBjeMUSsZCF2tSpzXw-1; Sun, 28 Jul 2024 15:24:37 +0100 X-MC-Unique: nlUHsBjeMUSsZCF2tSpzXw-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 28 Jul 2024 15:23:52 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Sun, 28 Jul 2024 15:23:52 +0100 From: David Laight To: "'linux-kernel@vger.kernel.org'" CC: 'Linus Torvalds' , 'Jens Axboe' , "'Matthew Wilcox (Oracle)'" , 'Christoph Hellwig' , 'Andrew Morton' , 'Andy Shevchenko' , 'Dan Carpenter' , 'Arnd Bergmann' , "'Jason@zx2c4.com'" , "'pedro.falcato@gmail.com'" , 'Mateusz Guzik' , "'linux-mm@kvack.org'" , 'Lorenzo Stoakes' Subject: [PATCH v2 7/8] minmax: Use __auto_type Thread-Topic: [PATCH v2 7/8] minmax: Use __auto_type Thread-Index: Adrg+b/Mt8JjzpFvR/SgdqY3jGnUug== Date: Sun, 28 Jul 2024 14:23:52 +0000 Message-ID: <431f7c45e7294d4da4f8abcd57ce7b5e@AcuMS.aculab.com> References: <402c3c617c29465c898b1af55e3c6095@AcuMS.aculab.com> In-Reply-To: <402c3c617c29465c898b1af55e3c6095@AcuMS.aculab.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US X-Rspam-User: X-Stat-Signature: 43x8dzkreag714w8y54w6og3s6etx4a4 X-Rspamd-Queue-Id: D0C4A40018 X-Rspamd-Server: rspam11 X-HE-Tag: 1722176684-325652 X-HE-Meta: U2FsdGVkX19lHVhx06J2CfBUEoGWtLRUrWq3G4zhBeTBrWm0pTRs2jTHuGdGd7BtslFYmpobuZbhEXdMDpopB7xih1ASFkNitlzTqpmw5pmMR2on+tFYeTFu/4hqB+BAx3uX11HgDFQm7dX9EFXyiW3msCmoG1GxQGlc4VG5V9A8OPYRoEXRKSHrX1hvbafB2aaEPtPaEwb9LlT2x6MBejQ4KXzW6jFzAAeMc6eRm9WUDmXrMfIs3u3mWvSQENfbOgYQ6wurprA58OHOhQRShoGWMshc60/kmrXsvlAxC24nYix5AZK2mMKYjCFw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kkS/p5yUS94rJJVQNScCh7aWkfDJZ0GT1grsRNPoKmgufDPXRKjCQMIZpVJH X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Replacing 'typeof(x) _x = (x)' with '__auto_type _x = (x)' removes one expansion of 'x'. Signed-off-by: David Laight --- 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"); \