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

From: Linus Torvalds

Date: Wed Sep 02 2026 - 19:07:06 EST


On Wed, 2 Sept 2026 at 13:50, David Laight <david.laight.linux@xxxxxxxxx> wrote:
>
> Actually it wouldn't really to any harm to nuke the __bitwise on those fields.
> It seems to be an attempt to generate strongly typed integers, but it doesn't
> stop you mixing up the values between the fields - there is only one kind
> of __bitwise.

Nope - there are multipel __bitwise.

Each typedef creates a new type. Try this:

typedef int __attribute__((bitwise)) a_t;
typedef int __attribute__((bitwise)) b_t;

static a_t a;
static b_t b;

void test(void)
{
a = b;
}

and notice how it warns:

t.c:9:19: warning: incorrect type in assignment (different base types)
t.c:9:19: expected restricted a_t static [signed] [toplevel] [usertype] a
t.c:9:19: got restricted b_t static [signed] [toplevel] [usertype] b

because the types of 'a' and 'b' are not the same.

Linus