[cfe-dev] -Wunique-enum; is it worth it?

Douglas Gregor dgregor at apple.com
Wed Sep 12 15:55:59 PDT 2012

On Sep 12, 2012, at 3:48 PM, Richard Trieu <rtrieu at google.com> wrote:

> On Wed, Sep 12, 2012 at 3:35 PM, Ted Kremenek <kremenek at apple.com> wrote:
> On Sep 12, 2012, at 3:27 PM, Richard Trieu <rtrieu at google.com> wrote:
>> This warning caught around 5 bugs.  Roughly twice that amount in false positives needed to be silenced.
> Thanks Richard.
> IMO, that's a pretty dreadful signal-to-noise ratio.  That's a 66% false positive rate.  That's the kind of false positive rate I'd consider a warning being DefaultIgnore, not be on by default.  Do the other false positives look like cases the warning logic could be improved to handle?  Less than 10% false positive rate seems required to me for this warning to be on by default.
> I have no problems with switching this to DefaultIgnore.  Looking back, through the false positives, it looks like the most common case would be when the enum is simply there to hold a collection of constants.  I think checking if there is a variable of the enum type would be the best way to cut down on false positives, but I am not sure how to go about implementing that.

I don't think this warning belongs in Clang at all, even under DefaultIgnore. The false positive rate is far too high for it to be useful for the majority of users, and it isn't the kind of warning that maps well to DefaultIgnore, because it doesn't correspond to some stylistic decision or usage pattern…. it's just too noisy for the majority of users.

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120912/7fde1594/attachment.html>

More information about the cfe-dev mailing list