Re: [PATCH v2] tracing: Make is_signed_type() compatible with sparse

From: David Laight

Date: Tue Sep 01 2026 - 04:26:22 EST


On Mon, 31 Aug 2026 14:19:10 -0700
Bart Van Assche <bvanassche@xxxxxxx> wrote:

> On 8/31/26 1:44 PM, David Laight wrote:
> > On Fri, 7 Aug 2026 10:00:56 -0700
> > Bart Van Assche <bvanassche@xxxxxxx> wrote:
> >
> >> Using a __bitwise type in a tracing __field() definition triggers four
> >> sparse warnings in stage 4 of expanding the TRACE_EVENT() macro. These
> >> warnings are triggered by the is_signed_type() macro implementation.
> >> Fix this by using _Generic() in the is_signed_type() implementation
> >> instead of an integer comparison.
> >
> > Does adding __force to the LH cast remove the warning?
> > Is so that would be a much better fix.
> I have tried this, but unfortunately this doesn't suppress the sparse
> complaints about the casts in the is_signed_type() implementation.

The _Generic() version just doesn't work.
You need to explicitly specify all the qualified types, so you need
'int', 'const int', 'volatile int', 'const volatile int' (etc).
And, IIRC, there is another qualified in the latest C version that
would need to be allowed for as well.

I suspect you need to change the TRACE_EVENT() calls to remove the
__bitwise marker.

David

>
> Thanks,
>
> Bart.