[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <16280aaedc40425295d202431ac3adc0@AcuMS.aculab.com>
Date: Mon, 17 May 2021 08:31:12 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Nathan Chancellor' <nathan@...nel.org>,
Arnd Bergmann <arnd@...nel.org>,
Maximilian Luz <luzmaximilian@...il.com>,
Hans de Goede <hdegoede@...hat.com>
CC: Arnd Bergmann <arnd@...db.de>,
"platform-driver-x86@...r.kernel.org"
<platform-driver-x86@...r.kernel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"clang-built-linux@...glegroups.com"
<clang-built-linux@...glegroups.com>
Subject: RE: [PATCH] [v2] platform/surface: aggregator: avoid clang
-Wconstant-conversion warning
From: Nathan Chancellor
> Sent: 14 May 2021 22:23
> >
> > Clang complains about the assignment of SSAM_ANY_IID to
> > ssam_device_uid->instance:
Has this been raised with clang?
...
> > - .target = ((tid) != SSAM_ANY_TID) ? (tid) : 0, \
> > - .instance = ((iid) != SSAM_ANY_IID) ? (iid) : 0, \
> > - .function = ((fun) != SSAM_ANY_FUN) ? (fun) : 0 \
> > + .target = __builtin_choose_expr((tid) != SSAM_ANY_TID, (tid), 0), \
> > + .instance = __builtin_choose_expr((iid) != SSAM_ANY_IID, (iid), 0), \
> > + .function = __builtin_choose_expr((fun) != SSAM_ANY_FUN, (fun), 0)
A simpler alternative:
= fun * (fun != SSAM_ANY_FUN)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists