Thanks for your comments. I was told that it was preferable to update the CFG. The reason is that all analyses built on top on the CFG will benefit: -Wuninitialized, static analyzer, warnings, etc. I wonder if Anna or Ted could provide their opinions about this patch? //Anders
From: Richard Trieu [mailto:[email protected]] Sent: den 26 oktober 2013 01:43 To: Jordan Rose Cc: Anders Rönnholm; [email protected] Subject: Re: [PATCH] check for Incorrect logic in operator A few high level comments. "-fblocks -Wunreachable-code" is there any reason your test cases have these flags? "if (!x == 10) {}" there is an existing warning for this called -Wlogical-not-parentheses. The check should be folded into there. "if ((x < y) == 10) {}" ditto this and -Wtautological-compare-out-of-range "logical disjunction always evaluates to true" I wouldn't expect all programmers to understand what a logical disjunction is. If you check out -Wlogical-not-parentheses and -Wtautological-compare-out-of-range, they are in lib/Sema/SemaChecking.cpp. Why did you use a CFG approach instead? On Fri, Oct 25, 2013 at 10:18 AM, Jordan Rose <[email protected]<mailto:[email protected]>> wrote: Richard Trieu has worked on a number of similar warnings. Maybe he can take a look? Jordan On Oct 25, 2013, at 8:18, Anders Rönnholm <[email protected]<mailto:[email protected]>> wrote: > Hi, > Resending the patch I sent last week. Anyone want to have a look at it? > > //Anders > > -----Original Message----- > From: Anders Rönnholm > Sent: den 18 oktober 2013 16:05 > To: [email protected]<mailto:[email protected]> > Subject: [PATCH] check for Incorrect logic in operator > > Hi, > > I have a new patch I like to get reviewed. It checks for incorrect logics in > relational,equal and logic operators in cfgbuilder when trying to evaluate > bool. A warning is emitted in Sema when an error occurs. > > eg. > if (x != 2 || x != 3) { } always true > if ((x < y) <= 10) {} always true > > Thanks, > Anders > <incorrectoperatorlogic.diff>_______________________________________________ > cfe-commits mailing list > [email protected]<mailto:[email protected]> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
