RE: [PATCH next 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.

From: David Laight
Date: Wed Jul 26 2023 - 05:47:23 EST


From: kernel test robot
> Sent: 25 July 2023 15:57
...
> >> mm/mm_init.c:908:14: error: static_assert expression is not an integral constant expression
> start_pfn = clamp(start_pfn, zone_start_pfn, zone_end_pfn);
..
> include/linux/minmax.h:45:17: note: expanded from macro '__clamp_once'
> static_assert(!__is_constexpr((lo) > (hi)) || (lo) <= (hi),

That didn't fail in my test builds.
The compiler I was using must short-circuited the ||.
I'll substitute a 'choose_expr' in v2.

David

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