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

Ted Kremenek kremenek at apple.com
Tue Sep 11 15:26:45 PDT 2012


I've started receiving feedback about -Wunique-enum from some users and I'm wondering if it is worth it.  Can we discuss what was the motivation behind this warning and what kind of bugs it was meant to catch?

One problem I see right now is that it doesn't handle enums that represent bit masks, e.g.:

  MaskA = 0x1,
  MaskB = 0x1

and so on.  There are legitimate cases where declaring a bunch of constants in an enum is okay, and it is fine for them to have the same value.  Has this warning caught any real bugs?

In general, I think it is fine to give warnings a new try and then evaluate them.  I'm leaning towards removing this warning since I don't see what value it brings, but I wanted to know what the motivation was behind this warning before pressing on doing that.



More information about the cfe-dev mailing list