Re: [PATCH v2] tracing: Make is_signed_type() compatible with sparse
From: Steven Rostedt
Date: Tue Sep 01 2026 - 19:26:51 EST
On Tue, 1 Sep 2026 14:56:01 -0700
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> In contrast, the existing macro is *not* garbage. It just says "does
> casting -1 end up being larger than casting 1". Admittedly it *should*
> cast 0, but then compilers are unhappy about comparing unsigned values
It originally did but was changed to 1 for exactly that reason [1].
> against zero, so it's not great, but it's *simple*. It still gives
> random results for 'bool', I guess, but is bool signed? I don't know,
> I don't care.
Yeah, it was originally used for the tracing format files so that
tooling can know how to display the raw values it parses. Also it is
used for the filtering logic to know how to compare to the raw values.
I see is_signed_type() has picked up some use cases outside of tracing,
so I'm not sure how much those other areas care about things like
"bool".
-- Steve
[1] d2802d0739dcc ("tracing: Compare to 1 instead of zero for is_signed_type()")