Michael S. Tsirkin
2016-Dec-08 02:29 UTC
[PATCH] linux/types.h: enable endian checks for all sparse builds
By now, linux is mostly endian-clean. Enabling endian-ness checks for everyone produces about 200 new sparse warnings for me - less than 10% over the 2000 sparse warnings already there. Not a big deal, OTOH enabling this helps people notice they are introducing new bugs. So let's just drop __CHECK_ENDIAN__. Follow-up patches can drop distinction between __bitwise and __bitwise__. Cc: Linus Torvalds <torvalds at linux-foundation.org> Suggested-by: Christoph Hellwig <hch at infradead.org> Signed-off-by: Michael S. Tsirkin <mst at redhat.com> --- Linus, could you ack this for upstream? If yes I'll merge through my tree as a replacement for enabling this just for virtio. include/uapi/linux/types.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h index acf0979..41e5914 100644 --- a/include/uapi/linux/types.h +++ b/include/uapi/linux/types.h @@ -23,11 +23,7 @@ #else #define __bitwise__ #endif -#ifdef __CHECK_ENDIAN__ #define __bitwise __bitwise__ -#else -#define __bitwise -#endif typedef __u16 __bitwise __le16; typedef __u16 __bitwise __be16; -- MST
Bart Van Assche
2016-Dec-08 05:21 UTC
[PATCH] linux/types.h: enable endian checks for all sparse builds
On 12/07/16 18:29, Michael S. Tsirkin wrote:> By now, linux is mostly endian-clean. Enabling endian-ness > checks for everyone produces about 200 new sparse warnings for me - > less than 10% over the 2000 sparse warnings already there. > > Not a big deal, OTOH enabling this helps people notice > they are introducing new bugs. > > So let's just drop __CHECK_ENDIAN__. Follow-up patches > can drop distinction between __bitwise and __bitwise__.Hello Michael, This patch makes a whole bunch of ccflags-y += -D__CHECK_ENDIAN__ statements obsolete. Have you considered to remove these statements? Additionally, there are notable exceptions to the rule that most drivers are endian-clean, e.g. drivers/scsi/qla2xxx. I would appreciate it if it would remain possible to check such drivers with sparse without enabling endianness checks. Have you considered to change #ifdef __CHECK_ENDIAN__ into e.g. #ifndef __DONT_CHECK_ENDIAN__? Thanks, Bart.
Michael S. Tsirkin
2016-Dec-08 05:53 UTC
[PATCH] linux/types.h: enable endian checks for all sparse builds
On Thu, Dec 08, 2016 at 05:21:47AM +0000, Bart Van Assche wrote:> On 12/07/16 18:29, Michael S. Tsirkin wrote: > > By now, linux is mostly endian-clean. Enabling endian-ness > > checks for everyone produces about 200 new sparse warnings for me - > > less than 10% over the 2000 sparse warnings already there. > > > > Not a big deal, OTOH enabling this helps people notice > > they are introducing new bugs. > > > > So let's just drop __CHECK_ENDIAN__. Follow-up patches > > can drop distinction between __bitwise and __bitwise__. > > Hello Michael, > > This patch makes a whole bunch of ccflags-y += -D__CHECK_ENDIAN__ > statements obsolete. Have you considered to remove these statements?Absolutely. Just waiting for feedback on the idea.> Additionally, there are notable exceptions to the rule that most drivers > are endian-clean, e.g. drivers/scsi/qla2xxx. I would appreciate it if it > would remain possible to check such drivers with sparse without enabling > endianness checks. Have you considered to change #ifdef __CHECK_ENDIAN__ > into e.g. #ifndef __DONT_CHECK_ENDIAN__? > > Thanks, > > Bart.The right thing is probably just to fix these, isn't it? Until then, why not just ignore the warnings? -- MST
Cornelia Huck
2016-Dec-08 11:25 UTC
[PATCH] linux/types.h: enable endian checks for all sparse builds
On Thu, 8 Dec 2016 04:29:39 +0200 "Michael S. Tsirkin" <mst at redhat.com> wrote:> By now, linux is mostly endian-clean. Enabling endian-ness > checks for everyone produces about 200 new sparse warnings for me - > less than 10% over the 2000 sparse warnings already there.Out of curiousity: Where do most of those warnings show up?> > Not a big deal, OTOH enabling this helps people notice > they are introducing new bugs. > > So let's just drop __CHECK_ENDIAN__. Follow-up patches > can drop distinction between __bitwise and __bitwise__. > > Cc: Linus Torvalds <torvalds at linux-foundation.org> > Suggested-by: Christoph Hellwig <hch at infradead.org> > Signed-off-by: Michael S. Tsirkin <mst at redhat.com> > --- > > Linus, could you ack this for upstream? If yes I'll > merge through my tree as a replacement for enabling > this just for virtio. > > include/uapi/linux/types.h | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h > index acf0979..41e5914 100644 > --- a/include/uapi/linux/types.h > +++ b/include/uapi/linux/types.h > @@ -23,11 +23,7 @@ > #else > #define __bitwise__ > #endif > -#ifdef __CHECK_ENDIAN__ > #define __bitwise __bitwise__ > -#else > -#define __bitwise > -#endif > > typedef __u16 __bitwise __le16; > typedef __u16 __bitwise __be16;FWIW, I like this better than just enabling it for the virtio code.
Seemingly Similar Threads
- [PATCH] linux/types.h: enable endian checks for all sparse builds
- [PATCH] linux/types.h: enable endian checks for all sparse builds
- [PATCH] linux/types.h: enable endian checks for all sparse builds
- [PATCH] linux/types.h: enable endian checks for all sparse builds
- [PATCH] linux/types.h: enable endian checks for all sparse builds