public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* sparse feature request: nocast integer types
@ 2023-11-09  5:03 Christoph Hellwig
       [not found] ` <CAMHZB6G_TZJ_uQGm5an0-bhG8wCxpEQrUCShen7O61Q9arAf+Q@mail.gmail.com>
  2023-11-27 12:51 ` Dan Carpenter
  0 siblings, 2 replies; 7+ messages in thread
From: Christoph Hellwig @ 2023-11-09  5:03 UTC (permalink / raw)
  To: linux-sparse; +Cc: linux-xfs

Hi dear spearse developers,

in a lot of kernel code we have integer types that store offsets and
length in certain units (typically 512 byte disk "sectors", file systems
block sizes, and some weird variations of the same), and we had a fair
amount of bugs beause people get confused about which ones to use.

I wonder if it is possible to add an attribute (say nocast) that works
similar to __attribute__((bitwise)) in that it disallows mixing this
type with other integer types, but unlike __attribute__((bitwise))
allows all the normal arithmetics on it?  That way we could annotate
all the normal conversion helpers with __force overrides and check
where people are otherwise mixing these types.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-11-27 17:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09  5:03 sparse feature request: nocast integer types Christoph Hellwig
     [not found] ` <CAMHZB6G_TZJ_uQGm5an0-bhG8wCxpEQrUCShen7O61Q9arAf+Q@mail.gmail.com>
2023-11-09  5:30   ` Christoph Hellwig
     [not found]     ` <CAMHZB6H7Y0m2Y-ZD0PMKiGDeo7_sy=scDrzbBbBuUJfuzLK-Lg@mail.gmail.com>
2023-11-09  5:44       ` Christoph Hellwig
2023-11-09 17:57         ` Linus Torvalds
2023-11-27 12:51 ` Dan Carpenter
2023-11-27 16:05   ` Christoph Hellwig
2023-11-27 17:26     ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox