Re: [PATCH] add sparse flag to toggle sizeof(void) warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 07, 2018 at 10:24:40AM -1000, Joey Pabalinas wrote:
> On Sat, Apr 07, 2018 at 05:31:40PM +0200, Luc Van Oostenryck wrote:
> > I've moved the s/gcc/GCC/ change in a separate commit
> > (cfr. git://github.com/lucvoo/sparse-dev.git sizeof-void ).
> 
> Sure, splitting that change SGTM.
> 
> > I've also seen that for GCC this warning is enabled by -Wpointer-arith.
> > I think we should do the same. Mind to respin with this change?
> 
> You mean change the flag name to -Wpointer-arith? I actually think
> that's a great idea. Consistency with GCC flags would be good.
> 
> > There is another thing that I think should be changed:
> > taking the size of a void is quite weird/counter-intuitive and is
> > a constraint violation in standard C. So, I think the flag should
> > be enabled by default but the kernel should have -Wno-pointer-arith
> > in CHECKFLAGS since it do pointer arithmetic on void (and a few
> > places take the size of a function too).
> 
> Well, although Sparse is a general semantic parser I was under the
> impression that it was mostly used in the kernel. That is what I had
> in mind when disabling it by default. OTOH, I can see the benefit in
> doing it your way; anyone else have any opinions on if -Wno-pointer-arith
> would be better made default in CHECKFLAGS leave this warning on
> by default in Sparse?

It's true that sparse is mainly used for the Linux kernel but as a
checker it's normal that it's more strict than GCC. For non-kernel
usage I think it's better to leave the warning enabled and adapt
CHECKFLAGS.

> I'm spinning up a new patch now; will send the V2 it once we decide
> on if it should be disabled by default or not.

Yes, fine.

Cheers,
-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux