[cfe-dev] should -Wimplicit-fallthrough require C++11?

Jordan Rose jordan_rose at apple.com
Fri Nov 9 18:12:17 PST 2012

I feel like what we really want is "on by default in C++11, off by default in C and C++03", but our warning options don't support that right now. I could see this being a useful warning for codebases that want to have NO fallthroughs.


On Nov 9, 2012, at 17:55 , Ted Kremenek <kremenek at apple.com> wrote:

> Hi all,
> In response to numerous internal complaints at Apple from C/Objective-C users, I've gone and disabled -Wimplicit-fallthrough when using straight C (not C++):
>  http://llvm.org/viewvc/llvm-project?view=rev&revision=167655
> The motivation is that the attribute used to decorate a fall-through as explicit is only available when using C++11.  This was particularly frustrating for C users.
> I understand that change alone might be contentious, and obviously if there is serious concern that should be discussed.  I'd like to one step further and ask whether or not this warning should even be on when using C++98?  The same argument applies there as well; the attribute to decorate a fall-through as explicit is not available.
> Indeed, I would have gone and restricted this warning to C++11, but apparently there is a test case specifically for the C++98 scenario:
>  test/SemaCXX/switch-implicit-fallthrough-cxx98.cpp
> There was a lot of discussion about this warning when it first went in  Now that the warning is getting real living-on, I was wondering if we can discuss whether this is desired behavior?  It feels somewhat dubious to me to have a warning like this that suggests adding an annotation when no such annotation is available.
> Thoughts?  Comments?
> Cheers,
> Ted
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list