Re: [PATCH v1 02/48] tools headers: Silence -Wshorten-64-to-32 warnings
From: Ian Rogers
Date: Thu Apr 03 2025 - 10:55:58 EST
On Thu, Apr 3, 2025 at 7:26 AM Yury Norov <yury.norov@xxxxxxxxx> wrote:
>
> On Thu, Apr 03, 2025 at 10:08:39AM -0400, Yury Norov wrote:
> > On Tue, Apr 01, 2025 at 11:23:00AM -0700, Ian Rogers wrote:
> > > The clang warning -Wshorten-64-to-32 can be useful to catch
> > > inadvertent truncation. In some instances this truncation can lead to
> > > changing the sign of a result, for example, truncation to return an
> > > int to fit a sort routine. Silence the warning by making the implicit
> > > truncation explicit.
> > >
> > > Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
>
> I'm the first person in the To list, but only a couple patches in the
> series are related to my area. If you want to move it with me, can you
> send bitmaps, bitfields etc. separately?
Hi Yury,
If you think it is worthwhile. I did the series to see how prevalent a
bug was in perf's code - inspired by Leo Yan fixing an instance of it.
I would prefer not to be on the hook for all the kernel warnings :-)
Perhaps casts to avoid changing bitmap_weight's type. Unfortunately to
get to where the perf issues were I needed to clean up header files.
In the bitmap cases the change is just to make implicit casts explicit
and I don't know how much value you see in that.
Thanks,
Ian
> Thanks,
> Yury