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

Ted Kremenek kremenek at apple.com
Fri Nov 9 17:55:37 PST 2012


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



More information about the cfe-dev mailing list