Re: [PATCH 1/3] evaluate: warn on identical exprs around '&&'

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

 



On Sun, Aug 28, 2011 at 02:57:36PM +1200, Chris Forbes wrote:
> > Also, how does your patch handle expressions like this: *x++ && *x++
> > Or this: f() && f()
> 
> Those cases will both warn. Do I need to be looking for potential side
> effects, and considering these expressions "probably correct" in those
> cases?

Those expressions can certainly make sense in correct code, unlike cases
with identical side-effect-free expressions; that doesn't make such
expressions a good idea, though.  You might want to check for
side-effect-free code (I think Sparse already has a mechanism to test
for that), and split that into a separate warning option.  Whether that
option should stay on by default or not, I don't know; that will take
running it over some real codebases and evaluating the benefit.

- Josh Triplett
--
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