[cfe-dev] should -Wimplicit-fallthrough require C++11?
Jordan Rose
jordan_rose at apple.com
Mon Nov 12 09:05:35 PST 2012
On Nov 12, 2012, at 6:35 , Douglas Gregor <dgregor at apple.com> wrote:
>
> On Nov 10, 2012, at 10:41 AM, Nico Weber <thakis at chromium.org> wrote:
>
>> On Fri, Nov 9, 2012 at 8:15 PM, Ted Kremenek <kremenek at apple.com> wrote:
>>> On Nov 9, 2012, at 7:04 PM, Richard Smith <richard at metafoo.co.uk> wrote:
>>>
>>> The original intention was that the warning could be used in any
>>> language mode, if you wanted a warning on *all* switch fallthrough,
>>> and that people who didn't want that could just not turn it on.
>>>
>>>
>>> Right.
>>>
>>> I
>>> guess the complaints you're receiving are for situations where the
>>> warning can't simply be disabled (or not enabled in the first place)?
>>>
>>>
>>> What has happened is that a fair number of users have discovered this
>>> warning using -Weverything. When they first discover it they find it
>>> interesting. After they discover that they cannot add an annotation (as the
>>> warning suggests) they get very frustrated. They are then left with the
>>> choice of just turning the warning off, or using pragmas. For those users
>>> who like the warning in principle, but find that they cannot use it in
>>> practice because of these limitations (because they are not using C++11)
>>> they view it is an incomplete feature. Several people have thus requested
>>> to not see the warning at all.
>>
>> If you're using -Weverything, shouldn't the expectation be that you'll
>> end up turning off several warnings?
>
>
> Yes, but only if those warnings aren't useful to your situation. This warning should have widespread applicability, but it's actually useless outside of C++11 because there's no clean workaround.
I disagree; as a stylistic warning -Wimplicit-fallthrough is still useful. I can definitely see a project where you'd prefer to disallow all fallthroughs and require copied code rather than annotating with a comment.
But we don't really have a good policy for purely-style warnings (besides "they could go in the analyzer instead").
Jordan
More information about the cfe-dev
mailing list