RE: [PATCH] [v2] platform/surface: aggregator: avoid clang -Wconstant-conversion warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux