clang 10 -Wimplicit-fallthrough

Todd C. Miller Todd.Miller at sudo.ws
Sat Jun 6 04:23:13 AEST 2020


On Fri, 05 Jun 2020 09:02:01 +1000, Darren Tucker wrote:

> This is because clang 10's -Wimplicit-fallthrough doesn't understand
> /* FALLTHROUGH */ but rather requires __attribute__((fallthrough)):

Correct.  Older versions of clang ignored -Wimplicit-fallthrough
for C code because there wasn't a way to annotate the fallthrough.
Unlike gcc, clang doesn't recognize /* FALLTHROUGH */ comments.
The full list of patterns accepted by gcc are docutmented in
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-fallthrough

> None of our code has this (OpenSSH itself or the OpenBSD compat code) so
> at the moment it makes the -Werror build useless with clang.  I'd like
> to add a /* FALLTHROUGH */ to our test which will effectively disable
> -Wimplicit-fallthrough where it is currently not useful to us:

That seems like the best approach.  Currently, clang's
-Wimplicit-fallthrough option is deficient, so it is best to just
avoid using it.

 - todd


More information about the openssh-unix-dev mailing list