[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0163b361-14bf-7b4c-751a-14f1a004b1a9@acm.org>
Date: Tue, 23 Aug 2022 15:05:21 -0700
From: Bart Van Assche <bvanassche@....org>
To: Rasmus Villemoes <linux@...musvillemoes.dk>,
Linus Torvalds <torvalds@...ux-foundation.org>
Cc: 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 8/23/22 00:06, Rasmus Villemoes wrote:
> On 22/08/2022 20.45, Linus Torvalds wrote:
>> But we did have a sparse fix for it, didn't we? That fix required that
>> the '< (type)1' cast be changed to '<= (type)0' iirc, and a patch to
>> sparse, but it at least avoided the problem.
>
> Heh. I originally wrote the comparison "< (t)1" instead of "< (t)0" to
> avoid a -Wtype-limits warning when applied to unsigned types - yeah
> yeah, the kernel isn't built with that, but it's a nice macro to
> copy-paste to other projects, and sometimes people do explicitly enable
> -Wtype-limits to manually go through some, and then it's nice to not
> have tons of false positives from this macro.
>
> But of course <1 is the same as <=0, and we can indeed spell it that way
> without triggering Wtype-limits. So if that can help with also silencing
> sparse, ack from me on that part.
Thank you Rasmus for having shared this information. Since sparse will
have to be modified anyway, how about extending it such that the bitwise
attribute can be removed from a type, e.g. via a new no_bitwise
attribute? Wouldn't that be a more generic solution than only
suppressing sparse complaints when comparing compile-time constants and
when the left-hand-side and right-hand-side have different bitwise
attributes? For reference purposes, this is how __bitwise is defined:
#ifdef __CHECKER__
#define __bitwise __attribute__((bitwise))
#else
#define __bitwise
#endif
Thanks,
Bart.
Powered by blists - more mailing lists