On Tue, Apr 04, 2023 at 12:19:14PM +0200, Ahmad Fatoum wrote: > Clang doesn't like our implementation of CLOCKSOURCE_MASK: > > common/clock.c:33:10: warning: shift count >= width of type [-Wshift-count-overflow] > .mask = CLOCKSOURCE_MASK(64), > ^~~~~~~~~~~~~~~~~~~~ > include/clock.h:8:63: note: expanded from macro 'CLOCKSOURCE_MASK' > #define CLOCKSOURCE_MASK(bits) (uint64_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) > > So the bits < 64 check we have is apparently not enough to suppress the > warning when built with clang. > > Let's do what the kernel does and use GENMASK_ULL instead to get rid of > the last remaining warning when building ARCH=sandbox targettools_defconfig > with clang version 16.0.1. > > Not functional change intended. > > Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> > --- > include/clock.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) Applied, thanks Sascha > > diff --git a/include/clock.h b/include/clock.h > index 8e07c35d374e..03a38911a7a7 100644 > --- a/include/clock.h > +++ b/include/clock.h > @@ -4,8 +4,9 @@ > > #include <types.h> > #include <linux/time.h> > +#include <linux/bitops.h> > > -#define CLOCKSOURCE_MASK(bits) (uint64_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) > +#define CLOCKSOURCE_MASK(bits) GENMASK_ULL((bits) - 1, 0) > > struct clocksource { > uint32_t shift; > -- > 2.39.2 > > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |