[cfe-dev] should -Wimplicit-fallthrough require C++11?
matthieu.monrocq at gmail.com
Sun Nov 11 03:51:32 PST 2012
On Sat, Nov 10, 2012 at 7:41 PM, 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
> > warning suggests) they get very frustrated. They are then left with the
> > choice of just turning the warning off, or using pragmas. For those
> > 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
> > 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, it is. Whilst turning warnings has usually been a "white-listing"
operation, -Weverything turns it into a "black-listing" operation. However
the concern here is that people rarely, if ever, reevaluate the warnings
they turn on/off (at least, not until they hit a bug and wonder if it could
have gotten caught). Therefore, by having everyone use
`-Wno-implicit-fallthrough` there is a risk that the warning will become
useless... even after people switch from C++03 to C++11.
> > If we really can't find a better solution for these people than
> > disabling the warning in languages where we can't annotate
> > fallthrough, then we should do so consistently and disable it in C++98
> > too.
> > Agreed, but I like your suggestion of using something like a builtin.
> > now this warnings feels like an incomplete feature. It has a really
> > workflow in C++11 with the use of the attribute. Otherwise, unless the
> > wants a zero-tolerance policy with this warning, the workflow is not
> > What I am afraid of is people turning this warning off (either directly
> > by never turning it on) when they may have found it useful. Once they
> > that decision, it is unlikely they will give the warning a second try.
> > You may have noticed that I reverted my change, pending further
> > here. I still think we should consider what to do for the LLVM 3.2
> > in case this doesn't get enough attention before then. I myself won't
> > any cycles over the weekend to look at this. A builtin, however, doesn't
> > sound so hard to implement, but I'd prefer some way to sugar coat this to
> > avoid the ugly syntax.
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev