On 04/01/2014 08:56 AM, Zack Weinberg wrote:
> The downside of turning this on would be that any switch
> statements that *deliberately* include only a subset of the
> enumerators, plus a default case, would now have to be expanded to
> cover all the enumerators.  I would try it and report on how
> unpleasant that turns out to be, but my development box has taken
> to corrupting its filesystem if I merely do a 'hg update', so I'm
> kind of stuck, there. Anyone interested in trying it?

As a first approximation, it seems like we'd have to do this for a
most switch statements that include a 'default:' case. (I'm betting
that most of those switch statements have omitted *some* enum values,
since until now, there's been no reason to include 'default' unless
you're trying to be concise and merge some values together.)

grep finds 3934 default statements in .cpp files, 469 in .h files:
 $ grep -r "default:" | grep ".cpp:" | wc -l
 3934
 $ grep -r "default:" | grep ".h:" | wc -l
 469

So, we have on the order of ~4400 switch statements that would
potentially need expanding to avoid tripping this warning.

Having said that, if we *really* wanted to add this warning, I suppose
we could add it directory-by-directory (or only ever add it in certain
directories, as is the case with -Wshadow in layout/style).

~Daniel
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to