[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <29157fcb-a2c3-ff4d-2b74-f4da860a0dbe@rasmusvillemoes.dk>
Date: Thu, 25 Aug 2022 09:57:25 +0200
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Bart Van Assche <bvanassche@....org>
Cc: Rasmus Villemoes <linux@...musvillemoes.dk>,
Steven Rostedt <rostedt@...dmis.org>,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Hellwig <hch@....de>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Jens Axboe <axboe@...nel.dk>
Subject: Re: [for-linus][PATCH 01/10] tracing: Suppress sparse warnings
triggered by is_signed_type()
On 25/08/2022 02.40, Linus Torvalds wrote:
> On Wed, Aug 24, 2022 at 5:30 PM Linus Torvalds
> <torvalds@...ux-foundation.org> wrote:
>>
>> Let me think about this.
>
> Actually, thinking about it, that was simple enough.
>
> -#define is_signed_type(type) (((type)(-1)) < (type)1)
> +#define is_signed_type(type) (((type)(-1)) < (__force type)1)
>
> should work.
>
> It looks a bit odd, because we only force one side.
One can also make the RHS not be a null pointer constant with something like
(((t)(-1)) <= (1 ? (t)0 : (t)0))
In either case, we're a good way into "this needs a comment explaining
why it's written precisely the way it is" territory.
Rasmus
Powered by blists - more mailing lists