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

Ted Kremenek kremenek at apple.com
Mon Sep 17 17:40:28 PDT 2012

On Sep 13, 2012, at 1:20 PM, Matt Beaumont-Gay <matthewbg at google.com> wrote:

> On Thu, Sep 13, 2012 at 12:59 PM, Ted Kremenek <kremenek at apple.com> wrote:
>> On Sep 12, 2012, at 3:55 PM, Douglas Gregor <dgregor at apple.com> wrote:
>> 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.
>> I agree.  This seems highly stylistic and not generally applicable.  Unless
>> there are objections, I will remove this warning entirely tomorrow.  I think
>> it was a good experiment, but I don't see the general payoff here.
> The false positive rate for this warning in under-development code at
> Google is pretty low, one FP in 14 cases in August.

This interesting, but the warning still seems a bit too stylistic, and not generally useful.

> Most of the true
> positives come from generated code in protocol buffers -- enumerators
> in protobufs must all have explicit values, so copy-and-paste leads to
> wrongly duplicated values.

It seems to me that the checking should then be done when the protocol buffer code is generated, catching the problem very early, rather then an enforcing a style that doesn't have widespread applicability.

More information about the cfe-dev mailing list