http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7652
Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arthur.j.odwyer at gmail | |dot com --- Comment #15 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> 2012-11-26 22:49:02 UTC --- TL;DR — I would like to see GCC and Clang both implement __builtin_fallthrough(). I believe Lint recognizes the "magic comment" /*FALLTHROUGH*/ case 1: foo(); /*FALLTHROUGH*/ case 2: as a hint to suppress the warning. I think EDG's front-end has similar logic; certainly Green Hills' compiler recognizes /*FALLTHROUGH*/. (My memory is fuzzy because I no longer work there, but I know that Green Hills recognized a couple kinds of magic comment before I got there, which would have been six years ago.) I admit that the "magic comment" approach has problems: for example, you can't #define a macro to expand to a comment. Also it complicates the parser. Clang currently suppresses the warning only if the C++11 attribute [[clang::fallthrough]] is applied to a null statement immediately preceding "case 2:", but this doesn't work outside of C++11 mode, and it's ridiculously inappropriate as an industrywide solution (as it contains the word "clang" in the name of the attribute). case 1: foo(); [[clang::fallthrough]]; case 2: Alternatively, someone in this clang-dev thread has proposed adding a __builtin_fallthrough() intrinsic that would suppress the warning, which is not a bad idea at all. http://clang-developers.42468.n3.nabble.com/should-Wimplicit-fallthrough-require-C-11-td4028144.html Notice that __builtin_fallthrough() could be #defined away on compilers that don't support it, and unlike a "magic comment", you can #define something to expand *to* it as well. case 1: foo(); __builtin_fallthrough(); case 2: I'd like to see __builtin_fallthrough() added to all major compilers. :)