On Wed, 2005-11-02 at 09:58 -0800, Mark Mitchell wrote: > Jeffrey A Law wrote: > > > Again, the problem I have with the notion that we want to get > > consistent answers is that doing so, is going to give us a lot of > > false positives. That IMHO is a huge step backwards if that's how > > we make -Wuninitialized work. > > You're right that it's the users that matter, and bug reports give us > some visibility into what annoyed people. > > The false-positive case I remember seeing most often was the: > > if (b) { > x = 1; > } > ... > if (b) { > use(x); > } And with the early, but stable schemes, they're going to get these kind of false positives, even for relatively trivial cases.
> I don't remember very many people complaining about other tricky cases; > I certainly don't remember anyone complaining about: > > if (f()) > x = 1; > use(x); > > warning when f could be proven to return a non-zero value. I don't recall any of this particular form. The ones I recall mostly involve a series of conditionals, some of which involve loop entry/exit tests. > However, I'll freely admit this is just my notoriously fallible memory > at work here; I've not reviewed the PRs. Mine is as fallable as yours :-) > In any case, it does seem like you're moving in a direction that would > give us a mode where warnings would perhaps oscillate between your two > classes, but not come and go completely. I think that's pretty good. I'm certainly of the mind to have a mode where we can get all the warnings you want. I don't care much what form they take :-) What I'm most concerned about is changing the behavior of our existing -Wuninitialized switch. That switch has always been subject to the whims of dataflow analysis -- it's even documented that way: Note that there may be no warning about a variable that is used only to compute a value that itself is never used, because such computations may be deleted by data flow analysis before the warnings are printed. The easiest thing to do would be to have a switch which runs the maybe uninitialized code early so that those who want the fuller set of uninitialized variable warnings can get them. THe warning text would look the same, you'd just get more of them with the switch enabled :-) This is option 3b from my message yesterday, we create a new switch -Wuninitialized-mumble which was off by default. Whether or not we would turn that switch on in GCC's Makefiles for our own purposes is a whole different discussion! :-) Jeff