I'm concerned about the potential for false-positives [after preprocessing is done] when combining a bunch of flags. I'll throw together another patch to add &|^ support, run it against a bunch of real codebases, and see how crazy it is. -- Chris On Sun, Aug 28, 2011 at 2:50 PM, Josh Triplett <josh@xxxxxxxxxxxxxxxx> wrote: > On Sun, Aug 28, 2011 at 10:26:53AM +1200, Chris Forbes wrote: >> Adds a warning when identical expressions are found on both sides of the '&&' operator. This is a common error resulting from copy & paste. >> >> Excludes identical expressions found while preprocessing, so we don't get upset about #if defined(FOO) && defined(BAR), which happens all the time, and is perfectly valid. >> >> Signed-off-by: Chris Forbes <chrisf@xxxxxxxxx> > > Very nice patch series! I replied to patch 3 about a bit of patch cleanup, but otherwise this looks fine, and I've wanted to see this check for a while. > > Would you consider also checking for identical expresions on both sides > of an &, |, or ^? The former two seem like likely cases when composing > flags, and the latter seems like a likely error as well. > > Also, how does your patch handle expressions like this: *x++ && *x++ > Or this: f() && f() > > - 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 > -- 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