From: Bart Van Assche <bvanassche@acm.org>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org,
Damien Le Moal <damien.lemoal@opensource.wdc.com>,
Naohiro Aota <naohiro.aota@wdc.com>,
Johannes Thumshirn <jth@kernel.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Steven Rostedt <rostedt@goodmis.org>,
linux-sparse@vger.kernel.org
Subject: Re: [PATCH 51/51] fs/zonefs: Fix sparse warnings in tracing code
Date: Sun, 26 Jun 2022 08:42:27 -0700 [thread overview]
Message-ID: <a206782a-bd90-58cd-1e83-bb5988edb0f9@acm.org> (raw)
In-Reply-To: <20220626095814.7wtma47w4sph7dha@mail>
On 6/26/22 02:58, Luc Van Oostenryck wrote:
> On Sat, Jun 25, 2022 at 05:44:54PM -0700, Bart Van Assche wrote:
>> On 6/25/22 02:23, Christoph Hellwig wrote:
>>> Yeah, that is a bit of a mess. Rasmus, Steven - any good idea how
>>> we can make the trace even macros fit for sparse? Maybe just drop the
>>> is_signed_type check for __CHECKER__ ?
>
> I would strongly advise against this:
> -) the macro is sued elsewhere too (for overflow checking)
> -) sparse wouldn't check anymore the same code as the one seen by the
> compiler
>
> What about I would add to sparse something to strip away the bitwise/
> recover the underlying type? Something like __unbitwiseof() or
> __underlying_typeof() (some better name is needed)?
>
> Implementing directly what's needed here, something like __is_signed_type()
> would be possible too but is a bit too specialized and so much less useful.
Another question is how to keep the non-sparse build working. Does
anyone want to comment on the following alternatives or propose another
alternative?
(1) sparse implements __strip_bitwise as a macro.
(in compiler.h)
#ifndef __strip_bitwise
#define __strip_bitwise(type) type
#endif
(in trace_events.h)
#define is_signed_type(type) ((__strip_bitwise(type))(-1) < (__strip_bitwise(type))1)
(2) sparse implements __strip_bitwise as an operator that works on types.
#ifdef __CHECKER__
#define is_signed_type(type) ((__strip_bitwise(type))(-1) < (__strip_bitwise(type))1)
#else
#define is_signed_type(type) (((type)(-1)) < (type)1)
#endif
(1) would work better than (2) for kernel developers who are using a
version of sparse that does not support __strip_bitwise().
Thanks,
Bart.
next prev parent reply other threads:[~2022-06-26 15:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220623180528.3595304-1-bvanassche@acm.org>
[not found] ` <20220623180528.3595304-52-bvanassche@acm.org>
[not found] ` <20220624045613.GA4505@lst.de>
[not found] ` <aa044f61-46f0-5f21-9b17-a1bb1ff9c471@acm.org>
[not found] ` <20220625092349.GA23530@lst.de>
[not found] ` <3eed7994-8de2-324d-c373-b6f4289a2734@acm.org>
2022-06-26 9:58 ` [PATCH 51/51] fs/zonefs: Fix sparse warnings in tracing code Luc Van Oostenryck
2022-06-26 15:42 ` Bart Van Assche [this message]
2022-06-26 16:24 ` Luc Van Oostenryck
2022-06-26 16:33 ` Linus Torvalds
2022-06-26 16:50 ` Linus Torvalds
2022-06-26 20:10 ` Luc Van Oostenryck
2022-06-26 19:44 ` Luc Van Oostenryck
2022-06-27 19:05 ` [PATCH 0/5] allow -1 and compares in bitwise types Luc Van Oostenryck
2022-06-27 19:05 ` [PATCH 1/5] bitwise: add testcases Luc Van Oostenryck
2022-06-27 19:05 ` [PATCH 2/5] bitwise: accept all ones as non-restricted value Luc Van Oostenryck
2022-06-27 23:32 ` Ramsay Jones
2022-06-27 19:05 ` [PATCH 3/5] bitwise: allow compares for bitwise types Luc Van Oostenryck
2022-06-27 19:20 ` Linus Torvalds
2022-06-27 23:34 ` Ramsay Jones
2022-06-27 19:05 ` [PATCH 4/5] bitwise: do not remove the signedness of " Luc Van Oostenryck
2022-06-27 19:05 ` [PATCH 5/5] bitwise: early expansion of simple constants Luc Van Oostenryck
2022-06-27 19:14 ` [PATCH 0/5] allow -1 and compares in bitwise types Linus Torvalds
2022-06-27 19:15 ` Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a206782a-bd90-58cd-1e83-bb5988edb0f9@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@opensource.wdc.com \
--cc=hch@lst.de \
--cc=jth@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=luc.vanoostenryck@gmail.com \
--cc=naohiro.aota@wdc.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).