On Fri, Sep 30, 2016 at 7:10 AM, Bernd Schmidt <bschm...@redhat.com> wrote: > On 09/30/2016 12:51 PM, Jakub Jelinek wrote: >> On Fri, Sep 30, 2016 at 12:42:20PM +0200, Bernd Schmidt wrote: >>> On 09/30/2016 11:45 AM, Jakub Jelinek wrote: >>> >>>> See Tom Tromey's explanation why accepting too much is bad (at least >>>> unless we want multiple levels). >>> >>> And I still don't buy it. The case where someone writes "Don't fall >>> through" is artificial to begin with, and also forgetting to put the break; >>> there >>> really isn't something for us to be concerned about.
Agreed. >> It doesn't have to be exactly that, fall is a substring of 200+ english, >> thr is a substring of 1000+ english words, if you allow arbitrary stuff in >> between or before it or after it, it can say anything, completely >> unrelated to falling through across case labels. > > True, but IMO irrelevant. We have to consider what is likely in real code. > We're trying to catch likely problems without adding a prohibitive cost to > enabling -Wextra. It's not helpful to punish people for writing code that is > valid and documents intentional fallthrough, but does it in a style or a > language we didn't expect. > > A complete solution would require working AI; maybe someone from Google can > contribute one. Failing that, we need heuristics, and I still like Michael's > suggestion of not printing a warning if we see _any_ comment, on the grounds > that this would still catch the vast majority of actual errors, without the > huge false positive rate we currently have. I think this would lead to too many false negatives, as explanatory comments before a case label are extremely common. I prefer the *fall*thr{u,ough}* heuristic. Jason