For some reason, -Wimplicit-fallthrough doesn't do anything for C code. It doesn't produce a warning for being an unrecognized flag, it just doesn't print any Diags. Would be nice to have with: https://bugs.llvm.org/show_bug.cgi?id=37135 https://godbolt.org/z/gV_c9_
https://godbolt.org/z/9Xxg9k (C++ example)
Note that the warning works when using -fdouble-square-bracket-attributes. What is missing is simply enabling the GNU attribute syntax for this one.
Could this check not depending on -fdouble-square-bracket-attributes in C mode? C/C++ code can be changed to avoid such warning without using any new feature.
This is the message I was planning to send here, but Nick went ahead :-) clang supports in C mode the [[fallthrough]] attribute using -fdouble-square-bracket-attributes. However, it does not support the GNU attribute, i.e. __fallthrough__. Since it supports both in C++ mode, could we enable it in C mode? It would increase compatibility with gcc >= 7.1 (e.g. no need to use a different definition for a __fallthrough macro between gcc and clang) and make the warning useful without the need to set -fdouble-square-bracket-attributes. This came up in the LKML while we were discussing whether to continue using gcc's "comment parsing" vs. switching already to the attribute approach. https://lore.kernel.org/lkml/20181021171414.22674-1-miguel.ojeda.sandonis@gmail.com/
https://reviews.llvm.org/D63260
Maybe a duplicate of https://bugs.llvm.org/show_bug.cgi?id=37135?
*** This bug has been marked as a duplicate of bug 37135 ***